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