1 /* { dg-do run } */
2 /* { dg-options "-O2 -mavx512f" } */
3 /* { dg-require-effective-target avx512f } */
4
5 #include <string.h>
6 #include "avx512f-check.h"
7
8 static void
compute_psrlvq512(long long int * s1,long long int * s2,long long int * r)9 compute_psrlvq512 (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 < 8; ++i)
15 {
16 count = s2[i];
17 r[i] = ((unsigned long long) s1[i]) >> count;
18 }
19 }
20
21 void static
avx512f_test(void)22 avx512f_test (void)
23 {
24 union512i_q s1, s2, res;
25 long long int res_ref[8];
26 int i, j, sign = 1;
27 int fail = 0;
28
29 for (i = 0; i < 10; i++)
30 {
31 for (j = 0; j < 8; j++)
32 {
33 s1.a[j] = j * i * sign;
34 s2.a[j] = (j + i) >> 2;
35 sign = -sign;
36 }
37
38 res.x = _mm512_srlv_epi64 (s1.x, s2.x);
39
40 compute_psrlvq512 (s1.a, s2.a, res_ref);
41
42 fail += check_union512i_q (res, res_ref);
43 }
44
45 if (fail != 0)
46 abort ();
47 }