2 /* { dg-options "-O2 -mavx512f" } */
3 /* { dg-require-effective-target avx512f } */
7 #include "avx512f-helper.h"
10 #define SIZE (AVX512F_LEN / 32)
11 #include "avx512f-mask-type.h"
13 #if AVX512F_LEN == 512
15 #define CMP(imm, rel) \
17 for (i = 0; i < 16; i++) \
19 dst_ref = ((rel) << i) | dst_ref; \
21 source1.x = _mm512_loadu_si512 (s1); \
22 source2.x = _mm512_loadu_si512 (s2); \
23 dst1 = _mm512_cmp_epu32_mask (source1.x, source2.x, imm);\
24 dst2 = _mm512_mask_cmp_epu32_mask (mask, source1.x, source2.x, imm);\
25 if (dst_ref != dst1) abort(); \
26 if ((mask & dst_ref) != dst2) abort();
29 #if AVX512F_LEN == 256
31 #define CMP(imm, rel) \
33 for (i = 0; i < 8; i++) \
35 dst_ref = ((rel) << i) | dst_ref; \
37 source1.x = _mm256_loadu_si256 ((__m256i*)s1); \
38 source2.x = _mm256_loadu_si256 ((__m256i*)s2); \
39 dst1 = _mm256_cmp_epu32_mask (source1.x, source2.x, imm);\
40 dst2 = _mm256_mask_cmp_epu32_mask (mask, source1.x, source2.x, imm);\
41 if (dst_ref != dst1) abort(); \
42 if ((mask & dst_ref) != dst2) abort();
45 #if AVX512F_LEN == 128
47 #define CMP(imm, rel) \
49 for (i = 0; i < 4; i++) \
51 dst_ref = ((rel) << i) | dst_ref; \
53 source1.x = _mm_loadu_si128 ((__m128i*)s1); \
54 source2.x = _mm_loadu_si128 ((__m128i*)s2); \
55 dst1 = _mm_cmp_epu32_mask (source1.x, source2.x, imm);\
56 dst2 = _mm_mask_cmp_epu32_mask (mask, source1.x, source2.x, imm);\
57 if (dst_ref != dst1) abort(); \
58 if ((mask & dst_ref) != dst2) abort();
64 unsigned int s1
[16] = {2134, 6678, 453, 54646,
65 231, 5674, 111, 23241,
66 12314, 145, 671, 77575,
67 23455, 166, 5321, 5673};
68 unsigned int s2
[16] = {41124, 6678, 8653, 856,
70 2745, 4567, 3676, 123,
71 714, 3589, 5683, 5673};
72 UNION_TYPE (AVX512F_LEN
, i_d
) source1
, source2
;
73 MASK_TYPE dst1
, dst2
, dst_ref
;
74 MASK_TYPE mask
= MASK_VALUE
;
77 CMP(0x00, s1
[i
] == s2
[i
]);
78 CMP(0x01, s1
[i
] < s2
[i
]);
79 CMP(0x02, s1
[i
] <= s2
[i
]);
81 CMP(0x04, s1
[i
] != s2
[i
]);
82 CMP(0x05, s1
[i
] >= s2
[i
]);
83 CMP(0x06, s1
[i
] > s2
[i
]);