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_psllvq256(long long int * s1,long long int * s2,long long int * r)9 compute_psllvq256 (long long int *s1, long long int *s2, long long int *r)
10 {
11   int i;
12   long long int count;
13 
14   for (i = 0; i < 4; ++i)
15     {
16       count = s2[i];
17       r[i] = s1[i] << count;
18     }
19 }
20 
21 void static
avx2_test(void)22 avx2_test (void)
23 {
24   union256i_q s1, s2, res;
25   long long int res_ref[4];
26   int i, j, sign = 1;
27   int fail = 0;
28 
29   for (i = 0; i < 10; i++)
30     {
31       for (j = 0; j < 4; j++)
32 	{
33 	  s1.a[j] = j * i * sign;
34 	  s2.a[j] = (j + i) >> 2;
35 	  sign = -sign;
36 	}
37 
38       res.x = _mm256_sllv_epi64 (s1.x, s2.x);
39 
40       compute_psllvq256 (s1.a, s2.a, res_ref);
41 
42       fail += check_union256i_q (res, res_ref);
43     }
44 
45   if (fail != 0)
46     abort ();
47 }
48