2 /* { dg-options "-O2 -mavx512bw" } */
3 /* { dg-require-effective-target avx512bw } */
6 #include "avx512f-helper.h"
9 #define SIZE (AVX512F_LEN / 8)
10 #include "avx512f-mask-type.h"
12 #if AVX512F_LEN == 512
14 #define CMP(imm, rel) \
16 for (i = 0; i < SIZE; i++) \
17 dst_ref = ((MASK_TYPE) (rel) << i) | dst_ref; \
18 source1.x = _mm512_loadu_si512 (s1); \
19 source2.x = _mm512_loadu_si512 (s2); \
20 dst1 = _mm512_cmp_epi8_mask (source1.x, source2.x, imm);\
21 dst2 = _mm512_mask_cmp_epi8_mask (mask, source1.x, source2.x, imm);\
22 if (dst_ref != dst1) abort(); \
23 if ((mask & dst_ref) != dst2) abort();
26 #if AVX512F_LEN == 256
28 #define CMP(imm, rel) \
30 for (i = 0; i < SIZE; i++) \
31 dst_ref = ((MASK_TYPE) (rel) << i) | dst_ref; \
32 source1.x = _mm256_loadu_si256 ((__m256i*)s1); \
33 source2.x = _mm256_loadu_si256 ((__m256i*)s2); \
34 dst1 = _mm256_cmp_epi8_mask (source1.x, source2.x, imm);\
35 dst2 = _mm256_mask_cmp_epi8_mask (mask, source1.x, source2.x, imm);\
36 if (dst_ref != dst1) abort(); \
37 if ((mask & dst_ref) != dst2) abort();
40 #if AVX512F_LEN == 128
42 #define CMP(imm, rel) \
44 for (i = 0; i < SIZE; i++) \
45 dst_ref = ((MASK_TYPE) (rel) << i) | dst_ref; \
46 source1.x = _mm_loadu_si128 ((__m128i*)s1); \
47 source2.x = _mm_loadu_si128 ((__m128i*)s2); \
48 dst1 = _mm_cmp_epi8_mask (source1.x, source2.x, imm);\
49 dst2 = _mm_mask_cmp_epi8_mask (mask, source1.x, source2.x, imm);\
50 if (dst_ref != dst1) abort(); \
51 if ((mask & dst_ref) != dst2) abort();
57 char s1
[64] = {34, 78, 53, 64,
73 char s2
[64] = {4, 68, 86, 8,
89 UNION_TYPE (AVX512F_LEN
, i_b
) source1
, source2
;
90 MASK_TYPE dst1
, dst2
, dst_ref
;
91 MASK_TYPE mask
= MASK_VALUE
;
94 CMP(0x00, s1
[i
] == s2
[i
]);
95 CMP(0x01, s1
[i
] < s2
[i
]);
96 CMP(0x02, s1
[i
] <= s2
[i
]);
98 CMP(0x04, s1
[i
] != s2
[i
]);
99 CMP(0x05, s1
[i
] >= s2
[i
]);
100 CMP(0x06, s1
[i
] > s2
[i
]);