Rebase.
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / avx512f-vpcmpud-2.c
blob7a1ed898271466ef6a3b203e0b0972e0987fa188
1 /* { dg-do run } */
2 /* { dg-options "-O2 -mavx512f" } */
3 /* { dg-require-effective-target avx512f } */
5 #define AVX512F
7 #include "avx512f-helper.h"
9 #include <math.h>
10 #define SIZE (AVX512F_LEN / 32)
11 #include "avx512f-mask-type.h"
13 #if AVX512F_LEN == 512
14 #define CMP(imm, rel) \
15 dst_ref = 0; \
16 for (i = 0; i < 16; i++) \
17 { \
18 dst_ref = ((rel) << i) | dst_ref; \
19 } \
20 source1.x = _mm512_loadu_si512 (s1); \
21 source2.x = _mm512_loadu_si512 (s2); \
22 dst1 = _mm512_cmp_epu32_mask (source1.x, source2.x, imm);\
23 dst2 = _mm512_mask_cmp_epu32_mask (mask, source1.x, source2.x, imm);\
24 if (dst_ref != dst1) abort(); \
25 if ((mask & dst_ref) != dst2) abort();
26 #endif
28 void
29 TEST ()
31 unsigned int s1[16] = {2134, 6678, 453, 54646,
32 231, 5674, 111, 23241,
33 12314, 145, 671, 77575,
34 23455, 166, 5321, 5673};
35 unsigned int s2[16] = {41124, 6678, 8653, 856,
36 231, 4646, 111, 124,
37 2745, 4567, 3676, 123,
38 714, 3589, 5683, 5673};
39 UNION_TYPE (AVX512F_LEN, i_d) source1, source2;
40 MASK_TYPE dst1, dst2, dst_ref;
41 MASK_TYPE mask = MASK_VALUE;
42 int i;
44 CMP(0x00, s1[i] == s2[i]);
45 CMP(0x01, s1[i] < s2[i]);
46 CMP(0x02, s1[i] <= s2[i]);
47 CMP(0x03, 0);
48 CMP(0x04, s1[i] != s2[i]);
49 CMP(0x05, s1[i] >= s2[i]);
50 CMP(0x06, s1[i] > s2[i]);
51 CMP(0x07, 1);