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 / 32)
10 #include "avx512f-mask-type.h"
11
12 static void
CALC(MASK_TYPE * r,int * s1,int * s2)13 CALC (MASK_TYPE *r, int *s1, int *s2)
14 {
15 int i;
16 *r = 0;
17 MASK_TYPE one = 1;
18
19 for (i = 0; i < SIZE; i++)
20 if (s1[i] <= s2[i])
21 *r = *r | (one << i);
22 }
23
24 void
TEST(void)25 TEST (void)
26 {
27 int i;
28 UNION_TYPE (AVX512F_LEN, i_d) src1, src2;
29 MASK_TYPE res_ref, res1, res2;
30 res1 = 0;
31
32 for (i = 0; i < SIZE / 2; i++)
33 {
34 src1.a[i * 2] = i;
35 src1.a[i * 2 + 1] = i * i;
36 src2.a[i * 2] = 2 * i;
37 src2.a[i * 2 + 1] = i * i;
38 }
39
40 res1 = INTRINSIC (_cmple_epu32_mask) (src1.x, src2.x);
41 res2 = INTRINSIC (_mask_cmple_epu32_mask) (MASK_VALUE, src1.x, src2.x);
42
43 CALC (&res_ref, src1.a, src2.a);
44
45 if (res_ref != res1)
46 abort ();
47
48 res_ref &= MASK_VALUE;
49
50 if (res_ref != res2)
51 abort ();
52 }
53