📄 xmmintrin.h
字号:
{ return (__m64) __builtin_ia32_cvttps2pi ((__v4sf) __A);}/* Convert B to a SPFP value and insert it as element zero in A. */static __inline __m128_mm_cvtsi32_ss (__m128 __A, int __B){ return (__m128) __builtin_ia32_cvtsi2ss ((__v4sf) __A, __B);}#ifdef __x86_64__/* Convert B to a SPFP value and insert it as element zero in A. */static __inline __m128_mm_cvtsi64x_ss (__m128 __A, long long __B){ return (__m128) __builtin_ia32_cvtsi642ss ((__v4sf) __A, __B);}#endif/* Convert the two 32-bit values in B to SPFP form and insert them as the two lower elements in A. */static __inline __m128_mm_cvtpi32_ps (__m128 __A, __m64 __B){ return (__m128) __builtin_ia32_cvtpi2ps ((__v4sf) __A, (__v2si)__B);}/* Convert the four signed 16-bit values in A to SPFP form. */static __inline __m128_mm_cvtpi16_ps (__m64 __A){ __v4hi __sign; __v2si __hisi, __losi; __v4sf __r; /* This comparison against zero gives us a mask that can be used to fill in the missing sign bits in the unpack operations below, so that we get signed values after unpacking. */ __sign = (__v4hi) __builtin_ia32_mmx_zero (); __sign = __builtin_ia32_pcmpgtw (__sign, (__v4hi)__A); /* Convert the four words to doublewords. */ __hisi = (__v2si) __builtin_ia32_punpckhwd ((__v4hi)__A, __sign); __losi = (__v2si) __builtin_ia32_punpcklwd ((__v4hi)__A, __sign); /* Convert the doublewords to floating point two at a time. */ __r = (__v4sf) __builtin_ia32_setzerops (); __r = __builtin_ia32_cvtpi2ps (__r, __hisi); __r = __builtin_ia32_movlhps (__r, __r); __r = __builtin_ia32_cvtpi2ps (__r, __losi); return (__m128) __r;}/* Convert the four unsigned 16-bit values in A to SPFP form. */static __inline __m128_mm_cvtpu16_ps (__m64 __A){ __v4hi __zero = (__v4hi) __builtin_ia32_mmx_zero (); __v2si __hisi, __losi; __v4sf __r; /* Convert the four words to doublewords. */ __hisi = (__v2si) __builtin_ia32_punpckhwd ((__v4hi)__A, __zero); __losi = (__v2si) __builtin_ia32_punpcklwd ((__v4hi)__A, __zero); /* Convert the doublewords to floating point two at a time. */ __r = (__v4sf) __builtin_ia32_setzerops (); __r = __builtin_ia32_cvtpi2ps (__r, __hisi); __r = __builtin_ia32_movlhps (__r, __r); __r = __builtin_ia32_cvtpi2ps (__r, __losi); return (__m128) __r;}/* Convert the low four signed 8-bit values in A to SPFP form. */static __inline __m128_mm_cvtpi8_ps (__m64 __A){ __v8qi __sign; /* This comparison against zero gives us a mask that can be used to fill in the missing sign bits in the unpack operations below, so that we get signed values after unpacking. */ __sign = (__v8qi) __builtin_ia32_mmx_zero (); __sign = __builtin_ia32_pcmpgtb (__sign, (__v8qi)__A); /* Convert the four low bytes to words. */ __A = (__m64) __builtin_ia32_punpcklbw ((__v8qi)__A, __sign); return _mm_cvtpi16_ps(__A);}/* Convert the low four unsigned 8-bit values in A to SPFP form. */static __inline __m128_mm_cvtpu8_ps(__m64 __A){ __v8qi __zero = (__v8qi) __builtin_ia32_mmx_zero (); __A = (__m64) __builtin_ia32_punpcklbw ((__v8qi)__A, __zero); return _mm_cvtpu16_ps(__A);}/* Convert the four signed 32-bit values in A and B to SPFP form. */static __inline __m128_mm_cvtpi32x2_ps(__m64 __A, __m64 __B){ __v4sf __zero = (__v4sf) __builtin_ia32_setzerops (); __v4sf __sfa = __builtin_ia32_cvtpi2ps (__zero, (__v2si)__A); __v4sf __sfb = __builtin_ia32_cvtpi2ps (__zero, (__v2si)__B); return (__m128) __builtin_ia32_movlhps (__sfa, __sfb);}/* Convert the four SPFP values in A to four signed 16-bit integers. */static __inline __m64_mm_cvtps_pi16(__m128 __A){ __v4sf __hisf = (__v4sf)__A; __v4sf __losf = __builtin_ia32_movhlps (__hisf, __hisf); __v2si __hisi = __builtin_ia32_cvtps2pi (__hisf); __v2si __losi = __builtin_ia32_cvtps2pi (__losf); return (__m64) __builtin_ia32_packssdw (__hisi, __losi);}/* Convert the four SPFP values in A to four signed 8-bit integers. */static __inline __m64_mm_cvtps_pi8(__m128 __A){ __v4hi __tmp = (__v4hi) _mm_cvtps_pi16 (__A); __v4hi __zero = (__v4hi) __builtin_ia32_mmx_zero (); return (__m64) __builtin_ia32_packsswb (__tmp, __zero);}/* Selects four specific SPFP values from A and B based on MASK. */#if 0static __inline __m128_mm_shuffle_ps (__m128 __A, __m128 __B, int __mask){ return (__m128) __builtin_ia32_shufps ((__v4sf)__A, (__v4sf)__B, __mask);}#else#define _mm_shuffle_ps(A, B, MASK) \ ((__m128) __builtin_ia32_shufps ((__v4sf)(A), (__v4sf)(B), (MASK)))#endif/* Selects and interleaves the upper two SPFP values from A and B. */static __inline __m128_mm_unpackhi_ps (__m128 __A, __m128 __B){ return (__m128) __builtin_ia32_unpckhps ((__v4sf)__A, (__v4sf)__B);}/* Selects and interleaves the lower two SPFP values from A and B. */static __inline __m128_mm_unpacklo_ps (__m128 __A, __m128 __B){ return (__m128) __builtin_ia32_unpcklps ((__v4sf)__A, (__v4sf)__B);}/* Sets the upper two SPFP values with 64-bits of data loaded from P; the lower two values are passed through from A. */static __inline __m128_mm_loadh_pi (__m128 __A, __m64 const *__P){ return (__m128) __builtin_ia32_loadhps ((__v4sf)__A, (__v2si *)__P);}/* Stores the upper two SPFP values of A into P. */static __inline void_mm_storeh_pi (__m64 *__P, __m128 __A){ __builtin_ia32_storehps ((__v2si *)__P, (__v4sf)__A);}/* Moves the upper two values of B into the lower two values of A. */static __inline __m128_mm_movehl_ps (__m128 __A, __m128 __B){ return (__m128) __builtin_ia32_movhlps ((__v4sf)__A, (__v4sf)__B);}/* Moves the lower two values of B into the upper two values of A. */static __inline __m128_mm_movelh_ps (__m128 __A, __m128 __B){ return (__m128) __builtin_ia32_movlhps ((__v4sf)__A, (__v4sf)__B);}/* Sets the lower two SPFP values with 64-bits of data loaded from P; the upper two values are passed through from A. */static __inline __m128_mm_loadl_pi (__m128 __A, __m64 const *__P){ return (__m128) __builtin_ia32_loadlps ((__v4sf)__A, (__v2si *)__P);}/* Stores the lower two SPFP values of A into P. */static __inline void_mm_storel_pi (__m64 *__P, __m128 __A){ __builtin_ia32_storelps ((__v2si *)__P, (__v4sf)__A);}/* Creates a 4-bit mask from the most significant bits of the SPFP values. */static __inline int_mm_movemask_ps (__m128 __A){ return __builtin_ia32_movmskps ((__v4sf)__A);}/* Return the contents of the control register. */static __inline unsigned int_mm_getcsr (void){ return __builtin_ia32_stmxcsr ();}/* Read exception bits from the control register. */static __inline unsigned int_MM_GET_EXCEPTION_STATE (void){ return _mm_getcsr() & _MM_EXCEPT_MASK;}static __inline unsigned int_MM_GET_EXCEPTION_MASK (void){ return _mm_getcsr() & _MM_MASK_MASK;}static __inline unsigned int_MM_GET_ROUNDING_MODE (void){ return _mm_getcsr() & _MM_ROUND_MASK;}static __inline unsigned int_MM_GET_FLUSH_ZERO_MODE (void){ return _mm_getcsr() & _MM_FLUSH_ZERO_MASK;}/* Set the control register to I. */static __inline void_mm_setcsr (unsigned int __I){ __builtin_ia32_ldmxcsr (__I);}/* Set exception bits in the control register. */static __inline void_MM_SET_EXCEPTION_STATE(unsigned int __mask){ _mm_setcsr((_mm_getcsr() & ~_MM_EXCEPT_MASK) | __mask);}static __inline void_MM_SET_EXCEPTION_MASK (unsigned int __mask){ _mm_setcsr((_mm_getcsr() & ~_MM_MASK_MASK) | __mask);}static __inline void_MM_SET_ROUNDING_MODE (unsigned int __mode){ _mm_setcsr((_mm_getcsr() & ~_MM_ROUND_MASK) | __mode);}static __inline void_MM_SET_FLUSH_ZERO_MODE (unsigned int __mode){ _mm_setcsr((_mm_getcsr() & ~_MM_FLUSH_ZERO_MASK) | __mode);}/* Create a vector with element 0 as *P and the rest zero. */static __inline __m128_mm_load_ss (float const *__P){ return (__m128) __builtin_ia32_loadss (__P);}/* Create a vector with all four elements equal to *P. */static __inline __m128_mm_load1_ps (float const *__P){ __v4sf __tmp = __builtin_ia32_loadss (__P); return (__m128) __builtin_ia32_shufps (__tmp, __tmp, _MM_SHUFFLE (0,0,0,0));}static __inline __m128_mm_load_ps1 (float const *__P){ return _mm_load1_ps (__P);}/* Load four SPFP values from P. The address must be 16-byte aligned. */static __inline __m128_mm_load_ps (float const *__P){ return (__m128) __builtin_ia32_loadaps (__P);}/* Load four SPFP values from P. The address need not be 16-byte aligned. */static __inline __m128_mm_loadu_ps (float const *__P){ return (__m128) __builtin_ia32_loadups (__P);}/* Load four SPFP values in reverse order. The address must be aligned. */static __inline __m128_mm_loadr_ps (float const *__P){ __v4sf __tmp = __builtin_ia32_loadaps (__P); return (__m128) __builtin_ia32_shufps (__tmp, __tmp, _MM_SHUFFLE (0,1,2,3));}/* Create a vector with element 0 as F and the rest zero. */static __inline __m128_mm_set_ss (float __F){ return (__m128) __builtin_ia32_loadss (&__F);}/* Create a vector with all four elements equal to F. */static __inline __m128_mm_set1_ps (float __F){ __v4sf __tmp = __builtin_ia32_loadss (&__F); return (__m128) __builtin_ia32_shufps (__tmp, __tmp, _MM_SHUFFLE (0,0,0,0));}static __inline __m128_mm_set_ps1 (float __F){ return _mm_set1_ps (__F);}/* Create the vector [Z Y X W]. */static __inline __m128_mm_set_ps (float __Z, float __Y, float __X, float __W){ union { float __a[4]; __m128 __v; } __u; __u.__a[0] = __W; __u.__a[1] = __X; __u.__a[2] = __Y; __u.__a[3] = __Z; return __u.__v;}/* Create the vector [W X Y Z]. */static __inline __m128_mm_setr_ps (float __Z, float __Y, float __X, float __W){ return _mm_set_ps (__W, __X, __Y, __Z);}/* Create a vector of zeros. */static __inline __m128_mm_setzero_ps (void){ return (__m128) __builtin_ia32_setzerops ();}/* Stores the lower SPFP value. */static __inline void_mm_store_ss (float *__P, __m128 __A){ __builtin_ia32_storess (__P, (__v4sf)__A);}/* Store the lower SPFP value across four words. */static __inline void_mm_store1_ps (float *__P, __m128 __A){ __v4sf __va = (__v4sf)__A; __v4sf __tmp = __builtin_ia32_shufps (__va, __va, _MM_SHUFFLE (0,0,0,0)); __builtin_ia32_storeaps (__P, __tmp);}static __inline void_mm_store_ps1 (float *__P, __m128 __A){ _mm_store1_ps (__P, __A);}/* Store four SPFP values. The address must be 16-byte aligned. */static __inline void_mm_store_ps (float *__P, __m128 __A){ __builtin_ia32_storeaps (__P, (__v4sf)__A);}/* Store four SPFP values. The address need not be 16-byte aligned. */static __inline void_mm_storeu_ps (float *__P, __m128 __A){ __builtin_ia32_storeups (__P, (__v4sf)__A);}/* Store four SPFP values in reverse order. The address must be aligned. */static __inline void_mm_storer_ps (float *__P, __m128 __A){ __v4sf __va = (__v4sf)__A; __v4sf __tmp = __builtin_ia32_shufps (__va, __va, _MM_SHUFFLE (0,1,2,3)); __builtin_ia32_storeaps (__P, __tmp);}/* Sets the low SPFP value of A from the low value of B. */static __inline __m128_mm_move_ss (__m128 __A, __m128 __B){ return (__m128) __builtin_ia32_movss ((__v4sf)__A, (__v4sf)__B);}/* Extracts one of the four words of A. The selector N must be immediate. */#if 0static __inline int_mm_extract_pi16 (__m64 __A, int __N){ return __builtin_ia32_pextrw ((__v4hi)__A, __N);}#else#define _mm_extract_pi16(A, N) \ __builtin_ia32_pextrw ((__v4hi)(A), (N))#endif/* Inserts word D into one of four words of A. The selector N must be immediate. */#if 0static __inline __m64_mm_insert_pi16 (__m64 __A, int __D, int __N){ return (__m64)__builtin_ia32_pinsrw ((__v4hi)__A, __D, __N);}#else#define _mm_insert_pi16(A, D, N) \ ((__m64) __builtin_ia32_pinsrw ((__v4hi)(A), (D), (N)))#endif/* Compute the element-wise maximum of signed 16-bit values. */static __inline __m64_mm_max_pi16 (__m64 __A, __m64 __B){ return (__m64) __builtin_ia32_pmaxsw ((__v4hi)__A, (__v4hi)__B);}/* Compute the element-wise maximum of unsigned 8-bit values. */static __inline __m64_mm_max_pu8 (__m64 __A, __m64 __B){ return (__m64) __builtin_ia32_pmaxub ((__v8qi)__A, (__v8qi)__B);}/* Compute the element-wise minimum of signed 16-bit values. */static __inline __m64_mm_min_pi16 (__m64 __A, __m64 __B){ return (__m64) __builtin_ia32_pminsw ((__v4hi)__A, (__v4hi)__B);}/* Compute the element-wise minimum of unsigned 8-bit values. */static __inline __m64_mm_min_pu8 (__m64 __A, __m64 __B){ return (__m64) __builtin_ia32_pminub ((__v8qi)__A, (__v8qi)__B);}/* Create an 8-bit mask of the signs of 8-bit values. */static __inline int_mm_movemask_pi8 (__m64 __A){ return __builtin_ia32_pmovmskb ((__v8qi)__A);}/* Multiply four unsigned 16-bit values in A by four unsigned 16-bit values in B and produce the high 16 bits of the 32-bit results. */static __inline __m64_mm_mulhi_pu16 (__m64 __A, __m64 __B){ return (__m64) __builtin_ia32_pmulhuw ((__v4hi)__A, (__v4hi)__B);}/* Return a combination of the four 16-bit values in A. The selector must be an immediate. */#if 0static __inline __m64_mm_shuffle_pi16 (__m64 __A, int __N){ return (__m64) __builtin_ia32_pshufw ((__v4hi)__A, __N);}#else#define _mm_shuffle_pi16(A, N) \ ((__m64) __builtin_ia32_pshufw ((__v4hi)(A), (N)))#endif/* Conditionally store byte elements of A into P. The high bit of each byte in the selector N determines whether the corresponding byte from A is stored. */static __inline void_mm_maskmove_si64 (__m64 __A, __m64 __N, char *__P){ __builtin_ia32_maskmovq ((__v8qi)__A, (__v8qi)__N, __P);}/* Compute the rounded averages of the unsigned 8-bit values in A and B. */static __inline __m64_mm_avg_pu8 (__m64 __A, __m64 __B)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -