原文:http://blog.csdn.net/fengbingchun/article/details/19293081

SIMD相关头文件包括:

[cpp] view plaincopy
  1. //#include <ivec.h>//MMX
  2. //#include <fvec.h>//SSE(also include ivec.h)
  3. //#include <dvec.h>//SSE2(also include fvec.h)
  4. #include <mmintrin.h> //MMX
  5. #include <xmmintrin.h> //SSE(include mmintrin.h)
  6. #include <emmintrin.h> //SSE2(include xmmintrin.h)
  7. #include <pmmintrin.h> //SSE3(include emmintrin.h)
  8. #include <tmmintrin.h>//SSSE3(include pmmintrin.h)
  9. #include <smmintrin.h>//SSE4.1(include tmmintrin.h)
  10. #include <nmmintrin.h>//SSE4.2(include smmintrin.h)
  11. #include <wmmintrin.h>//AES(include nmmintrin.h)
  12. #include <immintrin.h>//AVX(include wmmintrin.h)
  13. #include <intrin.h>//(include immintrin.h)

mmintrin.h为MMX头文件,其中__m64的定义为:

[cpp] view plaincopy
  1. typedef union __declspec(intrin_type) _CRT_ALIGN(8) __m64
  2. {
  3. unsigned __int64    m64_u64;
  4. float               m64_f32[2];
  5. __int8              m64_i8[8];
  6. __int16             m64_i16[4];
  7. __int32             m64_i32[2];
  8. __int64             m64_i64;
  9. unsigned __int8     m64_u8[8];
  10. unsigned __int16    m64_u16[4];
  11. unsigned __int32    m64_u32[2];
  12. } __m64;

xmmintrin.h为SSE头文件,此头文件里包含MMX头文件,其中__m128的定义为:

[cpp] view plaincopy
  1. typedef union __declspec(intrin_type) _CRT_ALIGN(16) __m128 {
  2. float               m128_f32[4];
  3. unsigned __int64    m128_u64[2];
  4. __int8              m128_i8[16];
  5. __int16             m128_i16[8];
  6. __int32             m128_i32[4];
  7. __int64             m128_i64[2];
  8. unsigned __int8     m128_u8[16];
  9. unsigned __int16    m128_u16[8];
  10. unsigned __int32    m128_u32[4];
  11. } __m128;

xmmintrin.h文件中各函数的介绍:

  1. /*----------Floating Point Intrinsics Using Streaming SIMD Extensions------------*/
  2. //Arithmetic Operations(Floating Point ):add、sub、mul、div、sqrt、rcp、min、max
  3. //---------------------说明:_ps结尾的指令表示对4个单精度浮点数同时进行运算,
  4. //_ss结尾的指令表示仅对4个单精度浮点数最低位的浮点数进行运算---------------------
  5. //返回一个__m128的寄存器,仅将寄存器_A和寄存器_B最低对应位置的32bit单精度浮点数相加,
  6. //其余位置取寄存器_A中的数据,例如_A=(_A0,_A1,_A2,_A3), _B=(_B0,_B1,_B2,_B3),
  7. //则返回寄存器为r=(_A0+_B0, _A1, _A2, _A3)
  8. extern __m128 _mm_add_ss(__m128 _A, __m128 _B);
  9. //返回一个__m128的寄存器,将寄存器_A和_B的对应位置的32bit单精度浮点数相加,
  10. //例如_A=(_A0,_A1,_A2,_A3), _B=(_B0,_B1,_B2,_B3),
  11. //则返回寄存器r0=_A0+_B0, r1=_A1+_B1, r2=_A2+_B2, r3=_A3+_B3
  12. extern __m128 _mm_add_ps(__m128 _A, __m128 _B);
  13. //返回一个__m128的寄存器,仅将寄存器_A和寄存器_B最低对应位置的32bit单精度浮点数相减,
  14. //其余位置取寄存器_A中的数据,例如_A=(_A0,_A1,_A2,_A3), _B=(_B0,_B1,_B2,_B3),
  15. //则返回寄存器为r=(_A0-_B0, _A1, _A2, _A3)
  16. extern __m128 _mm_sub_ss(__m128 _A, __m128 _B);
  17. //返回一个__m128的寄存器,将寄存器_A和_B的对应位置的32bit单精度浮点数相减,
  18. //例如_A=(_A0,_A1,_A2,_A3), _B=(_B0,_B1,_B2,_B3),
  19. //则返回寄存器r0=_A0-_B0, r1=_A1-_B1, r2=_A2-_B2, r3=_A3-_B3
  20. extern __m128 _mm_sub_ps(__m128 _A, __m128 _B);
  21. //返回一个__m128的寄存器,仅将寄存器_A和寄存器_B最低对应位置的32bit单精度浮点数相乘,
  22. //其余位置取寄存器_A中的数据,例如_A=(_A0,_A1,_A2,_A3), _B=(_B0,_B1,_B2,_B3),
  23. //则返回寄存器为r=(_A0*_B0, _A1, _A2, _A3)
  24. extern __m128 _mm_mul_ss(__m128 _A, __m128 _B);
  25. //返回一个__m128的寄存器,将寄存器_A和_B的对应位置的32bit单精度浮点数相乘,
  26. //例如_A=(_A0,_A1,_A2,_A3), _B=(_B0,_B1,_B2,_B3),
  27. //则返回寄存器r0=_A0*_B0, r1=_A1*_B1, r2=_A2*_B2, r3=_A3*_B3
  28. extern __m128 _mm_mul_ps(__m128 _A, __m128 _B);
  29. //返回一个__m128的寄存器,仅将寄存器_A和寄存器_B最低对应位置的32bit单精度浮点数相除,
  30. //其余位置取寄存器_A中的数据,例如_A=(_A0,_A1,_A2,_A3), _B=(_B0,_B1,_B2,_B3),
  31. //则返回寄存器为r=(_A0/_B0, _A1, _A2, _A3)
  32. extern __m128 _mm_div_ss(__m128 _A, __m128 _B);
  33. //返回一个__m128的寄存器,将寄存器_A和_B的对应位置的32bit单精度浮点数相除,
  34. //例如_A=(_A0,_A1,_A2,_A3), _B=(_B0,_B1,_B2,_B3),
  35. //则返回寄存器r0=_A0/_B0, r1=_A1/_B1, r2=_A2/_B2, r3=_A3/_B3
  36. extern __m128 _mm_div_ps(__m128 _A, __m128 _B);
  37. //返回一个__m128的寄存器,仅将寄存器_A最低对应位置的32bit单精度浮点数开平方,
  38. //其余位置取寄存器_A中的数据,例如_A=(_A0,_A1,_A2,_A3)
  39. //则返回寄存器为r=(sqrt(_A0), _A1, _A2, _A3)
  40. extern __m128 _mm_sqrt_ss(__m128 _A);
  41. //返回一个__m128的寄存器,将寄存器_A中4个32bit单精度浮点数开平方,
  42. //例如_A=(_A0,_A1,_A2,_A3),则返回寄存器为
  43. //r=(sqrt(_A0), sqrt(_A1), sqrt(_A2), sqrt(_A3))
  44. extern __m128 _mm_sqrt_ps(__m128 _A);
  45. //返回一个__m128的寄存器,仅将寄存器_A最低对应位置的32bit单精度浮点数取倒数,
  46. //其余位置取寄存器_A中的数据,例如_A=(_A0,_A1,_A2,_A3)
  47. //则返回寄存器为r=(recip(_A0), _A1, _A2, _A3)
  48. extern __m128 _mm_rcp_ss(__m128 _A);
  49. //返回一个__m128的寄存器,将寄存器_A中4个32bit单精度浮点数取倒数,
  50. //例如_A=(_A0,_A1,_A2,_A3),则返回寄存器为
  51. //r=(recip(_A0), recip(_A1), recip(_A2), recip(_A3))
  52. extern __m128 _mm_rcp_ps(__m128 _A);
  53. //返回一个__m128的寄存器,仅将寄存器_A最低对应位置的32bit单精度浮点数取平方根的倒数,
  54. //其余位置取寄存器_A中的数据,例如_A=(_A0,_A1,_A2,_A3)
  55. //则返回寄存器为r=(recip(sqrt(_A0)), _A1, _A2, _A3)
  56. extern __m128 _mm_rsqrt_ss(__m128 _A);
  57. //返回一个__m128的寄存器,将寄存器_A中4个32bit单精度浮点数取平方根的倒数,
  58. //例如_A=(_A0,_A1,_A2,_A3),则返回寄存器为
  59. //r=(recip(sqrt(_A0)), recip(sqrt(_A1)), recip(sqrt(_A2)), recip(sqrt(_A3)))
  60. extern __m128 _mm_rsqrt_ps(__m128 _A);
  61. //返回一个__m128的寄存器,仅将寄存器_A和寄存器_B最低对应位置的32bit单精度浮点数取最小值,
  62. //其余位置取寄存器_A中的数据,例如_A=(_A0,_A1,_A2,_A3), _B=(_B0,_B1,_B2,_B3),
  63. //则返回寄存器为r=(min(_A0,_B0), _A1, _A2, _A3)
  64. extern __m128 _mm_min_ss(__m128 _A, __m128 _B);
  65. //返回一个__m128的寄存器,将寄存器_A和_B的对应位置的32bit单精度浮点数取最小值,
  66. //例如_A=(_A0,_A1,_A2,_A3), _B=(_B0,_B1,_B2,_B3),
  67. //则返回寄存器r0=min(_A0,_B0), r1=min(_A1,_B1), r2=min(_A2,_B2), r3=min(_A3,_B3)
  68. extern __m128 _mm_min_ps(__m128 _A, __m128 _B);
  69. //返回一个__m128的寄存器,仅将寄存器_A和寄存器_B最低对应位置的32bit单精度浮点数取最大值,
  70. //其余位置取寄存器_A中的数据,例如_A=(_A0,_A1,_A2,_A3), _B=(_B0,_B1,_B2,_B3),
  71. //则返回寄存器为r=(max(_A0,_B0), _A1, _A2, _A3)
  72. extern __m128 _mm_max_ss(__m128 _A, __m128 _B);
  73. //返回一个__m128的寄存器,将寄存器_A和_B的对应位置的32bit单精度浮点数取最大值,
  74. //例如_A=(_A0,_A1,_A2,_A3), _B=(_B0,_B1,_B2,_B3),
  75. //则返回寄存器r0=max(_A0,_B0), r1=max(_A1,_B1), r2=max(_A2,_B2), r3=max(_A3,_B3)
  76. extern __m128 _mm_max_ps(__m128 _A, __m128 _B);
  77. //Logical Operations(SSE):and、andnot、or、xor
  78. //返回一个__m128的寄存器,将寄存器_A和_B的对应位置的32bit单精度浮点数分别进行按位与运算,
  79. //例如_A=(_A0,_A1,_A2,_A3), _B=(_B0,_B1,_B2,_B3),
  80. //则返回寄存器r0=_A0 & _B0, r1=_A1 & _B1, r2=_A2 & _B2, r3=_A3 & _B3
  81. extern __m128 _mm_and_ps(__m128 _A, __m128 _B);
  82. //返回一个__m128的寄存器,将寄存器_A对应位置的32bit单精度浮点数的非和寄存器_B对应位置的32bit
  83. //单精度浮点数分别进行按位与运算,例如_A=(_A0,_A1,_A2,_A3), _B=(_B0,_B1,_B2,_B3),
  84. //则返回寄存器r0=~_A0 & _B0, r1=~_A1 & _B1, r2=~_A2 & _B2, r3=~_A3 & _B3
  85. extern __m128 _mm_andnot_ps(__m128 _A, __m128 _B);
  86. //返回一个__m128的寄存器,将寄存器_A和_B的对应位置的32bit单精度浮点数分别进行按位或运算,
  87. //例如_A=(_A0,_A1,_A2,_A3), _B=(_B0,_B1,_B2,_B3),
  88. //则返回寄存器r0=_A0 | _B0, r1=_A1 | _B1, r2=_A2 | _B2, r3=_A3 | _B3
  89. extern __m128 _mm_or_ps(__m128 _A, __m128 _B);
  90. //返回一个__m128的寄存器,将寄存器_A和_B的对应位置的32bit单精度浮点数分别进行按位异或运算,
  91. //例如_A=(_A0,_A1,_A2,_A3), _B=(_B0,_B1,_B2,_B3),
  92. //则返回寄存器r0=_A0 ^ _B0, r1=_A1 ^ _B1, r2=_A2 ^ _B2, r3=_A3 ^ _B3
  93. extern __m128 _mm_xor_ps(__m128 _A, __m128 _B);
  94. //Comparison Intrinsics(SSE):==、<、<=、>、>=、!=、不小于、不小于等于、不大于、不大于等于
  95. //返回一个__m128的寄存器,Compares for equality,
  96. //r0=(_A0 == _B0) ? 0xffffffff : 0x0, r1=_A1, r2=_A2, r3=_A3
  97. extern __m128 _mm_cmpeq_ss(__m128 _A, __m128 _B);
  98. //返回一个__m128的寄存器,Compares for equality,
  99. //r0=(_A0 == _B0) ? 0xffffffff : 0x0, r1=(_A1 == _B1) ? 0xffffffff : 0x0,
  100. //r2=(_A2 == _B2) ? 0xffffffff : 0x0, r3=(_A3 == _B3) ? 0xffffffff : 0x0
  101. extern __m128 _mm_cmpeq_ps(__m128 _A, __m128 _B);
  102. //返回一个__m128的寄存器,Compares for less than,
  103. //r0=(_A0 < _B0) ? 0xffffffff : 0x0, r1=_A1, r2=_A2, r3=_A3
  104. extern __m128 _mm_cmplt_ss(__m128 _A, __m128 _B);
  105. //返回一个__m128的寄存器,Compares for less than,
  106. //r0=(_A0 < _B0) ? 0xffffffff : 0x0, r1=(_A1 < _B1) ? 0xffffffff : 0x0,
  107. //r2=(_A2 < _B2) ? 0xffffffff : 0x0, r3=(_A3 < _B3) ? 0xffffffff : 0x0
  108. extern __m128 _mm_cmplt_ps(__m128 _A, __m128 _B);
  109. //返回一个__m128的寄存器,Compares for less than or equal,
  110. //r0=(_A0 <= _B0) ? 0xffffffff : 0x0, r1=_A1, r2=_A2, r3=_A3
  111. extern __m128 _mm_cmple_ss(__m128 _A, __m128 _B);
  112. //返回一个__m128的寄存器,Compares for less than or equal,
  113. //r0=(_A0 <= _B0) ? 0xffffffff : 0x0, r1=(_A1 <= _B1) ? 0xffffffff : 0x0,
  114. //r2=(_A2 <= _B2) ? 0xffffffff : 0x0, r3=(_A3 <= _B3) ? 0xffffffff : 0x0
  115. extern __m128 _mm_cmple_ps(__m128 _A, __m128 _B);
  116. //返回一个__m128的寄存器,Compares for greater than,
  117. //r0=(_A0 > _B0) ? 0xffffffff : 0x0, r1=_A1, r2=_A2, r3=_A3
  118. extern __m128 _mm_cmpgt_ss(__m128 _A, __m128 _B);
  119. //返回一个__m128的寄存器,Compares for greater than,
  120. //r0=(_A0 > _B0) ? 0xffffffff : 0x0, r1=(_A1 > _B1) ? 0xffffffff : 0x0,
  121. //r2=(_A2 > _B2) ? 0xffffffff : 0x0, r3=(_A3 > _B3) ? 0xffffffff : 0x0
  122. extern __m128 _mm_cmpgt_ps(__m128 _A, __m128 _B);
  123. //返回一个__m128的寄存器,Compares for greater than or equal,
  124. //r0=(_A0 >= _B0) ? 0xffffffff : 0x0, r1=_A1, r2=_A2, r3=_A3
  125. extern __m128 _mm_cmpge_ss(__m128 _A, __m128 _B);
  126. //返回一个__m128的寄存器,Compares for greater than or equal,
  127. //r0=(_A0 >= _B0) ? 0xffffffff : 0x0, r1=(_A1 >= _B1) ? 0xffffffff : 0x0,
  128. //r2=(_A2 >= _B2) ? 0xffffffff : 0x0, r3=(_A3 >= _B3) ? 0xffffffff : 0x0
  129. extern __m128 _mm_cmpge_ps(__m128 _A, __m128 _B);
  130. //返回一个__m128的寄存器,Compares for inequality,
  131. //r0=(_A0 != _B0) ? 0xffffffff : 0x0, r1=_A1, r2=_A2, r3=_A3
  132. extern __m128 _mm_cmpneq_ss(__m128 _A, __m128 _B);
  133. //返回一个__m128的寄存器,Compares for inequality,
  134. //r0=(_A0 != _B0) ? 0xffffffff : 0x0, r1=(_A1 != _B1) ? 0xffffffff : 0x0,
  135. //r2=(_A2 != _B2) ? 0xffffffff : 0x0, r3=(_A3 != _B3) ? 0xffffffff : 0x0
  136. extern __m128 _mm_cmpneq_ps(__m128 _A, __m128 _B);
  137. //返回一个__m128的寄存器,Compares for not less than,
  138. //r0= !(_A0 < _B0) ? 0xffffffff : 0x0, r1=_A1, r2=_A2, r3=_A3
  139. extern __m128 _mm_cmpnlt_ss(__m128 _A, __m128 _B);
  140. //返回一个__m128的寄存器,Compares for not less than,
  141. //r0=!(_A0 < _B0) ? 0xffffffff : 0x0, r1=!(_A1 < _B1) ? 0xffffffff : 0x0,
  142. //r2=!(_A2 < _B2) ? 0xffffffff : 0x0, r3=!(_A3 < _B3) ? 0xffffffff : 0x0
  143. extern __m128 _mm_cmpnlt_ps(__m128 _A, __m128 _B);
  144. //返回一个__m128的寄存器,Compares for not less than or equal
  145. //r0= !(_A0 <= _B0) ? 0xffffffff : 0x0, r1=_A1, r2=_A2, r3=_A3
  146. extern __m128 _mm_cmpnle_ss(__m128 _A, __m128 _B);
  147. //返回一个__m128的寄存器,Compares for not less than or equal
  148. //r0=!(_A0 <= _B0) ? 0xffffffff : 0x0, r1=!(_A1 <= _B1) ? 0xffffffff : 0x0,
  149. //r2=!(_A2 <= _B2) ? 0xffffffff : 0x0, r3=!(_A3 <= _B3) ? 0xffffffff : 0x0
  150. extern __m128 _mm_cmpnle_ps(__m128 _A, __m128 _B);
  151. //返回一个__m128的寄存器,Compares for not greater than,
  152. //r0=!(_A0 > _B0) ? 0xffffffff : 0x0, r1=_A1, r2=_A2, r3=_A3
  153. extern __m128 _mm_cmpngt_ss(__m128 _A, __m128 _B);
  154. //返回一个__m128的寄存器,Compares for not greater than,
  155. //r0=!(_A0 > _B0) ? 0xffffffff : 0x0, r1=!(_A1 > _B1) ? 0xffffffff : 0x0,
  156. //r2=!(_A2 > _B2) ? 0xffffffff : 0x0, r3=!(_A3 > _B3) ? 0xffffffff : 0x0
  157. extern __m128 _mm_cmpngt_ps(__m128 _A, __m128 _B);
  158. //返回一个__m128的寄存器,Compares for not greater than or equal,
  159. //r0=!(_A0 >= _B0) ? 0xffffffff : 0x0, r1=_A1, r2=_A2, r3=_A3
  160. extern __m128 _mm_cmpnge_ss(__m128 _A, __m128 _B);
  161. //返回一个__m128的寄存器,Compares for not greater than or equal,
  162. //r0=!(_A0 >= _B0) ? 0xffffffff : 0x0, r1=!(_A1 >= _B1) ? 0xffffffff : 0x0,
  163. //r2=!(_A2 >= _B2) ? 0xffffffff : 0x0, r3=!(_A3 >= _B3) ? 0xffffffff : 0x0
  164. extern __m128 _mm_cmpnge_ps(__m128 _A, __m128 _B);
  165. //返回一个__m128的寄存器,Compares for ordered,
  166. //r0=(_A0 ord? _B0) ? 0xffffffff : 0x0, r1=_A1, r2=_A2, r3=_A3
  167. extern __m128 _mm_cmpord_ss(__m128 _A, __m128 _B);
  168. //返回一个__m128的寄存器,Compares for ordered,
  169. //r0=(_A0 ord? _B0) ? 0xffffffff : 0x0, r1=(_A1 ord? _B1) ? 0xffffffff : 0x0,
  170. //r2=(_A2 ord? _B2) ? 0xffffffff : 0x0, r3=(_A3 ord? _B3) ? 0xffffffff : 0x0
  171. extern __m128 _mm_cmpord_ps(__m128 _A, __m128 _B);
  172. //返回一个__m128的寄存器,Compares for unordered,
  173. //r0=(_A0 unord? _B0) ? 0xffffffff : 0x0, r1=_A1, r2=_A2, r3=_A3
  174. extern __m128 _mm_cmpunord_ss(__m128 _A, __m128 _B);
  175. //返回一个__m128的寄存器,Compares for unordered,
  176. //r0=(_A0 unord? _B0) ? 0xffffffff : 0x0, r1=(_A1 unord? _B1) ? 0xffffffff : 0x0,
  177. //r2=(_A2 unord? _B2) ? 0xffffffff : 0x0, r3=(_A3 unord? _B3) ? 0xffffffff : 0x0
  178. extern __m128 _mm_cmpunord_ps(__m128 _A, __m128 _B);
  179. //返回一个0或1的整数,Compares the lower single-precision, floating-point value of
  180. //a and b for a equal to b,If a and b are equal, 1 is returned. Otherwise,
  181. //0 is returned. If a or b is a NaN, 1 is returned
  182. //r=(_A0 == _B0) ? 0x1 : 0x0
  183. extern int _mm_comieq_ss(__m128 _A, __m128 _B);
  184. //返回一个0或1的整数,If a is less than b, 1 is returned. Otherwise,
  185. //0 is returned. If a or b is a NaN, 1 is returned,
  186. //r=(_A0 < _B0) ? 0x1 : 0x0
  187. extern int _mm_comilt_ss(__m128 _A, __m128 _B);
  188. //返回一个0或1的整数,If a is less than or equal to b, 1 is returned.
  189. //Otherwise, 0 is returned. If a or b is a NaN, 1 is returned,
  190. //r=(_A0 <= _B0) ? 0x1 : 0x0
  191. extern int _mm_comile_ss(__m128 _A, __m128 _B);
  192. //返回一个0或1的整数,If a is greater than b, 1 is returned.
  193. //Otherwise, 0 is returned. If a or b is a NaN, 1 is returned,
  194. //r=(_A0 > _B0) ? 0x1 : 0x0
  195. extern int _mm_comigt_ss(__m128 _A, __m128 _B);
  196. //返回一个0或1的整数,If a is greater than or equal to b, 1 is returned.
  197. //Otherwise, 0 is returned. If a or b is a NaN, 1 is returned,
  198. //r=(_A0 >= _B0) ? 0x1 : 0x0
  199. extern int _mm_comige_ss(__m128 _A, __m128 _B);
  200. //返回一个0或1的整数,If a and b are not equal, 1 is returned.
  201. //Otherwise, 0 is returned. If a or b is a NaN, 1 is returned,
  202. //r=(_A0 != _B0) ? 0x1 : 0x0
  203. extern int _mm_comineq_ss(__m128 _A, __m128 _B);
  204. //返回一个0或1的整数,If a and b are equal, 1 is returned.
  205. //Otherwise, 0 is returned. If a or b is a NaN, 1 is returned,
  206. //r=(_A0 == _B0) ? 0x1 : 0x0
  207. extern int _mm_ucomieq_ss(__m128 _A, __m128 _B);
  208. //返回一个0或1的整数,If a is less than b , 1 is returned.
  209. //Otherwise, 0 is returned. If a or b is a NaN, 1 is returned,
  210. //r=(_A0 < _B0) ? 0x1 : 0x0
  211. extern int _mm_ucomilt_ss(__m128 _A, __m128 _B);
  212. //返回一个0或1的整数,If a is less than or equal to b, 1 is returned.
  213. //Otherwise, 0 is returned. If a or b is a NaN, 1 is returned,
  214. //r=(_A0 <= _B0) ? 0x1 : 0x0
  215. extern int _mm_ucomile_ss(__m128 _A, __m128 _B);
  216. //返回一个0或1的整数,If a is greater than b, 1 is returned.
  217. //Otherwise, 0 is returned. If a or b is a NaN, 1 is returned,
  218. //r=(_A0 > _B0) ? 0x1 : 0x0
  219. extern int _mm_ucomigt_ss(__m128 _A, __m128 _B);
  220. //返回一个0或1的整数,If a is greater than or equal to b, 1 is returned.
  221. //Otherwise, 0 is returned,r=(_A0 >= _B0) ? 0x1 : 0x0
  222. extern int _mm_ucomige_ss(__m128 _A, __m128 _B);
  223. //返回一个0或1的整数,If a and b are not equal, 1 is returned.
  224. //Otherwise, 0 is returned. If a or b is a NaN, 1 is returned,
  225. //r=(_A0 != _B0) ? 0x1 : 0x0
  226. extern int _mm_ucomineq_ss(__m128 _A, __m128 _B);
  227. //Conversion Operations(SSE)
  228. //返回一个32bit的整数,Converts the lower single-precision, floating-point value
  229. //of a to a 32-bit integer according to the current rounding mode, r=(int)_A0
  230. extern int _mm_cvt_ss2si(__m128 _A);//=_mm_cvtss_si32
  231. //返回一个__m64寄存器,Converts the two lower single-precision, floating-point
  232. //values of a to two 32-bit integers according to the current rounding mode,
  233. //returning the integers in packed form, r0=(int)_A0, r1=(int)_A1
  234. extern __m64 _mm_cvt_ps2pi(__m128 _A);//=_mm_cvtps_pi32
  235. //返回一个32bit的整数,Converts the lower single-precision, floating-point value
  236. //of a to a 32-bit integer with truncation, r=(int)_A0
  237. extern int _mm_cvtt_ss2si(__m128 _A);//=_mm_cvttss_si32
  238. //返回一个__m64寄存器,Converts the two lower single-precision, floating-point
  239. //values of a to two 32-bit integer with truncation, returning the integers
  240. //in packed form, r0=(int)_A0, r1=(int)_A1
  241. extern __m64 _mm_cvtt_ps2pi(__m128 _A);//=_mm_cvttps_pi32
  242. //返回一个__m128的寄存器,Converts the 32-bit integer value b to an single-precision,
  243. //floating-point value; the upper three single-precision, floating-point values are
  244. //passed through from a, r0=(float)_B, r1=_A1, r2=_A2, r3=_A3
  245. extern __m128 _mm_cvt_si2ss(__m128 _A, int _B);//=_mm_cvtsi32_ss
  246. //返回一个__m128的寄存器,Converts the two 32-bit integer values in packed form in b
  247. //to two single-precision, floating-point values; the upper two single-precision,
  248. //floating-point values are passed through from a
  249. //r0=(float)_B0, r1=(float)_B1, r2=_A2, r3=_A3
  250. extern __m128 _mm_cvt_pi2ps(__m128 _A, __m64 _B);//=_mm_cvtpi32_ps
  251. //返回一个__m128的寄存器,Converts the four 16-bit signed integer values in a to
  252. //four single-precision, floating-point values
  253. //r0=(float)_A0, r1=(float)_A1, r2=(float)_A2, r3=(float)_A3
  254. __inline __m128 _mm_cvtpi16_ps(__m64 _A);
  255. //返回一个__m128的寄存器,Converts the four 16-bit unsigned integer values in a
  256. //to four single-precision, floating-point values
  257. //r0=(float)_A0, r1=(float)_A1, r2=(float)_A2, r3=(float)_A3
  258. __inline __m128 _mm_cvtpu16_ps(__m64 _A);
  259. //返回一个__m64的寄存器,Converts the four single-precision, floating-point values
  260. //in a to four signed 16-bit integer values
  261. //r0=(short)_A0, r1=(short)_A1, r2=(short)_A2, r3=(short)_A3
  262. __inline __m64 _mm_cvtps_pi16(__m128 _A);
  263. //返回一个__m128的寄存器,Converts the lower four 8-bit signed integer values in a
  264. //to four single-precision, floating-point values
  265. //r0=(float)_A0, r1=(float)_A1, r2=(float)_A2, r3=(float)_A3
  266. __inline __m128 _mm_cvtpi8_ps(__m64 _A);
  267. //返回一个__m128的寄存器,Converts the lower four 8-bit unsigned integer values in a
  268. //to four single-precision, floating-point values
  269. //r0=(float)_A0, r1=(float)_A1, r2=(float)_A2, r3=(float)_A3
  270. __inline __m128 _mm_cvtpu8_ps(__m64 _A);
  271. //返回一个__m64的寄存器,Converts the four single-precision, floating-point values
  272. //in a to the lower four signed 8-bit integer values of the result
  273. //r0=(char)_A0, r1=(char)_A1, r2=(char)_A2, r3=(char)_A3
  274. __inline __m64 _mm_cvtps_pi8(__m128 _A);
  275. //返回一个__m128的寄存器,Converts the two 32-bit signed integer values in a and the
  276. //two 32-bit signed integer values in b to four single-precision, floating-point values
  277. //r0=(float)_A0, r1=(float)_A1, r2=(float)_B0, r3=(float)_B1
  278. __inline __m128 _mm_cvtpi32x2_ps(__m64 _A, __m64 _B);
  279. //返回一个32bit浮点数,Extracts the lower order floating point value from the parameter
  280. //r=_A0
  281. extern float _mm_cvtss_f32(__m128 _A);
  282. //Miscellaneous Instructions That Use Streaming SIMD Extensions:
  283. //返回一个__m128的寄存器,Selects four specific single-precision, floating-point
  284. //values from a and b, based on the mask i
  285. extern __m128 _mm_shuffle_ps(__m128 _A, __m128 _B, unsigned int _Imm8);
  286. //返回一个__m128的寄存器,Selects and interleaves the upper two single-precision,
  287. //floating-point values from a and b
  288. //r0=_A2, r1=_B2, r2=_A3, r3=_B3
  289. extern __m128 _mm_unpackhi_ps(__m128 _A, __m128 _B);
  290. //返回一个__m128的寄存器,Selects and interleaves the lower two single-precision,
  291. //floating-point values from a and b
  292. //r0=_A0, r1=_B0, r2=_A1, r3=_B1
  293. extern __m128 _mm_unpacklo_ps(__m128 _A, __m128 _B);
  294. //返回一个__m128的寄存器,Sets the upper two single-precision, floating-point
  295. //values with 64 bits of data loaded from the address p; the lower two values
  296. //are passed through from a
  297. //r0=_A0, r1=_A1, r2=*_P0, r3=*_P1
  298. extern __m128 _mm_loadh_pi(__m128 _A, __m64 const* _P);
  299. //返回一个__m128的寄存器,Moves the upper two single-precision, floating-point
  300. //values of b to the lower two single-precision, floating-point values of the result
  301. //r3=_A3, r2=_A2, r1=_B3, r0=_B2
  302. extern __m128 _mm_movehl_ps(__m128 _A, __m128 _B);
  303. //返回一个__m128的寄存器,Moves the lower two single-precision, floating-point
  304. //values of b to the upper two single-precision, floating-point values of the result
  305. //r3=_B1, r2=_B0, r1=_A1, r0=_A0
  306. extern __m128 _mm_movelh_ps(__m128 _A, __m128 _B);
  307. //返回为空,Stores the upper two single-precision, floating-point values of a
  308. //to the address p, *_P0=_A2, *_P1=_A3
  309. extern void _mm_storeh_pi(__m64 *_P, __m128 _A);
  310. //返回一个__m128的寄存器,Sets the lower two single-precision, floating-point
  311. //values with 64 bits of data loaded from the address p; the upper two values
  312. //are passed through from a
  313. //r0=*_P0, r1=*_P1, r2=_A2, r3=_A3
  314. extern __m128 _mm_loadl_pi(__m128 _A, __m64 const* _P);
  315. //返回为空,Stores the lower two single-precision, floating-point values of a
  316. //to the address p, *_P0=_A0, *_P1=_A1
  317. extern void _mm_storel_pi(__m64 *_P, __m128 _A);
  318. //返回一个整数,Creates a 4-bit mask from the most significant bits of the
  319. //four single-precision, floating-point values
  320. //r=sign(_A3)<<3 | sign(_A2)<<2 | sign(_A1)<<1 | sign(_A0)
  321. extern int _mm_movemask_ps(__m128 _A);
  322. //返回一个无符号整数,Returns the contents of the control register
  323. extern unsigned int _mm_getcsr(void);
  324. //返回为空,Sets the control register to the value specified
  325. extern void _mm_setcsr(unsigned int);
  326. //Memory and Initialization Using Streaming SIMD Extensions
  327. //Load Operations(SSE)
  328. //返回一个__m128的寄存器,Loads an single-precision, floating-point value into
  329. //the low word and clears the upper three words
  330. //r0=*_P, r1=0.0, r2=0.0, r3=0.0
  331. extern __m128 _mm_load_ss(float const* _P);
  332. //返回一个__m128的寄存器,Loads a single single-precision, floating-point value,
  333. //copying it into all four words
  334. //r0=*_P0, r1=*_P1, r2=*_P2, r3=*_P3
  335. extern __m128 _mm_load_ps1(float const* _P);//=_mm_load1_ps
  336. //返回一个__m128的寄存器,Loads four single-precision, floating-point values
  337. //The address must be 16-byte aligned
  338. //r0=_P[0], r1=_P[1], r2=_P[2], r3=_P[3]
  339. extern __m128 _mm_load_ps(float const* _P);
  340. //返回一个__m128的寄存器,Loads four single-precision, floating-point values
  341. //in reverse order, The address must be 16-byte aligned
  342. //r0=_P[3], r1=_P[2], r2=_P[1], r3=_P[0]
  343. extern __m128 _mm_loadr_ps(float const* _P);
  344. //返回一个__m128的寄存器,Loads four single-precision, floating-point values
  345. //The address does not need to be 16-byte aligned
  346. //r0=_P[0], r1=_P[1], r2=_P[2], r3=_P[3]
  347. extern __m128 _mm_loadu_ps(float const* _P);
  348. //Set Operations(SSE)
  349. //返回一个__m128的寄存器,Sets the low word of an single-precision,
  350. //floating-point value to w and clears the upper three words
  351. //r0=_W, r1=r2=r3=0.0
  352. extern __m128 _mm_set_ss(float _W);
  353. //返回一个__m128的寄存器,Sets the four single-precision, floating-point values to w
  354. //r0=r1=r2=r3=_W
  355. extern __m128 _mm_set_ps1(float _W);//=_mm_set1_ps
  356. //返回一个__m128的寄存器,Sets the four single-precision, floating-point values to
  357. //the four inputs, r0=_D, r1=_C, r2=_B, r3=_A
  358. extern __m128 _mm_set_ps(float _A, float _B, float _C, float _D);
  359. //返回一个__m128的寄存器,Sets the four single-precision, floating-point values to
  360. //the four inputs in reverse order, r0=_A, r1=_B, r2=_C, r3=_D
  361. extern __m128 _mm_setr_ps(float _A, float _B, float _C, float _D);
  362. //返回一个__m128的寄存器,Clears the four single-precision, floating-point values
  363. //r0=r1=r2=r3=0.0
  364. extern __m128 _mm_setzero_ps(void);
  365. //Store Operations(SSE)
  366. //返回为空,Stores the lower single-precision, floating-point value,*_V=_A0
  367. extern void _mm_store_ss(float *_V, __m128 _A);
  368. //返回为空,Stores the lower single-precision, floating-point value across four words
  369. //_V[0]=_A0, _V[1]=_A0, _V[2]=_A0, _V[3]=_A0
  370. extern void _mm_store_ps1(float *_V, __m128 _A);//=_mm_store1_ps
  371. //返回为空,Stores four single-precision, floating-point values
  372. //The address must be 16-byte aligned
  373. //_V[0]=_A0, _V[1]=_A1, _V[2]=_A2, _V[3]=_A3
  374. extern void _mm_store_ps(float *_V, __m128 _A);
  375. //返回为空,Stores four single-precision, floating-point values in reverse order
  376. //The address must be 16-byte aligned,
  377. //_V[0]=_A3, _V[1]=_A2, _V[2]=_A1, _V[3]=_A0
  378. extern void _mm_storer_ps(float *_V, __m128 _A);
  379. //返回为空,Stores four single-precision, floating-point values,
  380. //The address does not need to be 16-byte aligned
  381. //_V[0]=_A0, _V[1]=_A1, _V[2]=_A2, _V[3]=_A3
  382. extern void _mm_storeu_ps(float *_V, __m128 _A);
  383. //返回一个__m128的寄存器,Sets the low word to the single-precision, floating-point
  384. //value of b,The upper 3 single-precision, floating-point values are passed through
  385. //from a, r0=_B0, r1=_A1, r2=_A2, r3=_A3
  386. extern __m128 _mm_move_ss(__m128 _A, __m128 _B);
  387. //Integer Intrinsics Using Streaming SIMD Extensions
  388. //返回一个16bit整数,Extracts one of the four words of a,
  389. //The selector n must be an immediate,
  390. //r=(_Imm == 0) ? _A0 : ((_Imm==1) ? _A1 : ((_Imm==2) ? _A2 : _A3))
  391. extern int _m_pextrw(__m64 _A, int _Imm);//=_mm_extract_pi16
  392. //返回一个__m64的寄存器,Inserts word d into one of four words of a,
  393. //The selector n must be an immediate
  394. //r0=(_Imm==0)? _D : _A0, r1=(_Imm==1)? _D : _A1,
  395. //r2=(_Imm==2)? _D : _A2, r3=(_Imm==3)? _D : _A3
  396. extern __m64 _m_pinsrw(__m64 _A, int _D, int _Imm);//=_mm_insert_pi16
  397. //返回一个__m64的寄存器,Computes the element-wise maximum of the words in a and b,
  398. //r0=max(_A0, _B0), r1=max(_A1, _B1), r2=max(_A2, _B2), r3=max(_A3, _B3)
  399. extern __m64 _m_pmaxsw(__m64 _A, __m64 _B);//=_mm_max_pi16
  400. //返回一个__m64的寄存器,Computes the element-wise maximum of the unsigned bytes in
  401. //a and b, r0=max(_A0, _B0), r1=max(_A1, _B1), ... r7=max(_A7, _B7)
  402. extern __m64 _m_pmaxub(__m64 _A, __m64 _B);//=_mm_max_pu8
  403. //返回一个__m64的寄存器,Computes the element-wise minimum of the words in a and b
  404. //r0=min(_A0, _B0), r1=min(_A1, _B1), r2=min(_A2, _B2), r3=min(_A3, _B3)
  405. extern __m64 _m_pminsw(__m64 _A, __m64 _B);//=_mm_min_pi16
  406. //返回一个__m64的寄存器,Computes the element-wise minimum of the unsigned bytes
  407. //in a and b, r0=min(_A0, _B0), r1=min(_A1, _B1), ... r7=min(_A7, _B7)
  408. extern __m64 _m_pminub(__m64 _A, __m64 _B);//=_mm_min_pu8
  409. //返回一个整数,Creates an 8-bit mask from the most significant bits of the
  410. //bytes in a, r=sign(_A7)<<7 | sign(_A6)<<6 | ... | sign(_A0)
  411. extern int _m_pmovmskb(__m64 _A);//=_mm_movemask_pi8
  412. //返回一个__m64的寄存器,Multiplies the unsigned words in a and b, returning the
  413. //upper 16 bits of the 32-bit intermediate results,
  414. //r0=hiword(_A0, _B0), r1=hiword(_A1, _B1), r2=hiword(_A2, _B2), r3=hiword(_A3, _B3)
  415. extern __m64 _m_pmulhuw(__m64 _A, __m64 _B);//=_mm_mulhi_pu16
  416. //返回为空,Conditionally stores byte elements of d to address p,The high bit of
  417. //each byte in the selector _B determines whether the corresponding byte in _A
  418. //will be stored, if (sign(_B0)) _P[0]=_A0, if (sign(_B1)) _P[1]=_A1, ...
  419. //if (sign(_B7)) _P[7]=_A7
  420. extern void _m_maskmovq(__m64 _A, __m64 _B, char * _P);//=_mm_maskmove_si64
  421. //返回一个__m64的寄存器,Computes the (rounded) averages of the unsigned bytes
  422. //in a and b, t=(unsigned short)_A0 + (unsigned short)_B0, r0=(t>>1) | (t & 0x01),
  423. //..., t=(unsigned short)_A7 + (unsigned short)_B7, r7=(t>>1) | (t & 0x01)
  424. extern __m64 _m_pavgb(__m64 _A, __m64 _B);//=_mm_avg_pu8
  425. //返回一个__m64的寄存器,Computes the (rounded) averages of the unsigned words
  426. //in a and b, t=(unsigned short)_A0 + (unsigned short)_B0, r0=(t>>1) | (t & 0x01),
  427. //..., t=(unsigned short)_A4 + (unsigned short)_B4, r7=(t>>1) | (t & 0x01)
  428. extern __m64 _m_pavgw(__m64 _A, __m64 _B);//=_mm_avg_pu16
  429. //返回一个__m64的寄存器,Computes the sum of the absolute differences of the unsigned
  430. //bytes in a and b, returning the value in the lower word
  431. //The upper three words are cleared
  432. //r0=abs(_A0-_B0) + ... + abs(_A7-_B7), r1=r2=r3=0
  433. extern __m64 _m_psadbw(__m64, __m64);//=_mm_sad_pu8
  434. //返回一个__m64的寄存器,Returns a combination of the four words of a.
  435. //The selector _Imm must be an immediate
  436. //r0=word(_Imm & 0x03) of _A, r1=word((_Imm>>2) & 0x03) of _A,
  437. //r2=word((_Imm>>4) & 0x03) of _A, r1=word((_Imm>>6) & 0x03) of _A,
  438. extern __m64 _m_pshufw(__m64 _A, int _Imm);//=_mm_shuffle_pi16
  439. //Streaming SIMD Extensions that Support the Cache
  440. //返回为空,Loads one cache line of data from address p to a location closer
  441. //to the processor, The value _Sel specifies the type of prefetch operation
  442. extern void _mm_prefetch(char const*_A, int _Sel);
  443. //返回为空,Stores the data in a to the address p without polluting the caches
  444. //This intrinsic requires you to empty the multimedia state for the MMX register
  445. extern void _mm_stream_pi(__m64 * _P, __m64 _A);
  446. //返回为空,Stores the data in a to the address p without polluting the caches,
  447. //The address must be 16-byte aligned
  448. extern void _mm_stream_ps(float *, __m128 _A);
  449. //返回为空,Guarantees that every preceding store is globally visible
  450. //before any subsequent store
  451. extern void _mm_sfence(void);
  452. /* Alternate intrinsic names definition */
  453. #define _mm_cvtss_si32    _mm_cvt_ss2si
  454. #define _mm_cvtps_pi32    _mm_cvt_ps2pi
  455. #define _mm_cvttss_si32   _mm_cvtt_ss2si
  456. #define _mm_cvttps_pi32   _mm_cvtt_ps2pi
  457. #define _mm_cvtsi32_ss    _mm_cvt_si2ss
  458. #define _mm_cvtpi32_ps    _mm_cvt_pi2ps
  459. #define _mm_extract_pi16  _m_pextrw
  460. #define _mm_insert_pi16   _m_pinsrw
  461. #define _mm_max_pi16      _m_pmaxsw
  462. #define _mm_max_pu8       _m_pmaxub
  463. #define _mm_min_pi16      _m_pminsw
  464. #define _mm_min_pu8       _m_pminub
  465. #define _mm_movemask_pi8  _m_pmovmskb
  466. #define _mm_mulhi_pu16    _m_pmulhuw
  467. #define _mm_shuffle_pi16  _m_pshufw
  468. #define _mm_maskmove_si64 _m_maskmovq
  469. #define _mm_avg_pu8       _m_pavgb
  470. #define _mm_avg_pu16      _m_pavgw
  471. #define _mm_sad_pu8       _m_psadbw
  472. #define _mm_set1_ps       _mm_set_ps1
  473. #define _mm_load1_ps      _mm_load_ps1
  474. #define _mm_store1_ps     _mm_store_ps1

SSE Intrinsics各函数介绍相关推荐

  1. SSE3 和 SSSE3 Intrinsics各函数介绍

    [转载]:SSE3和SSSE3 Intrinsics各函数介绍 SIMD相关头文件包括: mmintrin.h为MMX 头文件,其中__m64的定义为: xmmintrin.h为SSE 头文件,此头文 ...

  2. SSE4.1和SSE4.2 Intrinsics各函数介绍

    SIMD相关头文件包括: //#include <ivec.h>//MMX //#include <fvec.h>//SSE(also include ivec.h) //#i ...

  3. MMX Intrinsics各函数介绍

    SIMD相关头文件包括: //#include <ivec.h>//MMX //#include <fvec.h>//SSE(also include ivec.h) //#i ...

  4. SSE2 Intrinsics各函数介绍

    SIMD相关头文件包括: //#include <ivec.h>//MMX //#include <fvec.h>//SSE(also include ivec.h) //#i ...

  5. SSE2 Intrinsics各函数介绍 及简单例子

    转载地址 http://blog.csdn.net/fengbingchun/article/details/18460199 关于ARM上的SIMD可以参见网址,ARM上的SIMD技术叫NEON: ...

  6. AES(Advanced Encryption Standard) Intrinsics各函数介绍

    AES为高级加密标准,是较流行的一种密码算法. SIMD相关头文件包括: //#include <ivec.h>//MMX //#include <fvec.h>//SSE(a ...

  7. SSE3和SSSE3 Intrinsics各函数介绍

    SIMD相关头文件包括: //#include <ivec.h>//MMX //#include <fvec.h>//SSE(also include ivec.h) //#i ...

  8. Neon Intrinsics各函数介绍

    #ifndef __ARM_NEON__ #error You must enable NEON instructions (e.g. -mfloat-abi=softfp -mfpu=neon) t ...

  9. ARM Neon Intrinsics各函数介绍

    #ifndef __ARM_NEON__ #error You must enable NEON instructions (e.g. -mfloat-abi=softfp -mfpu=neon) t ...

最新文章

  1. 网易开源支持图像识别的自动化UI测试工具,零基础亲测好评!
  2. python下载百度网盘文件-python通过百度云api的方式上传或下载文件
  3. CTFshow php特性 web102
  4. 原码、反码、补码的产生、应用以及优缺点有哪些?
  5. Spring could 使用Feign超时问题
  6. mysql 数据库编程_MySQL数据库编程(C++语言)
  7. 一站式解决,Android 拍照 图库的各种问题
  8. 从3000米高空,一跃而下…
  9. 基于MHA+semi sync实现mysql数据库的高可用
  10. 【华为云技术分享】AI 开发路漫漫,什么才是真正的极客精神?
  11. Python文本转化语音模块大比拼,看看青铜与王者的差别!
  12. java t9 字母组合_太赞了!美团T9终于整理出Java架构之完美设计实战开源文档
  13. Matlab2018a安装教程
  14. 视频教程-MATLAB与SPSS接口-Matlab
  15. OpenCV官方网站:这里可以白嫖教程、检索API、下载例程
  16. Jetson Nano设置开机启动程序
  17. 图片边框变圆圈html,css如何设置边框的圆角样式?border-radius属性设置圆角样式(图 文)...
  18. SHAPE 文件格式详解
  19. java 计算当天剩余多少秒
  20. 计算机端口怎么配置波特率,西门子plc波特率如何设置?

热门文章

  1. 一阶电路实验报告心得_一阶电路实验报告5篇
  2. 软件测试的新技术和方法
  3. 【机器视觉】Halcon 19安装教程详解
  4. 一个关于随机矩阵谱范数的不等式
  5. Python基于Django航空飞机票预定网站设计
  6. 宜家IKEA EDIFACT PRODAT报文详解
  7. 小程序商城制作一个需要多少钱?
  8. 手机照片误删怎么找回
  9. 数据脱敏(Data Masking)- 模块功能设计
  10. python开发PC端桌面应用