Stop only if there aren't any usable algorithms
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / avx2-vpshufhw-2.c
bloba27ed03b3bda5831d00e07c72ce7e53a18910a31
1 /* { dg-do run } */
2 /* { dg-require-effective-target avx2 } */
3 /* { dg-options "-O2 -mavx2" } */
5 #include <string.h>
6 #include "avx2-check.h"
8 #define N 0xec
10 static void
11 compute_pshuflw256 (short *s1, unsigned char imm, short *r)
13 int i;
15 for (i = 0; i < 4; i++)
17 r[i] = s1[(imm >> (2 * i)) & 3];
18 r[i + 8] = s1[((imm >> (2 * i)) & 3) + 8];
21 for (i = 4; i < 8; i++)
23 r[i] = s1[i];
24 r[i + 8] = s1[i + 8];
28 void static
29 avx2_test (void)
31 union256i_w s1, res;
32 short res_ref[16];
33 int i, j, sign = 1;
34 int fail = 0;
36 for (i = 1; i < 10; i++)
38 for (j = 0; j < 16; j++)
40 s1.a[j] = j * i * sign;
41 sign = -sign;
44 res.x = _mm256_shufflelo_epi16 (s1.x, N);
45 compute_pshuflw256 (s1.a, N, res_ref);
47 fail += check_union256i_w (res, res_ref);
50 if (fail != 0)
51 abort ();