1 /* { dg-do run } */
2 /* { dg-require-effective-target avx2 } */
3 /* { dg-options "-O2 -mavx2" } */
4
5 #include <string.h>
6 #include "avx2-check.h"
7
8 static void
compute_psravd256(int * s1,int * s2,int * r)9 compute_psravd256 (int *s1, int *s2, int *r)
10 {
11 int i, count;
12
13 for (i = 0; i < 8; ++i)
14 {
15 count = s2[i];
16 r[i] = s1[i] >> count;
17 }
18 }
19
20 void static
avx2_test(void)21 avx2_test (void)
22 {
23 union256i_d s1, s2, res;
24 int res_ref[8];
25 int i, j, sign = 1;
26 int fail = 0;
27
28 for (i = 0; i < 10; i++)
29 {
30 for (j = 0; j < 8; j++)
31 {
32 s1.a[j] = j * i * sign;
33 s2.a[j] = (j + i) >> 2;
34 sign = -sign;
35 }
36
37 res.x = _mm256_srav_epi32 (s1.x, s2.x);
38
39 compute_psravd256 (s1.a, s2.a, res_ref);
40
41 fail += check_union256i_d (res, res_ref);
42 }
43
44 if (fail != 0)
45 abort ();
46 }
47