Merge from mainline (165734:167278).
[official-gcc/graphite-test-results.git] / gcc / testsuite / gcc.target / i386 / avx-vpermilpd-256-2.c
blob1cd5c3a62e2f4c1ec74903f7a5415d4ddffbe621
1 /* { dg-do run } */
2 /* { dg-require-effective-target avx } */
3 /* { dg-options "-O2 -mavx" } */
5 #include "avx-check.h"
7 #ifndef CTRL
8 #define CTRL 6
9 #endif
11 #define mask_v(pos) (((CTRL & (1ULL << (pos))) >> (pos)) << 1)
13 void static
14 avx_test ()
16 union256d u, src;
17 union256i_q ctl;
19 double s[4] = {39578.467285, 7856.342941, 9674.67456, 13543.9788};
20 long long m[4] = {mask_v(0), mask_v(1), mask_v(2), mask_v(3)};
21 double e[4] = {0.0};
23 src.x = _mm256_loadu_pd(s);
24 ctl.x = _mm256_loadu_si256((__m256i*) m);
25 u.x = _mm256_permutevar_pd(src.x, ctl.x);
27 e[0] = s[0 + ((m[0] & 0x02) >> 1)];
28 e[1] = s[0 + ((m[1] & 0x02) >> 1)];
29 e[2] = s[2 + ((m[2] & 0x02) >> 1)];
30 e[3] = s[2 + ((m[3] & 0x02) >> 1)];
32 if (check_union256d (u, e))
33 abort ();