clang API Documentation

smmintrin.h
Go to the documentation of this file.
00001 /*===---- smmintrin.h - SSE4 intrinsics ------------------------------------===
00002  *
00003  * Permission is hereby granted, free of charge, to any person obtaining a copy
00004  * of this software and associated documentation files (the "Software"), to deal
00005  * in the Software without restriction, including without limitation the rights
00006  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00007  * copies of the Software, and to permit persons to whom the Software is
00008  * furnished to do so, subject to the following conditions:
00009  *
00010  * The above copyright notice and this permission notice shall be included in
00011  * all copies or substantial portions of the Software.
00012  *
00013  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00014  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00015  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00016  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00017  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00018  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
00019  * THE SOFTWARE.
00020  *
00021  *===-----------------------------------------------------------------------===
00022  */
00023 
00024 #ifndef _SMMINTRIN_H
00025 #define _SMMINTRIN_H
00026 
00027 #ifndef __SSE4_1__
00028 #error "SSE4.1 instruction set not enabled"
00029 #else
00030 
00031 #include <tmmintrin.h>
00032 
00033 /* SSE4 Rounding macros. */
00034 #define _MM_FROUND_TO_NEAREST_INT    0x00
00035 #define _MM_FROUND_TO_NEG_INF        0x01
00036 #define _MM_FROUND_TO_POS_INF        0x02
00037 #define _MM_FROUND_TO_ZERO           0x03
00038 #define _MM_FROUND_CUR_DIRECTION     0x04
00039 
00040 #define _MM_FROUND_RAISE_EXC         0x00
00041 #define _MM_FROUND_NO_EXC            0x08
00042 
00043 #define _MM_FROUND_NINT      (_MM_FROUND_RAISE_EXC | _MM_FROUND_TO_NEAREST_INT)
00044 #define _MM_FROUND_FLOOR     (_MM_FROUND_RAISE_EXC | _MM_FROUND_TO_NEG_INF)
00045 #define _MM_FROUND_CEIL      (_MM_FROUND_RAISE_EXC | _MM_FROUND_TO_POS_INF)
00046 #define _MM_FROUND_TRUNC     (_MM_FROUND_RAISE_EXC | _MM_FROUND_TO_ZERO)
00047 #define _MM_FROUND_RINT      (_MM_FROUND_RAISE_EXC | _MM_FROUND_CUR_DIRECTION)
00048 #define _MM_FROUND_NEARBYINT (_MM_FROUND_NO_EXC | _MM_FROUND_CUR_DIRECTION)
00049 
00050 #define _mm_ceil_ps(X)       _mm_round_ps((X), _MM_FROUND_CEIL)
00051 #define _mm_ceil_pd(X)       _mm_round_pd((X), _MM_FROUND_CEIL)
00052 #define _mm_ceil_ss(X, Y)    _mm_round_ss((X), (Y), _MM_FROUND_CEIL)
00053 #define _mm_ceil_sd(X, Y)    _mm_round_sd((X), (Y), _MM_FROUND_CEIL)
00054 
00055 #define _mm_floor_ps(X)      _mm_round_ps((X), _MM_FROUND_FLOOR)
00056 #define _mm_floor_pd(X)      _mm_round_pd((X), _MM_FROUND_FLOOR)
00057 #define _mm_floor_ss(X, Y)   _mm_round_ss((X), (Y), _MM_FROUND_FLOOR)
00058 #define _mm_floor_sd(X, Y)   _mm_round_sd((X), (Y), _MM_FROUND_FLOOR)
00059 
00060 #define _mm_round_ps(X, M) __extension__ ({ \
00061   __m128 __X = (X); \
00062   (__m128) __builtin_ia32_roundps((__v4sf)__X, (M)); })
00063 
00064 #define _mm_round_ss(X, Y, M) __extension__ ({ \
00065   __m128 __X = (X); \
00066   __m128 __Y = (Y); \
00067   (__m128) __builtin_ia32_roundss((__v4sf)__X, (__v4sf)__Y, (M)); })
00068 
00069 #define _mm_round_pd(X, M) __extension__ ({ \
00070   __m128d __X = (X); \
00071   (__m128d) __builtin_ia32_roundpd((__v2df)__X, (M)); })
00072 
00073 #define _mm_round_sd(X, Y, M) __extension__ ({ \
00074   __m128d __X = (X); \
00075   __m128d __Y = (Y); \
00076   (__m128d) __builtin_ia32_roundsd((__v2df)__X, (__v2df)__Y, (M)); })
00077 
00078 /* SSE4 Packed Blending Intrinsics.  */
00079 #define _mm_blend_pd(V1, V2, M) __extension__ ({ \
00080   __m128d __V1 = (V1); \
00081   __m128d __V2 = (V2); \
00082   (__m128d)__builtin_shufflevector((__v2df)__V1, (__v2df)__V2, \
00083                                    (((M) & 0x01) ? 2 : 0), \
00084                                    (((M) & 0x02) ? 3 : 1)); })
00085 
00086 #define _mm_blend_ps(V1, V2, M) __extension__ ({ \
00087   __m128 __V1 = (V1); \
00088   __m128 __V2 = (V2); \
00089   (__m128)__builtin_shufflevector((__v4sf)__V1, (__v4sf)__V2, \
00090                                   (((M) & 0x01) ? 4 : 0), \
00091                                   (((M) & 0x02) ? 5 : 1), \
00092                                   (((M) & 0x04) ? 6 : 2), \
00093                                   (((M) & 0x08) ? 7 : 3)); })
00094 
00095 static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
00096 _mm_blendv_pd (__m128d __V1, __m128d __V2, __m128d __M)
00097 {
00098   return (__m128d) __builtin_ia32_blendvpd ((__v2df)__V1, (__v2df)__V2,
00099                                             (__v2df)__M);
00100 }
00101 
00102 static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
00103 _mm_blendv_ps (__m128 __V1, __m128 __V2, __m128 __M)
00104 {
00105   return (__m128) __builtin_ia32_blendvps ((__v4sf)__V1, (__v4sf)__V2,
00106                                            (__v4sf)__M);
00107 }
00108 
00109 static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
00110 _mm_blendv_epi8 (__m128i __V1, __m128i __V2, __m128i __M)
00111 {
00112   return (__m128i) __builtin_ia32_pblendvb128 ((__v16qi)__V1, (__v16qi)__V2,
00113                                                (__v16qi)__M);
00114 }
00115 
00116 #define _mm_blend_epi16(V1, V2, M) __extension__ ({ \
00117   __m128i __V1 = (V1); \
00118   __m128i __V2 = (V2); \
00119   (__m128i)__builtin_shufflevector((__v8hi)__V1, (__v8hi)__V2, \
00120                                    (((M) & 0x01) ?  8 : 0), \
00121                                    (((M) & 0x02) ?  9 : 1), \
00122                                    (((M) & 0x04) ? 10 : 2), \
00123                                    (((M) & 0x08) ? 11 : 3), \
00124                                    (((M) & 0x10) ? 12 : 4), \
00125                                    (((M) & 0x20) ? 13 : 5), \
00126                                    (((M) & 0x40) ? 14 : 6), \
00127                                    (((M) & 0x80) ? 15 : 7)); })
00128 
00129 /* SSE4 Dword Multiply Instructions.  */
00130 static __inline__  __m128i __attribute__((__always_inline__, __nodebug__))
00131 _mm_mullo_epi32 (__m128i __V1, __m128i __V2)
00132 {
00133   return (__m128i) ((__v4si)__V1 * (__v4si)__V2);
00134 }
00135 
00136 static __inline__  __m128i __attribute__((__always_inline__, __nodebug__))
00137 _mm_mul_epi32 (__m128i __V1, __m128i __V2)
00138 {
00139   return (__m128i) __builtin_ia32_pmuldq128 ((__v4si)__V1, (__v4si)__V2);
00140 }
00141 
00142 /* SSE4 Floating Point Dot Product Instructions.  */
00143 #define _mm_dp_ps(X, Y, M) __extension__ ({ \
00144   __m128 __X = (X); \
00145   __m128 __Y = (Y); \
00146   (__m128) __builtin_ia32_dpps((__v4sf)__X, (__v4sf)__Y, (M)); })
00147 
00148 #define _mm_dp_pd(X, Y, M) __extension__ ({\
00149   __m128d __X = (X); \
00150   __m128d __Y = (Y); \
00151   (__m128d) __builtin_ia32_dppd((__v2df)__X, (__v2df)__Y, (M)); })
00152 
00153 /* SSE4 Streaming Load Hint Instruction.  */
00154 static __inline__  __m128i __attribute__((__always_inline__, __nodebug__))
00155 _mm_stream_load_si128 (__m128i *__V)
00156 {
00157   return (__m128i) __builtin_ia32_movntdqa ((__v2di *) __V);
00158 }
00159 
00160 /* SSE4 Packed Integer Min/Max Instructions.  */
00161 static __inline__  __m128i __attribute__((__always_inline__, __nodebug__))
00162 _mm_min_epi8 (__m128i __V1, __m128i __V2)
00163 {
00164   return (__m128i) __builtin_ia32_pminsb128 ((__v16qi) __V1, (__v16qi) __V2);
00165 }
00166 
00167 static __inline__  __m128i __attribute__((__always_inline__, __nodebug__))
00168 _mm_max_epi8 (__m128i __V1, __m128i __V2)
00169 {
00170   return (__m128i) __builtin_ia32_pmaxsb128 ((__v16qi) __V1, (__v16qi) __V2);
00171 }
00172 
00173 static __inline__  __m128i __attribute__((__always_inline__, __nodebug__))
00174 _mm_min_epu16 (__m128i __V1, __m128i __V2)
00175 {
00176   return (__m128i) __builtin_ia32_pminuw128 ((__v8hi) __V1, (__v8hi) __V2);
00177 }
00178 
00179 static __inline__  __m128i __attribute__((__always_inline__, __nodebug__))
00180 _mm_max_epu16 (__m128i __V1, __m128i __V2)
00181 {
00182   return (__m128i) __builtin_ia32_pmaxuw128 ((__v8hi) __V1, (__v8hi) __V2);
00183 }
00184 
00185 static __inline__  __m128i __attribute__((__always_inline__, __nodebug__))
00186 _mm_min_epi32 (__m128i __V1, __m128i __V2)
00187 {
00188   return (__m128i) __builtin_ia32_pminsd128 ((__v4si) __V1, (__v4si) __V2);
00189 }
00190 
00191 static __inline__  __m128i __attribute__((__always_inline__, __nodebug__))
00192 _mm_max_epi32 (__m128i __V1, __m128i __V2)
00193 {
00194   return (__m128i) __builtin_ia32_pmaxsd128 ((__v4si) __V1, (__v4si) __V2);
00195 }
00196 
00197 static __inline__  __m128i __attribute__((__always_inline__, __nodebug__))
00198 _mm_min_epu32 (__m128i __V1, __m128i __V2)
00199 {
00200   return (__m128i) __builtin_ia32_pminud128((__v4si) __V1, (__v4si) __V2);
00201 }
00202 
00203 static __inline__  __m128i __attribute__((__always_inline__, __nodebug__))
00204 _mm_max_epu32 (__m128i __V1, __m128i __V2)
00205 {
00206   return (__m128i) __builtin_ia32_pmaxud128((__v4si) __V1, (__v4si) __V2);
00207 }
00208 
00209 /* SSE4 Insertion and Extraction from XMM Register Instructions.  */
00210 #define _mm_insert_ps(X, Y, N) __builtin_ia32_insertps128((X), (Y), (N))
00211 #define _mm_extract_ps(X, N) (__extension__                      \
00212                               ({ union { int __i; float __f; } __t;  \
00213                                  __v4sf __a = (__v4sf)(X);       \
00214                                  __t.__f = __a[(N) & 3];                 \
00215                                  __t.__i;}))
00216 
00217 /* Miscellaneous insert and extract macros.  */
00218 /* Extract a single-precision float from X at index N into D.  */
00219 #define _MM_EXTRACT_FLOAT(D, X, N) (__extension__ ({ __v4sf __a = (__v4sf)(X); \
00220                                                     (D) = __a[N]; }))
00221                                                     
00222 /* Or together 2 sets of indexes (X and Y) with the zeroing bits (Z) to create
00223    an index suitable for _mm_insert_ps.  */
00224 #define _MM_MK_INSERTPS_NDX(X, Y, Z) (((X) << 6) | ((Y) << 4) | (Z))
00225                                            
00226 /* Extract a float from X at index N into the first index of the return.  */
00227 #define _MM_PICK_OUT_PS(X, N) _mm_insert_ps (_mm_setzero_ps(), (X),   \
00228                                              _MM_MK_INSERTPS_NDX((N), 0, 0x0e))
00229                                              
00230 /* Insert int into packed integer array at index.  */
00231 #define _mm_insert_epi8(X, I, N) (__extension__ ({ __v16qi __a = (__v16qi)(X); \
00232                                                    __a[(N) & 15] = (I);             \
00233                                                    __a;}))
00234 #define _mm_insert_epi32(X, I, N) (__extension__ ({ __v4si __a = (__v4si)(X); \
00235                                                     __a[(N) & 3] = (I);           \
00236                                                     __a;}))
00237 #ifdef __x86_64__
00238 #define _mm_insert_epi64(X, I, N) (__extension__ ({ __v2di __a = (__v2di)(X); \
00239                                                     __a[(N) & 1] = (I);           \
00240                                                     __a;}))
00241 #endif /* __x86_64__ */
00242 
00243 /* Extract int from packed integer array at index.  This returns the element
00244  * as a zero extended value, so it is unsigned.
00245  */
00246 #define _mm_extract_epi8(X, N) (__extension__ ({ __v16qi __a = (__v16qi)(X); \
00247                                                  (int)(unsigned char) \
00248                                                      __a[(N) & 15];}))
00249 #define _mm_extract_epi32(X, N) (__extension__ ({ __v4si __a = (__v4si)(X); \
00250                                                   __a[(N) & 3];}))
00251 #ifdef __x86_64__
00252 #define _mm_extract_epi64(X, N) (__extension__ ({ __v2di __a = (__v2di)(X); \
00253                                                   __a[(N) & 1];}))
00254 #endif /* __x86_64 */
00255 
00256 /* SSE4 128-bit Packed Integer Comparisons.  */
00257 static __inline__ int __attribute__((__always_inline__, __nodebug__))
00258 _mm_testz_si128(__m128i __M, __m128i __V)
00259 {
00260   return __builtin_ia32_ptestz128((__v2di)__M, (__v2di)__V);
00261 }
00262 
00263 static __inline__ int __attribute__((__always_inline__, __nodebug__))
00264 _mm_testc_si128(__m128i __M, __m128i __V)
00265 {
00266   return __builtin_ia32_ptestc128((__v2di)__M, (__v2di)__V);
00267 }
00268 
00269 static __inline__ int __attribute__((__always_inline__, __nodebug__))
00270 _mm_testnzc_si128(__m128i __M, __m128i __V)
00271 {
00272   return __builtin_ia32_ptestnzc128((__v2di)__M, (__v2di)__V);
00273 }
00274 
00275 #define _mm_test_all_ones(V) _mm_testc_si128((V), _mm_cmpeq_epi32((V), (V)))
00276 #define _mm_test_mix_ones_zeros(M, V) _mm_testnzc_si128((M), (V))
00277 #define _mm_test_all_zeros(M, V) _mm_testz_si128 ((M), (V))
00278 
00279 /* SSE4 64-bit Packed Integer Comparisons.  */
00280 static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
00281 _mm_cmpeq_epi64(__m128i __V1, __m128i __V2)
00282 {
00283   return (__m128i)((__v2di)__V1 == (__v2di)__V2);
00284 }
00285 
00286 /* SSE4 Packed Integer Sign-Extension.  */
00287 static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
00288 _mm_cvtepi8_epi16(__m128i __V)
00289 {
00290   return (__m128i) __builtin_ia32_pmovsxbw128((__v16qi) __V);
00291 }
00292 
00293 static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
00294 _mm_cvtepi8_epi32(__m128i __V)
00295 {
00296   return (__m128i) __builtin_ia32_pmovsxbd128((__v16qi) __V);
00297 }
00298 
00299 static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
00300 _mm_cvtepi8_epi64(__m128i __V)
00301 {
00302   return (__m128i) __builtin_ia32_pmovsxbq128((__v16qi) __V);
00303 }
00304 
00305 static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
00306 _mm_cvtepi16_epi32(__m128i __V)
00307 {
00308   return (__m128i) __builtin_ia32_pmovsxwd128((__v8hi) __V); 
00309 }
00310 
00311 static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
00312 _mm_cvtepi16_epi64(__m128i __V)
00313 {
00314   return (__m128i) __builtin_ia32_pmovsxwq128((__v8hi)__V);
00315 }
00316 
00317 static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
00318 _mm_cvtepi32_epi64(__m128i __V)
00319 {
00320   return (__m128i) __builtin_ia32_pmovsxdq128((__v4si)__V);
00321 }
00322 
00323 /* SSE4 Packed Integer Zero-Extension.  */
00324 static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
00325 _mm_cvtepu8_epi16(__m128i __V)
00326 {
00327   return (__m128i) __builtin_ia32_pmovzxbw128((__v16qi) __V);
00328 }
00329 
00330 static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
00331 _mm_cvtepu8_epi32(__m128i __V)
00332 {
00333   return (__m128i) __builtin_ia32_pmovzxbd128((__v16qi)__V);
00334 }
00335 
00336 static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
00337 _mm_cvtepu8_epi64(__m128i __V)
00338 {
00339   return (__m128i) __builtin_ia32_pmovzxbq128((__v16qi)__V);
00340 }
00341 
00342 static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
00343 _mm_cvtepu16_epi32(__m128i __V)
00344 {
00345   return (__m128i) __builtin_ia32_pmovzxwd128((__v8hi)__V);
00346 }
00347 
00348 static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
00349 _mm_cvtepu16_epi64(__m128i __V)
00350 {
00351   return (__m128i) __builtin_ia32_pmovzxwq128((__v8hi)__V);
00352 }
00353 
00354 static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
00355 _mm_cvtepu32_epi64(__m128i __V)
00356 {
00357   return (__m128i) __builtin_ia32_pmovzxdq128((__v4si)__V);
00358 }
00359 
00360 /* SSE4 Pack with Unsigned Saturation.  */
00361 static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
00362 _mm_packus_epi32(__m128i __V1, __m128i __V2)
00363 {
00364   return (__m128i) __builtin_ia32_packusdw128((__v4si)__V1, (__v4si)__V2);
00365 }
00366 
00367 /* SSE4 Multiple Packed Sums of Absolute Difference.  */
00368 #define _mm_mpsadbw_epu8(X, Y, M) __extension__ ({ \
00369   __m128i __X = (X); \
00370   __m128i __Y = (Y); \
00371   (__m128i) __builtin_ia32_mpsadbw128((__v16qi)__X, (__v16qi)__Y, (M)); })
00372 
00373 static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
00374 _mm_minpos_epu16(__m128i __V)
00375 {
00376   return (__m128i) __builtin_ia32_phminposuw128((__v8hi)__V);
00377 }
00378 
00379 /* These definitions are normally in nmmintrin.h, but gcc puts them in here
00380    so we'll do the same.  */
00381 #ifdef __SSE4_2__
00382 
00383 /* These specify the type of data that we're comparing.  */
00384 #define _SIDD_UBYTE_OPS                 0x00
00385 #define _SIDD_UWORD_OPS                 0x01
00386 #define _SIDD_SBYTE_OPS                 0x02
00387 #define _SIDD_SWORD_OPS                 0x03
00388 
00389 /* These specify the type of comparison operation.  */
00390 #define _SIDD_CMP_EQUAL_ANY             0x00
00391 #define _SIDD_CMP_RANGES                0x04
00392 #define _SIDD_CMP_EQUAL_EACH            0x08
00393 #define _SIDD_CMP_EQUAL_ORDERED         0x0c
00394 
00395 /* These macros specify the polarity of the operation.  */
00396 #define _SIDD_POSITIVE_POLARITY         0x00
00397 #define _SIDD_NEGATIVE_POLARITY         0x10
00398 #define _SIDD_MASKED_POSITIVE_POLARITY  0x20
00399 #define _SIDD_MASKED_NEGATIVE_POLARITY  0x30
00400 
00401 /* These macros are used in _mm_cmpXstri() to specify the return.  */
00402 #define _SIDD_LEAST_SIGNIFICANT         0x00
00403 #define _SIDD_MOST_SIGNIFICANT          0x40
00404 
00405 /* These macros are used in _mm_cmpXstri() to specify the return.  */
00406 #define _SIDD_BIT_MASK                  0x00
00407 #define _SIDD_UNIT_MASK                 0x40
00408 
00409 /* SSE4.2 Packed Comparison Intrinsics.  */
00410 #define _mm_cmpistrm(A, B, M) __builtin_ia32_pcmpistrm128((A), (B), (M))
00411 #define _mm_cmpistri(A, B, M) __builtin_ia32_pcmpistri128((A), (B), (M))
00412 
00413 #define _mm_cmpestrm(A, LA, B, LB, M) \
00414      __builtin_ia32_pcmpestrm128((A), (LA), (B), (LB), (M))
00415 #define _mm_cmpestri(A, LA, B, LB, M) \
00416      __builtin_ia32_pcmpestri128((A), (LA), (B), (LB), (M))
00417      
00418 /* SSE4.2 Packed Comparison Intrinsics and EFlag Reading.  */
00419 #define _mm_cmpistra(A, B, M) \
00420      __builtin_ia32_pcmpistria128((A), (B), (M))
00421 #define _mm_cmpistrc(A, B, M) \
00422      __builtin_ia32_pcmpistric128((A), (B), (M))
00423 #define _mm_cmpistro(A, B, M) \
00424      __builtin_ia32_pcmpistrio128((A), (B), (M))
00425 #define _mm_cmpistrs(A, B, M) \
00426      __builtin_ia32_pcmpistris128((A), (B), (M))
00427 #define _mm_cmpistrz(A, B, M) \
00428      __builtin_ia32_pcmpistriz128((A), (B), (M))
00429 
00430 #define _mm_cmpestra(A, LA, B, LB, M) \
00431      __builtin_ia32_pcmpestria128((A), (LA), (B), (LB), (M))
00432 #define _mm_cmpestrc(A, LA, B, LB, M) \
00433      __builtin_ia32_pcmpestric128((A), (LA), (B), (LB), (M))
00434 #define _mm_cmpestro(A, LA, B, LB, M) \
00435      __builtin_ia32_pcmpestrio128((A), (LA), (B), (LB), (M))
00436 #define _mm_cmpestrs(A, LA, B, LB, M) \
00437      __builtin_ia32_pcmpestris128((A), (LA), (B), (LB), (M))
00438 #define _mm_cmpestrz(A, LA, B, LB, M) \
00439      __builtin_ia32_pcmpestriz128((A), (LA), (B), (LB), (M))
00440 
00441 /* SSE4.2 Compare Packed Data -- Greater Than.  */
00442 static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
00443 _mm_cmpgt_epi64(__m128i __V1, __m128i __V2)
00444 {
00445   return (__m128i)((__v2di)__V1 > (__v2di)__V2);
00446 }
00447 
00448 /* SSE4.2 Accumulate CRC32.  */
00449 static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
00450 _mm_crc32_u8(unsigned int __C, unsigned char __D)
00451 {
00452   return __builtin_ia32_crc32qi(__C, __D);
00453 }
00454 
00455 static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
00456 _mm_crc32_u16(unsigned int __C, unsigned short __D)
00457 {
00458   return __builtin_ia32_crc32hi(__C, __D);
00459 }
00460 
00461 static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
00462 _mm_crc32_u32(unsigned int __C, unsigned int __D)
00463 {
00464   return __builtin_ia32_crc32si(__C, __D);
00465 }
00466 
00467 #ifdef __x86_64__
00468 static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__))
00469 _mm_crc32_u64(unsigned long long __C, unsigned long long __D)
00470 {
00471   return __builtin_ia32_crc32di(__C, __D);
00472 }
00473 #endif /* __x86_64__ */
00474 
00475 #ifdef __POPCNT__
00476 #include <popcntintrin.h>
00477 #endif
00478 
00479 #endif /* __SSE4_2__ */
00480 #endif /* __SSE4_1__ */
00481 
00482 #endif /* _SMMINTRIN_H */