PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / avx2-vpsraw-2.c
blob66fe8a95cf48fddf35cff949406741d5c29881fc
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 static void
9 compute_psraw256 (short *s1, long long int *s2, short *r)
11 int i;
12 long long int count = s2[0];
14 memset (r, 0, 32);
16 if (count < 16)
17 for (i = 0; i < 16; ++i)
18 r[i] = s1[i] >> count;
22 void static
23 avx2_test (void)
25 union256i_w s1, res;
26 union128i_q s2;
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 s2.a[0] = i;
38 res.x = _mm256_sra_epi16 (s1.x, s2.x);
40 compute_psraw256 (s1.a, s2.a, res_ref);
42 fail += check_union256i_w (res, res_ref);
45 if (fail != 0)
46 abort ();