51 #ifndef __EMU_M256_AVXIMMINTRIN_EMU_H__
52 #define __EMU_M256_AVXIMMINTRIN_EMU_H__
57 #include <xmmintrin.h>
61 #include <emmintrin.h>
65 #include <pmmintrin.h>
69 #include <tmmintrin.h>
72 #if defined (__SSE4_2__) || defined (__SSE4_1__)
73 #include <smmintrin.h>
76 #if defined (__AES__) || defined (__PCLMUL__)
77 #include <wmmintrin.h>
82 #include <wmmintrin.h>
86 #pragma message (" --- Intel remark: AVX intrinsics are emulated with SSE ---")
100 #if defined( _MSC_VER ) || defined( __INTEL_COMPILER )
101 #define __EMU_M256_ALIGN( a ) __declspec(align(a))
102 #define __emu_inline __forceinline
103 #define __emu_int64_t __int64
104 #elif defined( __GNUC__ )
105 #define __EMU_M256_ALIGN( a ) __attribute__((__aligned__(a)))
106 #define __emu_inline __inline __attribute__((__always_inline__))
107 #define __emu_int64_t long long
109 #error "unsupported platform"
115 __m128 __emu_m128[2];
121 __m128d __emu_m128[2];
127 __m128i __emu_m128[2];
135 #define __EMU_M256_IMPL_M1( type, func ) \
136 static __emu_inline __emu##type __emu_mm256_##func( __emu##type m256_param1 ) \
138 res.__emu_m128[0] = _mm_##func( m256_param1.__emu_m128[0] ); \
139 res.__emu_m128[1] = _mm_##func( m256_param1.__emu_m128[1] ); \
143 #define __EMU_M256_IMPL_M1_RET( ret_type, type, func ) \
144 static __emu_inline __emu##ret_type __emu_mm256_##func( __emu##type m256_param1 ) \
145 { __emu##ret_type res; \
146 res.__emu_m128[0] = _mm_##func( m256_param1.__emu_m128[0] ); \
147 res.__emu_m128[1] = _mm_##func( m256_param1.__emu_m128[1] ); \
151 #define __EMU_M256_IMPL_M1_RET_NAME( ret_type, type, func, name ) \
152 static __emu_inline __emu##ret_type __emu_mm256_##name( __emu##type m256_param1 ) \
153 { __emu##ret_type res; \
154 res.__emu_m128[0] = _mm_##func( m256_param1.__emu_m128[0] ); \
155 res.__emu_m128[1] = _mm_##func( m256_param1.__emu_m128[1] ); \
159 #define __EMU_M256_IMPL_M1_LH( type, type_128, func ) \
160 static __emu_inline __emu##type __emu_mm256_##func( type_128 m128_param ) \
162 res.__emu_m128[0] = _mm_##func( m128_param ); \
163 __m128 m128_param_high = _mm_movehl_ps( *(__m128*)&m128_param, *(__m128*)&m128_param ); \
164 res.__emu_m128[1] = _mm_##func( *(type_128*)&m128_param_high ); \
168 #define __EMU_M256_IMPL_M1_HL( type_128, type, func ) \
169 static __emu_inline type_128 __emu_mm256_##func( __emu##type m256_param1 ) \
170 { type_128 res, tmp; \
171 res = _mm_##func( m256_param1.__emu_m128[0] ); \
172 tmp = _mm_##func( m256_param1.__emu_m128[1] ); \
173 *(((__emu_int64_t*)&res)+1) = *(__emu_int64_t*)&tmp; \
177 #define __EMU_M256_IMPL_M1P_DUP( type, type_param, func ) \
178 static __emu_inline __emu##type __emu_mm256_##func( type_param param ) \
180 res.__emu_m128[0] = _mm_##func( param ); \
181 res.__emu_m128[1] = _mm_##func( param ); \
185 #define __EMU_M256_IMPL_M1I_DUP( type, func ) \
186 static __emu_inline __emu##type __emu_mm256_##func( __emu##type m256_param1, const int param2 ) \
188 res.__emu_m128[0] = _mm_##func( m256_param1.__emu_m128[0], param2 ); \
189 res.__emu_m128[1] = _mm_##func( m256_param1.__emu_m128[1], param2 ); \
193 #define __EMU_M256_IMPL2_M1I_DUP( type, func ) \
194 static __emu_inline __emu##type __emu_mm256_##func( __emu##type m256_param1, const int param2 ) \
196 res.__emu_m128[0] = __emu_mm_##func( m256_param1.__emu_m128[0], param2 ); \
197 res.__emu_m128[1] = __emu_mm_##func( m256_param1.__emu_m128[1], param2 ); \
201 #define __EMU_M256_IMPL2_M1I_SHIFT( type, func, shift_for_hi ) \
202 static __emu_inline __emu##type __emu_mm256_##func( __emu##type m256_param1, const int param2 ) \
204 res.__emu_m128[0] = __emu_mm_##func( m256_param1.__emu_m128[0], param2 & ((1<<shift_for_hi)-1) ); \
205 res.__emu_m128[1] = __emu_mm_##func( m256_param1.__emu_m128[1], param2 >> shift_for_hi); \
209 #define __EMU_M256_IMPL_M2( type, func ) \
210 static __emu_inline __emu##type __emu_mm256_##func( __emu##type m256_param1, __emu##type m256_param2 ) \
212 res.__emu_m128[0] = _mm_##func( m256_param1.__emu_m128[0], m256_param2.__emu_m128[0] ); \
213 res.__emu_m128[1] = _mm_##func( m256_param1.__emu_m128[1], m256_param2.__emu_m128[1] ); \
217 #define __EMU_M256_IMPL2_M2T( type, type_2, func ) \
218 static __emu_inline __emu##type __emu_mm256_##func( __emu##type m256_param1, __emu##type_2 m256_param2 ) \
220 res.__emu_m128[0] = __emu_mm_##func( m256_param1.__emu_m128[0], m256_param2.__emu_m128[0] ); \
221 res.__emu_m128[1] = __emu_mm_##func( m256_param1.__emu_m128[1], m256_param2.__emu_m128[1] ); \
225 #define __EMU_M256_IMPL_M2I_DUP( type, func ) \
226 static __emu_inline __emu##type __emu_mm256_##func( __emu##type m256_param1, __emu##type m256_param2, const int param3 ) \
228 res.__emu_m128[0] = _mm_##func( m256_param1.__emu_m128[0], m256_param2.__emu_m128[0], param3 ); \
229 res.__emu_m128[1] = _mm_##func( m256_param1.__emu_m128[1], m256_param2.__emu_m128[1], param3 ); \
233 #define __EMU_M256_IMPL2_M2I_DUP( type, func ) \
234 static __emu_inline __emu##type __emu_mm256_##func( __emu##type m256_param1, __emu##type m256_param2, const int param3 ) \
236 res.__emu_m128[0] = __emu_mm_##func( m256_param1.__emu_m128[0], m256_param2.__emu_m128[0], param3 ); \
237 res.__emu_m128[1] = __emu_mm_##func( m256_param1.__emu_m128[1], m256_param2.__emu_m128[1], param3 ); \
241 #define __EMU_M256_IMPL_M2I_SHIFT( type, func, shift_for_hi ) \
242 static __emu_inline __emu##type __emu_mm256_##func( __emu##type m256_param1, __emu##type m256_param2, const int param3 ) \
244 res.__emu_m128[0] = _mm_##func( m256_param1.__emu_m128[0], m256_param2.__emu_m128[0], param3 & ((1<<shift_for_hi)-1) ); \
245 res.__emu_m128[1] = _mm_##func( m256_param1.__emu_m128[1], m256_param2.__emu_m128[1], param3 >> shift_for_hi ); \
249 #define __EMU_M256_IMPL_M3( type, func ) \
250 static __emu_inline __emu##type __emu_mm256_##func( __emu##type m256_param1, __emu##type m256_param2, __emu##type m256_param3 ) \
252 res.__emu_m128[0] = _mm_##func( m256_param1.__emu_m128[0], m256_param2.__emu_m128[0], m256_param3.__emu_m128[0] ); \
253 res.__emu_m128[1] = _mm_##func( m256_param1.__emu_m128[1], m256_param2.__emu_m128[1], m256_param3.__emu_m128[1] ); \
261 #define _CMP_EQ_OQ 0x00
262 #define _CMP_LT_OS 0x01
263 #define _CMP_LE_OS 0x02
264 #define _CMP_UNORD_Q 0x03
265 #define _CMP_NEQ_UQ 0x04
266 #define _CMP_NLT_US 0x05
267 #define _CMP_NLE_US 0x06
268 #define _CMP_ORD_Q 0x07
270 #define _CMP_EQ_UQ 0x08
271 #define _CMP_NGE_US 0x09
272 #define _CMP_NGT_US 0x0A
273 #define _CMP_FALSE_OQ 0x0B
274 #define _CMP_NEQ_OQ 0x0C
275 #define _CMP_GE_OS 0x0D
276 #define _CMP_GT_OS 0x0E
277 #define _CMP_TRUE_UQ 0x0F
278 #define _CMP_EQ_OS 0x10
279 #define _CMP_LT_OQ 0x11
280 #define _CMP_LE_OQ 0x12
281 #define _CMP_UNORD_S 0x13
282 #define _CMP_NEQ_US 0x14
283 #define _CMP_NLT_UQ 0x15
284 #define _CMP_NLE_UQ 0x16
285 #define _CMP_ORD_S 0x17
286 #define _CMP_EQ_US 0x18
287 #define _CMP_NGE_UQ 0x19
288 #define _CMP_NGT_UQ 0x1A
289 #define _CMP_FALSE_OS 0x1B
290 #define _CMP_NEQ_OS 0x1C
291 #define _CMP_GE_OQ 0x1D
292 #define _CMP_GT_OQ 0x1E
293 #define _CMP_TRUE_US 0x1F
337 #if defined (__SSE4_2__) || defined (__SSE4_1__)
348 #define _mm256_ceil_pd(val) _mm256_round_pd((val), 0x0A);
349 #define _mm256_floor_pd(val) _mm256_round_pd((val), 0x09);
352 #define _mm256_ceil_ps(val) _mm256_round_ps((val), 0x0A);
353 #define _mm256_floor_ps(val) _mm256_round_ps((val), 0x09);
355 #define __emu_mm_test_impl( op, sfx, vec_type ) \
356 static __emu_inline int __emu_mm_test##op##_##sfx(vec_type s1, vec_type s2) { \
357 __m128d sign_bits_pd = _mm_castsi128_pd( _mm_set_epi32( 1 << 31, 0, 1 << 31, 0 ) ); \
358 __m128 sign_bits_ps = _mm_castsi128_ps( _mm_set1_epi32( 1 << 31 ) ); \
360 s1 = _mm_and_##sfx( s1, sign_bits_##sfx ); \
361 s2 = _mm_and_##sfx( s2, sign_bits_##sfx ); \
362 return _mm_test##op##_si128( _mm_cast##sfx##_si128( s1 ), _mm_cast##sfx##_si128( s2 ) ); \
365 __emu_mm_test_impl( z, pd, __m128d );
366 __emu_mm_test_impl( c, pd, __m128d );
367 __emu_mm_test_impl( nzc, pd, __m128d );
369 __emu_mm_test_impl( z, ps, __m128 );
370 __emu_mm_test_impl( c, ps, __m128 );
371 __emu_mm_test_impl( nzc, ps, __m128 );
375 #define __emu_mm256_test_impl( prfx, op, sfx, sfx_impl, vec_type ) \
376 static __emu_inline int __emu_mm256_test##op##_##sfx(vec_type s1, vec_type s2) { \
377 int ret1 = prfx##_test##op##_##sfx_impl( s1.__emu_m128[0], s2.__emu_m128[0] ); \
378 int ret2 = prfx##_test##op##_##sfx_impl( s1.__emu_m128[1], s2.__emu_m128[1] ); \
379 return ( ret1 && ret2 ); \
382 __emu_mm256_test_impl( _mm, z, si256, si128,
__emu__m256i );
383 __emu_mm256_test_impl( _mm, c, si256, si128,
__emu__m256i );
384 __emu_mm256_test_impl( _mm, nzc, si256, si128,
__emu__m256i );
386 __emu_mm256_test_impl( __emu_mm, z, pd, pd,
__emu__m256d );
387 __emu_mm256_test_impl( __emu_mm, c, pd, pd,
__emu__m256d );
388 __emu_mm256_test_impl( __emu_mm, nzc, pd, pd,
__emu__m256d );
390 __emu_mm256_test_impl( __emu_mm, z, ps, ps,
__emu__m256 );
391 __emu_mm256_test_impl( __emu_mm, c, ps, ps,
__emu__m256 );
392 __emu_mm256_test_impl( __emu_mm, nzc, ps, ps,
__emu__m256 );
396 #if defined( __GNUC__ ) && ( __GNUC__ == 4 ) && (__GNUC_MINOR__ < 4 )
399 #pragma message ("Using macro for GCC <4.4" )
401 #define __emu_mm_cmp_ps(m1, m2, predicate) \
403 __m128 res_ = (m1), m2_ = (m2); \
404 if ( 7 < (unsigned)predicate ) __asm__ __volatile__ ( "ud2" : : : "memory" ); \
405 __asm__ ( "cmpps %[pred_], %[m2_], %[res_]" : [res_] "+x" (res_) : [m2_] "xm" (m2_), [pred_] "i" (predicate) ); \
408 #define __emu_mm256_cmp_ps(m1, m2, predicate) \
410 __emu__m256 res_ = (m1), m2_ = (m2); \
411 if ( 7 < (unsigned)predicate ) __asm__ __volatile__ ( "ud2" : : : "memory" ); \
412 __asm__ ( "cmpps %[pred_], %[m2_], %[res_]" : [res_] "+x" (res_.__emu_m128[0]) : [m2_] "xm" (m2_.__emu_m128[0]), [pred_] "i" (predicate) ); \
413 __asm__ ( "cmpps %[pred_], %[m2_], %[res_]" : [res_] "+x" (res_.__emu_m128[1]) : [m2_] "xm" (m2_.__emu_m128[1]), [pred_] "i" (predicate) ); \
417 #define __emu_mm_cmp_pd(m1, m2, predicate) \
419 __m128 res_ = (m1), m2_ = (m2); \
420 if ( 7 < (unsigned)predicate ) __asm__ __volatile__ ( "ud2" : : : "memory" ); \
421 __asm__ ( "cmppd %[pred_], %[m2_], %[res_]" : [res_] "+x" (res_) : [m2_] "xm" (m2_), [pred_] "i" (predicate) ); \
424 #define __emu_mm256_cmp_pd(m1, m2, predicate) \
426 __emu__m256 res_ = (m1), m2_ = (m2); \
427 if ( 7 < (unsigned)predicate ) __asm__ __volatile__ ( "ud2" : : : "memory" ); \
428 __asm__ ( "cmppd %[pred_], %[m2_], %[res_]" : [res_] "+x" (res_.__emu_m128[0]) : [m2_] "xm" (m2_.__emu_m128[0]), [pred_] "i" (predicate) ); \
429 __asm__ ( "cmppd %[pred_], %[m2_], %[res_]" : [res_] "+x" (res_.__emu_m128[1]) : [m2_] "xm" (m2_.__emu_m128[1]), [pred_] "i" (predicate) ); \
433 #define __emu_mm_cmp_ss(m1, m2, predicate) \
435 __m128 res_ = (m1), m2_ = (m2); \
436 if ( 7 < (unsigned)predicate ) __asm__ __volatile__ ( "ud2" : : : "memory" ); \
437 __asm__ ( "cmpss %[pred_], %[m2_], %[res_]" : [res_] "+x" (res_) : [m2_] "xm" (m2_), [pred_] "i" (predicate) ); \
440 #define __emu_mm_cmp_sd(m1, m2, predicate) \
442 __m128 res_ = (m1), m2_ = (m2); \
443 if ( 7 < (unsigned)predicate ) __asm__ __volatile__ ( "ud2" : : : "memory" ); \
444 __asm__ ( "cmpsd %[pred_], %[m2_], %[res_]" : [res_] "+x" (res_) : [m2_] "xm" (m2_), [pred_] "i" (predicate) ); \
456 if ( predicate >= 0 && predicate <= 7 ) {
458 __asm__ (
"cmpps %[pred_], %[m2_], %[res_]" : [res_]
"+x" (res) : [m2_]
"xm" (m2), [pred_]
"i" (predicate) );
460 __asm__ __volatile__ (
"ud2" : : :
"memory" );
467 static __emu_inline __m128d
__emu_mm_cmp_pd(__m128d m1, __m128d m2, const
int predicate)
471 if ( predicate >= 0 && predicate <= 7 ) {
473 __asm__ (
"cmppd %[pred_], %[m2_], %[res_]" : [res_]
"+x" (res) : [m2_]
"xm" (m2), [pred_]
"i" (predicate) );
475 __asm__ __volatile__ (
"ud2" : : :
"memory" );
483 static __emu_inline __m128d
__emu_mm_cmp_sd(__m128d m1, __m128d m2, const
int predicate)
487 if ( predicate >= 0 && predicate <= 7 ) {
489 __asm__ (
"cmpsd %[pred_], %[m2_], %[res_]" : [res_]
"+x" (res) : [m2_]
"xm" (m2), [pred_]
"i" (predicate) );
491 __asm__ __volatile__ (
"ud2" : : :
"memory" );
501 if ( predicate >= 0 && predicate <= 7 ) {
503 __asm__ (
"cmpss %[pred_], %[m2_], %[res_]" : [res_]
"+x" (res) : [m2_]
"xm" (m2), [pred_]
"i" (predicate) );
505 __asm__ __volatile__ (
"ud2" : : :
"memory" );
532 int const* sel = (
int const*)&control;
533 float const* src = (
float const*)&a;
538 dest[i] = src[ 3 & sel[i] ];
540 return ( *(__m128*)dest );
544 static __emu_inline __m128
__emu_mm_permute_ps(__m128 a,
int control) {
return _mm_castsi128_ps( _mm_shuffle_epi32( *(__m128i*)&a, control ) ); }
550 __emu_int64_t
const* sel = (__emu_int64_t
const*)&control;
551 double const* src = (
double const*)&a;
556 dest[i] = src[ (2 & sel[i]) >> 1 ];
558 return ( *(__m128d*)dest );
564 double const* src = (
double const*)&a;
569 dest[i] = src[ 1 & (control >> i) ];
571 return ( *(__m128d*)dest );
576 #define __emu_mm256_permute2f128_impl( name, m128_type, m256_type ) \
577 static __emu_inline m256_type name( m256_type m1, m256_type m2, int control) { \
579 __m128 zero = _mm_setzero_ps(); \
580 const m128_type param[4] = { m1.__emu_m128[0], m1.__emu_m128[1], m2.__emu_m128[0], m2.__emu_m128[1] }; \
581 res.__emu_m128[0] = (control & 8) ? *(m128_type*)&zero : param[ control & 0x3 ]; control >>= 4; \
582 res.__emu_m128[1] = (control & 8) ? *(m128_type*)&zero : param[ control & 0x3 ]; \
591 #define __emu_mm_broadcast_impl( name, res_type, type ) \
592 static __emu_inline res_type name(type const *a) { \
593 const size_t size = sizeof( res_type ) / sizeof( type );\
594 __EMU_M256_ALIGN(32) type res[ size ]; \
596 for ( ; i < size; ++i ) \
598 return (*(res_type*)&res); \
611 static __emu_inline __emu__m256
__emu_mm256_insertf128_ps(__emu__m256 a, __m128 b,
int offset) { a.__emu_m128[ offset ] = b;
return a; }
616 #define __emu_mm_load_impl( name, sfx, m256_sfx, m256_type, type_128, type ) \
617 static __emu_inline __emu##m256_type __emu_mm256_##name##_##m256_sfx(const type* a) { \
618 __emu##m256_type res; \
619 res.__emu_m128[0] = _mm_##name##_##sfx( (const type_128 *)a ); \
620 res.__emu_m128[1] = _mm_##name##_##sfx( (const type_128 *)(1+(const __m128 *)a) ); \
624 #define __emu_mm_store_impl( name, sfx, m256_sfx, m256_type, type_128, type ) \
625 static __emu_inline void __emu_mm256_##name##_##m256_sfx(type *a, __emu##m256_type b) { \
626 _mm_##name##_##sfx( (type_128*)a, b.__emu_m128[0] ); \
627 _mm_##name##_##sfx( (type_128*)(1+(__m128*)a), b.__emu_m128[1] ); \
649 #define __emu_maskload_impl( name, vec_type, mask_vec_type, type, mask_type ) \
650 static __emu_inline vec_type name(type const *a, mask_vec_type mask) { \
651 const size_t size_type = sizeof( type ); \
652 const size_t size = sizeof( vec_type ) / size_type; \
653 __EMU_M256_ALIGN(32) type res[ size ]; \
654 const mask_type* p_mask = (const mask_type*)&mask; \
656 mask_type sign_bit = 1; \
657 sign_bit <<= (8*size_type - 1); \
658 for ( ; i < size; ++i ) \
659 res[ i ] = (sign_bit & *(p_mask + i)) ? *(a+i) : 0; \
660 return (*(vec_type*)&res); \
663 #define __emu_maskstore_impl( name, vec_type, mask_vec_type, type, mask_type ) \
664 static __emu_inline void name(type *a, mask_vec_type mask, vec_type data) { \
665 const size_t size_type = sizeof( type ); \
666 const size_t size = sizeof( vec_type ) / sizeof( type ); \
667 type* p_data = (type*)&data; \
668 const mask_type* p_mask = (const mask_type*)&mask; \
670 mask_type sign_bit = 1; \
671 sign_bit <<= (8*size_type - 1); \
672 for ( ; i < size; ++i ) \
673 if ( *(p_mask + i ) & sign_bit) \
674 *(a + i) = *(p_data + i); \
716 (_mm_movemask_pd( a.__emu_m128[1] ) << 2) |
717 _mm_movemask_pd( a.__emu_m128[0] );
723 (_mm_movemask_ps( a.__emu_m128[1] ) << 4) |
724 _mm_movemask_ps( a.__emu_m128[0] );
732 { __m128d
ret[2] = { _mm_set_pd( a3, a4 ), _mm_set_pd( a1, a2 ) };
return __emu_set_m128d( ret ); }
735 { __m128
ret[2] = { _mm_set_ps( a5, a6, a7, a8 ), _mm_set_ps( a1, a2, a3, a4 ) };
return __emu_set_m128( ret ); }
738 char a9,
char a10,
char a11,
char a12,
char a13,
char a14,
char a15,
char a16,
739 char a17,
char a18,
char a19,
char a20,
char a21,
char a22,
char a23,
char a24,
740 char a25,
char a26,
char a27,
char a28,
char a29,
char a30,
char a31,
char a32)
741 { __m128i
ret[2] = { _mm_set_epi8( a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27, a28, a29, a30, a31, a32 ),
742 _mm_set_epi8( a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16 ) };
747 short a9,
short a10,
short a11,
short a12,
short a13,
short a14,
short a15,
short a16)
748 { __m128i
ret[2] = { _mm_set_epi16( a9, a10, a11, a12, a13, a14, a15, a16 ),
749 _mm_set_epi16( a1, a2, a3, a4, a5, a6, a7, a8 ) };
754 { __m128i
ret[2] = { _mm_set_epi32( a5, a6, a7, a8 ), _mm_set_epi32( a1, a2, a3, a4 ) };
return __emu_set_m128i( ret ); }
756 static __emu_inline __m128i
__emu_mm_set_epi64x( __emu_int64_t a, __emu_int64_t b ) {
return _mm_set_epi64( *(__m64*)&a, *(__m64*)&b ); }
763 { __m128d
ret[2] = { _mm_setr_pd( a1, a2 ), _mm_setr_pd( a3, a4 ) };
return __emu_set_m128d( ret ); }
766 { __m128
ret[2] = { _mm_setr_ps( a1, a2, a3, a4 ), _mm_setr_ps( a5, a6, a7, a8 ) };
return __emu_set_m128( ret ); }
769 char a9,
char a10,
char a11,
char a12,
char a13,
char a14,
char a15,
char a16,
770 char a17,
char a18,
char a19,
char a20,
char a21,
char a22,
char a23,
char a24,
771 char a25,
char a26,
char a27,
char a28,
char a29,
char a30,
char a31,
char a32)
772 { __m128i
ret[2] = { _mm_setr_epi8( a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16 ),
773 _mm_setr_epi8( a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27, a28, a29, a30, a31, a32 ) };
778 short a9,
short a10,
short a11,
short a12,
short a13,
short a14,
short a15,
short a16)
779 { __m128i
ret[2] = { _mm_setr_epi16( a1, a2, a3, a4, a5, a6, a7, a8 ),
780 _mm_setr_epi16( a9, a10, a11, a12, a13, a14, a15, a16 ) };
return __emu_set_m128i( ret );
784 { __m128i
ret[2] = { _mm_setr_epi32( a1, a2, a3, a4 ), _mm_setr_epi32( a5, a6, a7, a8 ), };
return __emu_set_m128i( ret ); }
799 __emu_int64_t res[4] = { a, a, a, a };
826 #if defined __cplusplus
835 #ifndef __EMU_M256_NOMAP
837 #define __m256 __emu__m256
838 #define __m256i __emu__m256i
839 #define __m256d __emu__m256d
841 #define _mm256_add_pd __emu_mm256_add_pd
842 #define _mm256_add_ps __emu_mm256_add_ps
844 #define _mm256_addsub_pd __emu_mm256_addsub_pd
845 #define _mm256_addsub_ps __emu_mm256_addsub_ps
847 #define _mm256_and_pd __emu_mm256_and_pd
848 #define _mm256_and_ps __emu_mm256_and_ps
850 #define _mm256_andnot_pd __emu_mm256_andnot_pd
851 #define _mm256_andnot_ps __emu_mm256_andnot_ps
853 #define _mm256_blend_pd __emu_mm256_blend_pd
854 #define _mm256_blend_ps __emu_mm256_blend_ps
856 #define _mm256_blendv_pd __emu_mm256_blendv_pd
857 #define _mm256_blendv_ps __emu_mm256_blendv_ps
859 #define _mm256_div_pd __emu_mm256_div_pd
860 #define _mm256_div_ps __emu_mm256_div_ps
862 #define _mm256_dp_ps __emu_mm256_dp_ps
864 #define _mm256_hadd_pd __emu_mm256_hadd_pd
865 #define _mm256_hadd_ps __emu_mm256_hadd_ps
867 #define _mm256_hsub_pd __emu_mm256_hsub_pd
868 #define _mm256_hsub_ps __emu_mm256_hsub_ps
870 #define _mm256_max_pd __emu_mm256_max_pd
871 #define _mm256_max_ps __emu_mm256_max_ps
873 #define _mm256_min_pd __emu_mm256_min_pd
874 #define _mm256_min_ps __emu_mm256_min_ps
876 #define _mm256_mul_pd __emu_mm256_mul_pd
877 #define _mm256_mul_ps __emu_mm256_mul_ps
879 #define _mm256_or_pd __emu_mm256_or_pd
880 #define _mm256_or_ps __emu_mm256_or_ps
882 #define _mm256_shuffle_pd __emu_mm256_shuffle_pd
883 #define _mm256_shuffle_ps __emu_mm256_shuffle_ps
885 #define _mm256_sub_pd __emu_mm256_sub_pd
886 #define _mm256_sub_ps __emu_mm256_sub_ps
888 #define _mm256_xor_pd __emu_mm256_xor_pd
889 #define _mm256_xor_ps __emu_mm256_xor_ps
892 #define _mm_cmp_pd __emu_mm_cmp_pd
893 #define _mm256_cmp_pd __emu_mm256_cmp_pd
895 #define _mm_cmp_ps __emu_mm_cmp_ps
896 #define _mm256_cmp_ps __emu_mm256_cmp_ps
898 #define _mm_cmp_sd __emu_mm_cmp_sd
899 #define _mm_cmp_ss __emu_mm_cmp_ss
901 #define _mm256_cvtepi32_pd __emu_mm256_cvtepi32_pd
902 #define _mm256_cvtepi32_ps __emu_mm256_cvtepi32_ps
904 #define _mm256_cvtpd_ps __emu_mm256_cvtpd_ps
905 #define _mm256_cvtps_epi32 __emu_mm256_cvtps_epi32
906 #define _mm256_cvtps_pd __emu_mm256_cvtps_pd
908 #define _mm256_cvttpd_epi32 __emu_mm256_cvttpd_epi32
909 #define _mm256_cvtpd_epi32 __emu_mm256_cvtpd_epi32
910 #define _mm256_cvttps_epi32 __emu_mm256_cvttps_epi32
912 #define _mm256_extractf128_ps __emu_mm256_extractf128_ps
913 #define _mm256_extractf128_pd __emu_mm256_extractf128_pd
914 #define _mm256_extractf128_si256 __emu_mm256_extractf128_si256
916 #define _mm256_zeroall __emu_mm256_zeroall
917 #define _mm256_zeroupper __emu_mm256_zeroupper
919 #define _mm256_permutevar_ps __emu_mm256_permutevar_ps
920 #define _mm_permutevar_ps __emu_mm_permutevar_ps
922 #define _mm256_permute_ps __emu_mm256_permute_ps
923 #define _mm_permute_ps __emu_mm_permute_ps
925 #define _mm256_permutevar_pd __emu_mm256_permutevar_pd
926 #define _mm_permutevar_pd __emu_mm_permutevar_pd
928 #define _mm256_permute_pd __emu_mm256_permute_pd
929 #define _mm_permute_pd __emu_mm_permute_pd
931 #define _mm256_permute2f128_ps __emu_mm256_permute2f128_ps
932 #define _mm256_permute2f128_pd __emu_mm256_permute2f128_pd
933 #define _mm256_permute2f128_si256 __emu_mm256_permute2f128_si256
935 #define _mm256_broadcast_ss __emu_mm256_broadcast_ss
936 #define _mm_broadcast_ss __emu_mm_broadcast_ss
938 #define _mm256_broadcast_sd __emu_mm256_broadcast_sd
940 #define _mm256_broadcast_ps __emu_mm256_broadcast_ps
941 #define _mm256_broadcast_pd __emu_mm256_broadcast_pd
943 #define _mm256_insertf128_ps __emu_mm256_insertf128_ps
944 #define _mm256_insertf128_pd __emu_mm256_insertf128_pd
945 #define _mm256_insertf128_si256 __emu_mm256_insertf128_si256
947 #define _mm256_load_pd __emu_mm256_load_pd
948 #define _mm256_store_pd __emu_mm256_store_pd
949 #define _mm256_load_ps __emu_mm256_load_ps
950 #define _mm256_store_ps __emu_mm256_store_ps
952 #define _mm256_loadu_pd __emu_mm256_loadu_pd
953 #define _mm256_storeu_pd __emu_mm256_storeu_pd
954 #define _mm256_loadu_ps __emu_mm256_loadu_ps
955 #define _mm256_storeu_ps __emu_mm256_storeu_ps
957 #define _mm256_load_si256 __emu_mm256_load_si256
958 #define _mm256_store_si256 __emu_mm256_store_si256
959 #define _mm256_loadu_si256 __emu_mm256_loadu_si256
960 #define _mm256_storeu_si256 __emu_mm256_storeu_si256
962 #define _mm256_maskload_pd __emu_mm256_maskload_pd
963 #define _mm256_maskstore_pd __emu_mm256_maskstore_pd
964 #define _mm_maskload_pd __emu_mm_maskload_pd
965 #define _mm_maskstore_pd __emu_mm_maskstore_pd
967 #define _mm256_maskload_ps __emu_mm256_maskload_ps
968 #define _mm256_maskstore_ps __emu_mm256_maskstore_ps
969 #define _mm_maskload_ps __emu_mm_maskload_ps
970 #define _mm_maskstore_ps __emu_mm_maskstore_ps
972 #define _mm256_movehdup_ps __emu_mm256_movehdup_ps
973 #define _mm256_moveldup_ps __emu_mm256_moveldup_ps
975 #define _mm256_movedup_pd __emu_mm256_movedup_pd
976 #define _mm256_lddqu_si256 __emu_mm256_lddqu_si256
978 #define _mm256_stream_si256 __emu_mm256_stream_si256
979 #define _mm256_stream_pd __emu_mm256_stream_pd
980 #define _mm256_stream_ps __emu_mm256_stream_ps
982 #define _mm256_rcp_ps __emu_mm256_rcp_ps
983 #define _mm256_rsqrt_ps __emu_mm256_rsqrt_ps
985 #define _mm256_sqrt_pd __emu_mm256_sqrt_pd
986 #define _mm256_sqrt_ps __emu_mm256_sqrt_ps
988 #define _mm256_round_pd __emu_mm256_round_pd
990 #define _mm256_round_ps __emu_mm256_round_ps
992 #define _mm256_unpackhi_pd __emu_mm256_unpackhi_pd
993 #define _mm256_unpackhi_ps __emu_mm256_unpackhi_ps
995 #define _mm256_unpacklo_pd __emu_mm256_unpacklo_pd
996 #define _mm256_unpacklo_ps __emu_mm256_unpacklo_ps
998 #define _mm256_testz_si256 __emu_mm256_testz_si256
999 #define _mm256_testc_si256 __emu_mm256_testc_si256
1000 #define _mm256_testnzc_si256 __emu_mm256_testnzc_si256
1002 #define _mm256_testz_pd __emu_mm256_testz_pd
1003 #define _mm256_testc_pd __emu_mm256_testc_pd
1004 #define _mm256_testnzc_pd __emu_mm256_testnzc_pd
1005 #define _mm_testz_pd __emu_mm_testz_pd
1006 #define _mm_testc_pd __emu_mm_testc_pd
1007 #define _mm_testnzc_pd __emu_mm_testnzc_pd
1009 #define _mm256_testz_ps __emu_mm256_testz_ps
1010 #define _mm256_testc_ps __emu_mm256_testc_ps
1011 #define _mm256_testnzc_ps __emu_mm256_testnzc_ps
1012 #define _mm_testz_ps __emu_mm_testz_ps
1013 #define _mm_testc_ps __emu_mm_testc_ps
1014 #define _mm_testnzc_ps __emu_mm_testnzc_ps
1016 #define _mm256_movemask_pd __emu_mm256_movemask_pd
1017 #define _mm256_movemask_ps __emu_mm256_movemask_ps
1019 #define _mm256_setzero_pd __emu_mm256_setzero_pd
1020 #define _mm256_setzero_ps __emu_mm256_setzero_ps
1021 #define _mm256_setzero_si256 __emu_mm256_setzero_si256
1023 #define _mm256_set_pd __emu_mm256_set_pd
1024 #define _mm256_set_ps __emu_mm256_set_ps
1025 #define _mm256_set_epi8 __emu_mm256_set_epi8
1026 #define _mm256_set_epi16 __emu_mm256_set_epi16
1027 #define _mm256_set_epi32 __emu_mm256_set_epi32
1028 #define _mm256_set_epi64x __emu_mm256_set_epi64x
1030 #define _mm256_setr_pd __emu_mm256_setr_pd
1031 #define _mm256_setr_ps __emu_mm256_setr_ps
1032 #define _mm256_setr_epi8 __emu_mm256_setr_epi8
1033 #define _mm256_setr_epi16 __emu_mm256_setr_epi16
1034 #define _mm256_setr_epi32 __emu_mm256_setr_epi32
1035 #define _mm256_setr_epi64x __emu_mm256_setr_epi64x
1037 #define _mm256_set1_pd __emu_mm256_set1_pd
1038 #define _mm256_set1_ps __emu_mm256_set1_ps
1039 #define _mm256_set1_epi8 __emu_mm256_set1_epi8
1040 #define _mm256_set1_epi16 __emu_mm256_set1_epi16
1041 #define _mm256_set1_epi32 __emu_mm256_set1_epi32
1042 #define _mm256_set1_epi64x __emu_mm256_set1_epi64x
1044 #define _mm256_castpd_ps __emu_mm256_castpd_ps
1045 #define _mm256_castps_pd __emu_mm256_castps_pd
1046 #define _mm256_castps_si256 __emu_mm256_castps_si256
1047 #define _mm256_castpd_si256 __emu_mm256_castpd_si256
1048 #define _mm256_castsi256_ps __emu_mm256_castsi256_ps
1049 #define _mm256_castsi256_pd __emu_mm256_castsi256_pd
1050 #define _mm256_castps256_ps128 __emu_mm256_castps256_ps128
1051 #define _mm256_castpd256_pd128 __emu_mm256_castpd256_pd128
1052 #define _mm256_castsi256_si128 __emu_mm256_castsi256_si128
1053 #define _mm256_castps128_ps256 __emu_mm256_castps128_ps256
1054 #define _mm256_castpd128_pd256 __emu_mm256_castpd128_pd256
1055 #define _mm256_castsi128_si256 __emu_mm256_castsi128_si256
static __emu_inline __emu__m256d __emu_mm256_castpd128_pd256(__m128d a)
Definition: avxintrin_emu.h:823
static __emu_inline __emu__m256 __emu_mm256_setzero_ps(void)
Definition: avxintrin_emu.h:728
__emu__m256
Definition: avxintrin_emu.h:116
static __emu_inline __emu__m256i __emu_set_m128i(const __m128i arr[])
Definition: avxintrin_emu.h:132
static __emu_inline __emu__m256d __emu_mm256_setr_pd(double a1, double a2, double a3, double a4)
Definition: avxintrin_emu.h:762
static __emu_inline __m128 __emu_mm_cmp_ps(__m128 m1, __m128 m2, const int predicate)
Definition: avxintrin_emu.h:452
static __emu_inline __emu__m256i __emu_mm256_set_epi32(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8)
Definition: avxintrin_emu.h:753
static __emu_inline __emu__m256i __emu_mm256_setzero_si256(void)
Definition: avxintrin_emu.h:729
static __emu_inline __m128i __emu_mm256_extractf128_si256(__emu__m256i m1, const int offset)
Definition: avxintrin_emu.h:525
#define __emu_mm256_permute2f128_impl(name, m128_type, m256_type)
Definition: avxintrin_emu.h:576
static __emu_inline __m128 __emu_mm256_castps256_ps128(__emu__m256 a)
Definition: avxintrin_emu.h:818
static __emu_inline __m128d __emu_mm_permute_pd(__m128d a, int control)
Definition: avxintrin_emu.h:562
static __emu_inline __emu__m256i __emu_mm256_insertf128_si256(__emu__m256i a, __m128i b, int offset)
Definition: avxintrin_emu.h:613
static __emu_inline int __emu_mm256_movemask_ps(__emu__m256 a)
Definition: avxintrin_emu.h:720
static __emu_inline __emu__m256i __emu_mm256_set_epi8(char a1, char a2, char a3, char a4, char a5, char a6, char a7, char a8, char a9, char a10, char a11, char a12, char a13, char a14, char a15, char a16, char a17, char a18, char a19, char a20, char a21, char a22, char a23, char a24, char a25, char a26, char a27, char a28, char a29, char a30, char a31, char a32)
Definition: avxintrin_emu.h:737
static __emu_inline __m128d __emu_mm_cmp_pd(__m128d m1, __m128d m2, const int predicate)
Definition: avxintrin_emu.h:467
#define __EMU_M256_IMPL_M1_RET(ret_type, type, func)
Definition: avxintrin_emu.h:143
#define __emu_maskstore_impl(name, vec_type, mask_vec_type, type, mask_type)
Definition: avxintrin_emu.h:663
static __emu_inline __m128 __emu_mm_cmp_ss(__m128 m1, __m128 m2, const int predicate)
Definition: avxintrin_emu.h:497
static __emu_inline __m128d __emu_mm_cmp_sd(__m128d m1, __m128d m2, const int predicate)
Definition: avxintrin_emu.h:483
__emu__m256d
Definition: avxintrin_emu.h:122
#define __m256d
Definition: avxintrin_emu.h:839
#define __EMU_M256_IMPL_M2I_SHIFT(type, func, shift_for_hi)
Definition: avxintrin_emu.h:241
static __emu_inline void __emu_mm256_zeroall(void)
Definition: avxintrin_emu.h:527
#define __EMU_M256_IMPL_M1I_DUP(type, func)
Definition: avxintrin_emu.h:185
static __emu_inline __m128i __emu_mm_set_epi64x(__emu_int64_t a, __emu_int64_t b)
Definition: avxintrin_emu.h:756
static __emu_inline __emu__m256d __emu_mm256_insertf128_pd(__emu__m256d a, __m128d b, int offset)
Definition: avxintrin_emu.h:612
static __emu_inline __m128 __emu_mm256_extractf128_ps(__emu__m256 m1, const int offset)
Definition: avxintrin_emu.h:523
float double static __m128d __emu_inline __emu__m256 __emu_mm256_insertf128_ps(__emu__m256 a, __m128 b, int offset)
Definition: avxintrin_emu.h:611
static __emu_inline __emu__m256 __emu_mm256_castps128_ps256(__m128 a)
Definition: avxintrin_emu.h:822
static __emu_inline __m128 __emu_mm_permutevar_ps(__m128 a, __m128i control)
Definition: avxintrin_emu.h:530
static __emu_inline __m128d __emu_mm256_castpd256_pd128(__emu__m256d a)
Definition: avxintrin_emu.h:819
#define __EMU_M256_IMPL_M1_LH(type, type_128, func)
Definition: avxintrin_emu.h:159
#define __emu_maskload_impl(name, vec_type, mask_vec_type, type, mask_type)
Definition: avxintrin_emu.h:649
static __emu_inline __emu__m256 __emu_mm256_set_ps(float a1, float a2, float a3, float a4, float a5, float a6, float a7, float a8)
Definition: avxintrin_emu.h:734
#define __m256
Definition: avxintrin_emu.h:837
#define __EMU_M256_IMPL2_M1I_SHIFT(type, func, shift_for_hi)
Definition: avxintrin_emu.h:201
static __emu_inline __m128d __emu_mm256_extractf128_pd(__emu__m256d m1, const int offset)
Definition: avxintrin_emu.h:524
bool ret
Definition: stmskip.cc:242
static __emu_inline __emu__m256i __emu_mm256_setr_epi32(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8)
Definition: avxintrin_emu.h:783
static __emu_inline __m128 __emu_mm_permute_ps(__m128 a, int control)
Definition: avxintrin_emu.h:544
static __emu_inline int __emu_mm256_movemask_pd(__emu__m256d a)
Definition: avxintrin_emu.h:713
#define __EMU_M256_IMPL_M3(type, func)
Definition: avxintrin_emu.h:249
static __emu_inline __emu__m256 __emu_mm256_setr_ps(float a1, float a2, float a3, float a4, float a5, float a6, float a7, float a8)
Definition: avxintrin_emu.h:765
static __emu_inline __emu__m256i __emu_mm256_setr_epi64x(__emu_int64_t a1, __emu_int64_t a2, __emu_int64_t a3, __emu_int64_t a4)
Definition: avxintrin_emu.h:786
#define __EMU_M256_IMPL2_M1I_DUP(type, func)
Definition: avxintrin_emu.h:193
#define __emu_mm_store_impl(name, sfx, m256_sfx, m256_type, type_128, type)
Definition: avxintrin_emu.h:624
static __emu_inline __emu__m256i __emu_mm256_set_epi16(short a1, short a2, short a3, short a4, short a5, short a6, short a7, short a8, short a9, short a10, short a11, short a12, short a13, short a14, short a15, short a16)
Definition: avxintrin_emu.h:746
static __emu_inline __emu__m256d __emu_set_m128d(const __m128d arr[])
Definition: avxintrin_emu.h:131
static __emu_inline __emu__m256d __emu_mm256_setzero_pd(void)
Definition: avxintrin_emu.h:727
#define __EMU_M256_IMPL_M1_RET_NAME(ret_type, type, func, name)
Definition: avxintrin_emu.h:151
#define __emu_mm_load_impl(name, sfx, m256_sfx, m256_type, type_128, type)
Definition: avxintrin_emu.h:616
static __emu_inline __emu__m256i __emu_mm256_setr_epi8(char a1, char a2, char a3, char a4, char a5, char a6, char a7, char a8, char a9, char a10, char a11, char a12, char a13, char a14, char a15, char a16, char a17, char a18, char a19, char a20, char a21, char a22, char a23, char a24, char a25, char a26, char a27, char a28, char a29, char a30, char a31, char a32)
Definition: avxintrin_emu.h:768
#define __EMU_M256_IMPL_M1P_DUP(type, type_param, func)
Definition: avxintrin_emu.h:177
__emu__m256i
Definition: avxintrin_emu.h:128
#define __EMU_M256_IMPL_M2(type, func)
Definition: avxintrin_emu.h:209
static __emu__m256i __emu_mm256_set1_epi64x(__emu_int64_t a)
Definition: avxintrin_emu.h:797
#define __EMU_M256_IMPL2_M2I_DUP(type, func)
Definition: avxintrin_emu.h:233
static __emu_inline __emu__m256 __emu_set_m128(const __m128 arr[])
Definition: avxintrin_emu.h:130
static __emu_inline __m128d __emu_mm_permutevar_pd(__m128d a, __m128i control)
Definition: avxintrin_emu.h:548
#define __EMU_M256_IMPL_M1_HL(type_128, type, func)
Definition: avxintrin_emu.h:168
#define __emu_mm_broadcast_impl(name, res_type, type)
Definition: avxintrin_emu.h:591
#define __EMU_M256_IMPL2_M2T(type, type_2, func)
Definition: avxintrin_emu.h:217
static __emu_inline __emu__m256d __emu_mm256_set_pd(double a1, double a2, double a3, double a4)
Definition: avxintrin_emu.h:731
#define __EMU_M256_IMPL_M1(type, func)
Definition: avxintrin_emu.h:135
static __emu_inline void __emu_mm256_zeroupper(void)
Definition: avxintrin_emu.h:528
union __EMU_M256_ALIGN(32) __emu__m256
Definition: avxintrin_emu.h:112
static __emu_inline __emu__m256i __emu_mm256_castsi128_si256(__m128i a)
Definition: avxintrin_emu.h:824
#define __EMU_M256_IMPL_M2I_DUP(type, func)
Definition: avxintrin_emu.h:225
#define __m256i
Definition: avxintrin_emu.h:838
static __emu_inline __m128i __emu_mm256_castsi256_si128(__emu__m256i a)
Definition: avxintrin_emu.h:820
static __emu_inline __emu__m256i __emu_mm256_set_epi64x(__emu_int64_t a1, __emu_int64_t a2, __emu_int64_t a3, __emu_int64_t a4)
Definition: avxintrin_emu.h:758
static __emu_inline __emu__m256i __emu_mm256_setr_epi16(short a1, short a2, short a3, short a4, short a5, short a6, short a7, short a8, short a9, short a10, short a11, short a12, short a13, short a14, short a15, short a16)
Definition: avxintrin_emu.h:777