2015-12-10 Vladimir Makarov <vmakarov@redhat.com>
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / avx512f-vpcmpgeq-2.c
blob8ff390119b384b9c31cb3c7e60fb459fb009d320
1 /* { dg-do run } */
2 /* { dg-options "-O2 -mavx512f" } */
3 /* { dg-require-effective-target avx512f } */
5 #define AVX512F
7 #include "avx512f-helper.h"
9 #define SIZE (AVX512F_LEN / 64)
10 #include "avx512f-mask-type.h"
12 static void
13 CALC (MASK_TYPE *r, long long *s1, long long *s2)
15 int i;
16 *r = 0;
17 MASK_TYPE one = 1;
19 for (i = 0; i < SIZE; i++)
20 if (s1[i] >= s2[i])
21 *r = *r | (one << i);
24 void
25 TEST (void)
27 int i;
28 UNION_TYPE (AVX512F_LEN, i_q) src1, src2;
29 MASK_TYPE res1, res_ref, res2;
30 res1 = 0;
32 for (i = 0; i < SIZE / 2; i++)
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;
40 res1 = INTRINSIC (_cmpge_epi64_mask) (src1.x, src2.x);
41 res2 = INTRINSIC (_mask_cmpge_epi64_mask) (MASK_VALUE, src1.x, src2.x);
43 CALC (&res_ref, src1.a, src2.a);
45 if (res1 != res_ref)
46 abort ();
48 res_ref &= MASK_VALUE;
50 if (res2 != res_ref)
51 abort ();