2018-05-17 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / avx512bw-vpcmpgew-2.c
blob164258caac8f1443a4c011e4c20011ea17616a61
1 /* { dg-do run } */
2 /* { dg-options "-O2 -mavx512bw" } */
3 /* { dg-require-effective-target avx512bw } */
5 #define AVX512BW
6 #include "avx512f-helper.h"
8 #define SIZE (AVX512F_LEN / 16)
9 #include "avx512f-mask-type.h"
11 void
12 CALC (MASK_TYPE *r, short *s1, short *s2)
14 int i;
15 *r = 0;
16 MASK_TYPE one = 1;
18 for (i = 0; i < SIZE; i++)
19 if (s1[i] >= s2[i])
20 *r = *r | (one << i);
23 void
24 TEST (void)
26 int i;
27 UNION_TYPE (AVX512F_LEN, i_w) src1, src2;
28 MASK_TYPE res_ref, res1, res2;
29 MASK_TYPE mask = MASK_VALUE;
31 for (i = 0; i < SIZE / 2; i++)
33 src1.a[i * 2] = i;
34 src1.a[i * 2 + 1] = i * i;
35 src2.a[i * 2] = 2 * i;
36 src2.a[i * 2 + 1] = i * i;
39 res1 = INTRINSIC (_cmpge_epi16_mask) (src1.x, src2.x);
40 res2 = INTRINSIC (_mask_cmpge_epi16_mask) (mask, src1.x, src2.x);
42 CALC (&res_ref, src1.a, src2.a);
44 if (res_ref != res1)
45 abort ();
47 res_ref &= mask;
49 if (res_ref != res2)
50 abort ();