void test1bit (void) { d1 = _mm256_extractf128_pd (e2, k4); /* { dg-error "the last argument must be a 1-bit immediate" } */ a1 = _mm256_extractf128_ps (b2, k4); /* { dg-error "the last argument must be a 1-bit immediate" } */ i1 = _mm256_extractf128_si256 (l2, k4); /* { dg-error "the last argument must be a 1-bit immediate" } */ e1 = _mm256_insertf128_pd (e2, d1, k4); /* { dg-error "the last argument must be a 1-bit immediate" } */ b1 = _mm256_insertf128_ps (b2, a1, k4); /* { dg-error "the last argument must be a 1-bit immediate" } */ l1 = _mm256_insertf128_si256 (l2, i1, k4);/* { dg-error "the last argument must be a 1-bit immediate" } */ }
inline void rotate_left_wm1(F64vec4 *v0, const F64vec4 v1) { // {1.0, 2.0, 3.0, 4.0}; // {5.0, 6.0, 7.0, 8.0}; const __m128d hiv0 = _mm256_extractf128_pd(*v0, 1); // {3.0, 4.0} const __m128d phiv0 = _mm_permute_pd(hiv0, 0x1); // {4.0, 3.0} const __m256d shufv1 = _mm256_permute_pd(v1, 0x1); // {6.0, 5.0, 8.0, 7.0}; const __m128d shufv1_lo = _mm256_extractf128_pd(shufv1, 0); // {6.0, 5.0} const __m128d shufv1_hi = _mm256_extractf128_pd(shufv1, 1); // {8.0, 7.0} const __m128d v1_blend = _mm_blend_pd(shufv1_lo, shufv1_hi, 0x2); // blend {6.0, 7.0}; const __m256d inserted = _mm256_insertf128_pd(shufv1, v1_blend, 1); // insert {6.0, 5.0, 6.0, 7.0}; const __m256d blended = _mm256_blend_pd(_mm256_castpd128_pd256(phiv0), inserted, 0xE); *v0 = blended; }
int main() { double (*f)(double) = sin; printf("f=%p\n", f); double x = 1.0; CYBOZU_BENCH("before vinsertf128", x = f, x); printf("x=%f\n", x); #if 1 call_vinsertf128(); #else { puts("a"); __m128d x;// = _mm_setzero_si128(); __m256d y;// = _mm256_setzero_si256(); y = _mm256_insertf128_pd(y, x, 1); printf("%d\n", *(int*)&y); } #endif CYBOZU_BENCH("after vinsertf128", x = f, x); printf("x=%f\n", x); }
inline void rotate_left_wm2(F64vec4 *v0, const F64vec4 v1) { *v0 = _mm256_castpd128_pd256(_mm256_extractf128_pd(*v0, 1)); *v0 = _mm256_insertf128_pd(*v0, _mm256_castpd256_pd128(v1), 1); }
__m256d test_mm256_insertf128_pd_1(__m256d a, __m128d b) { // CHECK-LABEL: @test_mm256_insertf128_pd_1 // CHECK: shufflevector{{.*}}<i32 0, i32 1, i32 4, i32 5> return _mm256_insertf128_pd(a, b, 1); }
__m256d test_mm256_insertf128_pd_0(__m256d a, __m128d b) { // CHECK-LABEL: @test_mm256_insertf128_pd_0 // CHECK: shufflevector{{.*}}<i32 4, i32 5, i32 2, i32 3> return _mm256_insertf128_pd(a, b, 0); }