PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / avx2-vpsrawi-2.c
blobc135833a468925b8cc273c6f87ae6f6dedf9884d
1 /* { dg-do run } */
2 /* { dg-require-effective-target avx2 } */
3 /* { dg-options "-O3 -mavx2" } */
5 #include <string.h>
6 #include "avx2-check.h"
8 #define N 0x5
10 static void
11 compute_psrawi256 (short *s1, short *r)
13 int i;
15 memset (r, 0, 32);
17 if (N < 16)
18 for (i = 0; i < 16; ++i)
19 r[i] = s1[i] >> N;
23 void static
24 avx2_test (void)
26 union256i_w s1, res;
27 short res_ref[16];
28 int i, j;
29 int fail = 0;
31 for (i = 0; i < 10; i++)
33 for (j = 0; j < 16; j++)
34 s1.a[j] = j * i;
36 res.x = _mm256_srai_epi16 (s1.x, N);
38 compute_psrawi256 (s1.a, res_ref);
40 fail += check_union256i_w (res, res_ref);
43 if (fail != 0)
44 abort ();