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 #define N 0x5
9 
10 static void
compute_psrldq256(char * s1,char * r)11 compute_psrldq256 (char *s1, char *r)
12 {
13   int i;
14 
15   memset (r, 0, 32);
16 
17   for (i = 0; i < 16 - N; i++)
18     r[i] = s1[i + N];
19 
20   for (i = 0; i < 16 - N; i++)
21     r[i + 16] = s1[i + N + 16];
22 }
23 
24 
25 void static
avx2_test(void)26 avx2_test (void)
27 {
28   union256i_b s1, res;
29   char res_ref[32];
30   int i, j;
31   int fail = 0;
32 
33   for (i = 0; i < 10; i++)
34     {
35       for (j = 0; j < 32; j++)
36 	s1.a[j] = j * i;
37 
38       res.x = _mm256_srli_si256 (s1.x, N);
39 
40       compute_psrldq256 (s1.a, res_ref);
41 
42       fail += check_union256i_b (res, res_ref);
43     }
44 
45   if (fail != 0)
46     abort ();
47 }
48