00001
00002
00003
00004
00005 #ifndef __SSEPLUS_NATIVE_SSE4_2_H__
00006 #define __SSEPLUS_NATIVE_SSE4_2_H__
00007
00008 #include "../SSEPlus_base.h"
00009 #include <nmmintrin.h>
00010
00017 SSP_FORCEINLINE int ssp_cmpestra_SSE4_2 ( __m128i a, int la, __m128i b, int lb, const int mode )
00018 {
00019 switch( mode & 0xFF )
00020 {
00021 CASE_256( _mm_cmpestra, a, la, b, lb );
00022 }
00023 }
00025 SSP_FORCEINLINE int ssp_cmpestrc_SSE4_2 ( __m128i a, int la, __m128i b, int lb, const int mode )
00026 {
00027 switch( mode & 0xFF )
00028 {
00029 CASE_256( _mm_cmpestrc, a, la, b, lb );
00030 }
00031 }
00033 SSP_FORCEINLINE int ssp_cmpestri_SSE4_2 ( __m128i a, int la, __m128i b, int lb, const int mode )
00034 {
00035 switch( mode & 0xFF )
00036 {
00037 CASE_256( _mm_cmpestri, a, la, b, lb );
00038 }
00039 }
00040 SSP_FORCEINLINE __m128i ssp_cmpestrm_SSE4_2 ( __m128i a, int la, __m128i b, int lb, const int mode )
00041 {
00042 switch( mode & 0xFF )
00043 {
00044 CASE_256( _mm_cmpestrm, a, la, b, lb );
00045 }
00046 }
00048 SSP_FORCEINLINE int ssp_cmpestro_SSE4_2 ( __m128i a, int la, __m128i b, int lb, const int mode )
00049 {
00050 switch( mode & 0xFF )
00051 {
00052 CASE_256( _mm_cmpestro, a, la, b, lb );
00053 }
00054 }
00056 SSP_FORCEINLINE int ssp_cmpestrs_SSE4_2 ( __m128i a, int la, __m128i b, int lb, const int mode )
00057 {
00058 switch( mode & 0xFF)
00059 {
00060 CASE_256( _mm_cmpestrs, a, la, b, lb );
00061 }
00062 }
00064 SSP_FORCEINLINE int ssp_cmpestrz_SSE4_2 ( __m128i a, int la, __m128i b, int lb, const int mode )
00065 {
00066 switch( mode & 0xFF)
00067 {
00068 CASE_256( _mm_cmpestrz, a, la, b, lb );
00069 }
00070 }
00071 SSP_FORCEINLINE __m128i ssp_cmpgt_epi64_SSE4_2 ( __m128i a, __m128i b )
00072 {
00073 return _mm_cmpgt_epi64 ( a, b );
00074 }
00076 SSP_FORCEINLINE int ssp_cmpistra_SSE4_2 ( __m128i a, __m128i b, const int mode )
00077 {
00078 switch( mode & 0xFF)
00079 {
00080 CASE_256( _mm_cmpistra, a, b );
00081 }
00082 }
00084 SSP_FORCEINLINE int ssp_cmpistrc_SSE4_2 ( __m128i a, __m128i b, const int mode )
00085 {
00086 switch( mode & 0xFF)
00087 {
00088 CASE_256( _mm_cmpistrc, a, b );
00089 }
00090 }
00092 SSP_FORCEINLINE int ssp_cmpistri_SSE4_2 ( __m128i a, __m128i b, const int mode )
00093 {
00094 switch( mode & 0xFF)
00095 {
00096 CASE_256( _mm_cmpistri, a, b );
00097 }
00098 }
00099 SSP_FORCEINLINE __m128i ssp_cmpistrm_SSE4_2 ( __m128i a, __m128i b, const int mode )
00100 {
00101 switch( mode & 0xFF)
00102 {
00103 CASE_256( _mm_cmpistrm , a, b );
00104 }
00105 }
00107 SSP_FORCEINLINE int ssp_cmpistro_SSE4_2 ( __m128i a, __m128i b, const int mode )
00108 {
00109 switch( mode & 0xFF)
00110 {
00111 CASE_256( _mm_cmpistro, a, b );
00112 }
00113 }
00115 SSP_FORCEINLINE int ssp_cmpistrs_SSE4_2 ( __m128i a, __m128i b, const int mode )
00116 {
00117 switch( mode & 0xFF)
00118 {
00119 CASE_256( _mm_cmpistrs, a, b );
00120 }
00121 }
00123 SSP_FORCEINLINE int ssp_cmpistrz_SSE4_2 ( __m128i a, __m128i b, const int mode )
00124 {
00125 switch( mode & 0xFF)
00126 {
00127 CASE_256( _mm_cmpistrz, a, b );
00128 }
00129 }
00130
00132 SSP_FORCEINLINE unsigned int ssp_crc32_u16_SSE4_2 ( unsigned int crc, unsigned short v )
00133 {
00134 return _mm_crc32_u16( crc, v );
00135 }
00136
00138 SSP_FORCEINLINE unsigned int ssp_crc32_u32_SSE4_2 ( unsigned int crc, unsigned int v )
00139 {
00140 return _mm_crc32_u32( crc, v );
00141 }
00142
00143 #ifdef SYS64
00144
00145 SSP_FORCEINLINE ssp_u64 ssp_crc32_u64_SSE4_2 ( unsigned int crc, ssp_u64 v )
00146 {
00147 return _mm_crc32_u64( crc, v );
00148 }
00149 #endif
00150
00152 SSP_FORCEINLINE unsigned int ssp_crc32_u8_SSE4_2 ( unsigned int crc, unsigned char v )
00153 {
00154 return _mm_crc32_u8( crc, v );
00155 }
00157 SSP_FORCEINLINE int ssp_popcnt_u32_SSE4_2 ( unsigned int a )
00158 {
00159 return _mm_popcnt_u32( a );
00160 }
00161 #ifdef SYS64
00162
00163 SSP_FORCEINLINE int ssp_popcnt_u64_SSE4_2 ( ssp_u64 a )
00164 {
00165 return _mm_popcnt_u64( a );
00166 }
00167 #endif
00168
00173 #endif // __SSEPLUS_NATIVE_SSE4_2_H__