1 /* { dg-do run } */
2 /* { dg-options "-O2 -mavx512f -mavx512vbmi2 -mavx512bw" } */
3 /* { dg-require-effective-target avx512f } */
4 /* { dg-require-effective-target avx512vbmi2 } */
5
6 #define AVX512F
7
8 #define AVX512VBMI2
9 #include "avx512f-helper.h"
10
11 #define SIZE (AVX512F_LEN / 64)
12
13 #include "avx512f-mask-type.h"
14
15 static void
CALC(long long * r,long long * dst,long long * s1,long long * s2,int imm)16 CALC (long long *r, long long *dst, long long *s1, long long *s2, int imm)
17 {
18 int i;
19 for (i = 0; i < SIZE; i++)
20 {
21 r[i] = (s1[i] >> (imm & 63)) | (s2[i] << (64 - (imm & 63)));
22 }
23 }
24
25 void
TEST(void)26 TEST (void)
27 {
28 int i;
29 UNION_TYPE (AVX512F_LEN, i_q) res1, res2, res3, src1, src2;
30 MASK_TYPE mask = MASK_VALUE;
31 long long res_ref[SIZE];
32
33 for (i = 0; i < SIZE; i++)
34 {
35 src1.a[i] = 1 + i;
36 src2.a[i] = 2 + 2*i;
37 }
38
39 for (i = 0; i < SIZE; i++)
40 {
41 res1.a[i] = DEFAULT_VALUE;
42 res2.a[i] = DEFAULT_VALUE;
43 res3.a[i] = DEFAULT_VALUE;
44 }
45
46 CALC (res_ref, res1.a, src1.a, src2.a, DEFAULT_VALUE);
47
48 res1.x = INTRINSIC (_shrdi_epi64) (src1.x, src2.x, DEFAULT_VALUE);
49 res2.x = INTRINSIC (_mask_shrdi_epi64) (res2.x, mask, src1.x, src2.x, DEFAULT_VALUE);
50 res3.x = INTRINSIC (_maskz_shrdi_epi64) (mask, src1.x, src2.x, DEFAULT_VALUE);
51
52 if (UNION_CHECK (AVX512F_LEN, i_q) (res1, res_ref))
53 abort ();
54
55 MASK_MERGE (i_q) (res_ref, mask, SIZE);
56 if (UNION_CHECK (AVX512F_LEN, i_q) (res2, res_ref))
57 abort ();
58
59 MASK_ZERO (i_q) (res_ref, mask, SIZE);
60 if (UNION_CHECK (AVX512F_LEN, i_q) (res3, res_ref))
61 abort ();
62 }
63