1 /* { dg-do run } */
2 /* { dg-options "-O2 -mavx512f" } */
3 /* { dg-require-effective-target avx512f } */
4
5 #define AVX512F
6
7 #include "avx512f-helper.h"
8
9 #define SIZE (AVX512F_LEN / 64)
10 #include "avx512f-mask-type.h"
11
12 static void
CALC(MASK_TYPE * res,long long * src1,long long * src2)13 CALC (MASK_TYPE *res, long long *src1, long long *src2)
14 {
15 int i;
16 *res = 0;
17 MASK_TYPE one = 1;
18
19 for (i = 0; i < SIZE; i++)
20 if (src1[i] & src2[i])
21 *res = *res | one << i;
22 }
23
24 void
TEST(void)25 TEST (void)
26 {
27 int i, sign = 1;
28 UNION_TYPE (AVX512F_LEN, i_q) src1, src2;
29 MASK_TYPE res_ref, res1, res2;
30 MASK_TYPE mask = MASK_VALUE;
31 res1 = 0;
32 res2 = 0;
33
34 for (i = 0; i < SIZE; i++)
35 {
36 src1.a[i] = i * i * sign;
37 src2.a[i] = i + 20;
38 sign = -sign;
39 }
40
41 res1 = INTRINSIC (_test_epi64_mask) (src1.x, src2.x);
42 res2 = INTRINSIC (_mask_test_epi64_mask) (mask, src1.x, src2.x);
43
44 CALC (&res_ref, src1.a, src2.a);
45
46 if (res1 != res_ref)
47 abort ();
48
49 res_ref &= mask;
50
51 if (res2 != res_ref)
52 abort ();
53 }
54