2 /* { dg-options "-O2 -mavx512bw -DAVX512BW" } */
3 /* { dg-require-effective-target avx512bw } */
5 #include "avx512f-helper.h"
8 #define SIZE (AVX512F_LEN / 16)
9 #include "avx512f-mask-type.h"
11 #if AVX512F_LEN == 512
13 #define CMP(imm, rel) \
15 for (i = 0; i < 64; i++) \
17 dst_ref = ((rel) << i) | dst_ref; \
19 source1.x = _mm512_loadu_si512 (s1); \
20 source2.x = _mm512_loadu_si512 (s2); \
21 dst1 = _mm512_cmp_epi8_mask (source1.x, source2.x, imm);\
22 dst2 = _mm512_mask_cmp_epi8_mask (mask, source1.x, source2.x, imm);\
23 if (dst_ref != dst1) abort(); \
24 if ((mask & dst_ref) != dst2) abort();
27 #if AVX512F_LEN == 256
29 #define CMP(imm, rel) \
31 for (i = 0; i < 32; i++) \
33 dst_ref = ((rel) << i) | dst_ref; \
35 source1.x = _mm256_loadu_si256 ((__m256i*)s1); \
36 source2.x = _mm256_loadu_si256 ((__m256i*)s2); \
37 dst1 = _mm256_cmp_epi8_mask (source1.x, source2.x, imm);\
38 dst2 = _mm256_mask_cmp_epi8_mask (mask, source1.x, source2.x, imm);\
39 if (dst_ref != dst1) abort(); \
40 if ((mask & dst_ref) != dst2) abort();
43 #if AVX512F_LEN == 128
45 #define CMP(imm, rel) \
47 for (i = 0; i < 16; i++) \
49 dst_ref = ((rel) << i) | dst_ref; \
51 source1.x = _mm_loadu_si128 ((__m128i*)s1); \
52 source2.x = _mm_loadu_si128 ((__m128i*)s2); \
53 dst1 = _mm_cmp_epi8_mask (source1.x, source2.x, imm);\
54 dst2 = _mm_mask_cmp_epi8_mask (mask, source1.x, source2.x, imm);\
55 if (dst_ref != dst1) abort(); \
56 if ((mask & dst_ref) != dst2) abort();
62 char s1
[64] = {34, 78, 53, 64,
78 char s2
[64] = {4, 68, 86, 8,
94 UNION_TYPE (AVX512F_LEN
, i_b
) source1
, source2
;
95 MASK_TYPE dst1
, dst2
, dst_ref
;
96 MASK_TYPE mask
= MASK_VALUE
;
99 CMP(0x00, s1
[i
] == s2
[i
]);
100 CMP(0x01, s1
[i
] < s2
[i
]);
101 CMP(0x02, s1
[i
] <= s2
[i
]);
103 CMP(0x04, s1
[i
] != s2
[i
]);
104 CMP(0x05, s1
[i
] >= s2
[i
]);
105 CMP(0x06, s1
[i
] > s2
[i
]);