2 /* { dg-options "-O2 -mavx512bw" } */
3 /* { dg-require-effective-target avx512bw } */
6 #include "avx512f-helper.h"
9 #define SIZE (AVX512F_LEN / 16)
10 #include "avx512f-mask-type.h"
12 #if AVX512F_LEN == 512
14 #define CMP(imm, rel) \
16 for (i = 0; i < 64; i++) \
18 dst_ref = ((rel) << i) | dst_ref; \
20 source1.x = _mm512_loadu_si512 (s1); \
21 source2.x = _mm512_loadu_si512 (s2); \
22 dst1 = _mm512_cmp_epu8_mask (source1.x, source2.x, imm);\
23 dst2 = _mm512_mask_cmp_epu8_mask (mask, source1.x, source2.x, imm);\
24 if (dst_ref != dst1) abort(); \
25 if ((mask & dst_ref) != dst2) abort();
28 #if AVX512F_LEN == 256
30 #define CMP(imm, rel) \
32 for (i = 0; i < 32; i++) \
34 dst_ref = ((rel) << i) | dst_ref; \
36 source1.x = _mm256_loadu_si256 ((__m256i*)s1); \
37 source2.x = _mm256_loadu_si256 ((__m256i*)s2); \
38 dst1 = _mm256_cmp_epu8_mask (source1.x, source2.x, imm);\
39 dst2 = _mm256_mask_cmp_epu8_mask (mask, source1.x, source2.x, imm);\
40 if (dst_ref != dst1) abort(); \
41 if ((mask & dst_ref) != dst2) abort();
44 #if AVX512F_LEN == 128
46 #define CMP(imm, rel) \
48 for (i = 0; i < 16; i++) \
50 dst_ref = ((rel) << i) | dst_ref; \
52 source1.x = _mm_loadu_si128 ((__m128i*)s1); \
53 source2.x = _mm_loadu_si128 ((__m128i*)s2); \
54 dst1 = _mm_cmp_epu8_mask (source1.x, source2.x, imm);\
55 dst2 = _mm_mask_cmp_epu8_mask (mask, source1.x, source2.x, imm);\
56 if (dst_ref != dst1) abort(); \
57 if ((mask & dst_ref) != dst2) abort();
63 unsigned char s1
[64] = {34, 78, 53, 64,
79 unsigned char s2
[64] = {4, 68, 86, 8,
95 UNION_TYPE (AVX512F_LEN
, i_b
) source1
, source2
;
96 MASK_TYPE dst1
, dst2
, dst_ref
;
97 MASK_TYPE mask
= MASK_VALUE
;
100 CMP(0x00, s1
[i
] == s2
[i
]);
101 CMP(0x01, s1
[i
] < s2
[i
]);
102 CMP(0x02, s1
[i
] <= s2
[i
]);
104 CMP(0x04, s1
[i
] != s2
[i
]);
105 CMP(0x05, s1
[i
] >= s2
[i
]);
106 CMP(0x06, s1
[i
] > s2
[i
]);