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 < 32; 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_epu16_mask (source1.x, source2.x, imm);\
23 dst2 = _mm512_mask_cmp_epu16_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 < 16; 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_epu16_mask (source1.x, source2.x, imm);\
39 dst2 = _mm256_mask_cmp_epu16_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 < 8; 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_epu16_mask (source1.x, source2.x, imm);\
55 dst2 = _mm_mask_cmp_epu16_mask (mask, source1.x, source2.x, imm);\
56 if (dst_ref != dst1) abort(); \
57 if ((mask & dst_ref) != dst2) abort();
63 unsigned short s1
[32] = {2134, 6678, 453, 54646,
64 231, 5674, 111, 23241,
65 12314, 145, 671, 7575,
66 23455, 166, 5321, 5673,
67 2134, 6678, 453, 54646,
68 231, 5674, 111, 23241,
69 12314, 145, 671, 7575,
70 23455, 166, 5321, 5673};
71 unsigned short s2
[32] = {41124, 6678, 8653, 856,
73 2745, 4567, 3676, 123,
74 714, 3589, 5683, 5673,
75 41124, 6678, 8653, 856,
77 2745, 4567, 3676, 123,
78 714, 3589, 5683, 5673};
79 UNION_TYPE (AVX512F_LEN
, i_w
) source1
, source2
;
80 MASK_TYPE dst1
, dst2
, dst_ref
;
81 MASK_TYPE mask
= MASK_VALUE
;
84 CMP(0x00, s1
[i
] == s2
[i
]);
85 CMP(0x01, s1
[i
] < s2
[i
]);
86 CMP(0x02, s1
[i
] <= s2
[i
]);
88 CMP(0x04, s1
[i
] != s2
[i
]);
89 CMP(0x05, s1
[i
] >= s2
[i
]);
90 CMP(0x06, s1
[i
] > s2
[i
]);