* config/i386/avx512bitalgintrin.h (_mm512_mask_bitshuffle_epi64_mask):
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / avx512bw-vpcmpb-2.c
blob024c4a620f7f3eb58a369846c9ae1c55d3d39e5d
1 /* { dg-do run } */
2 /* { dg-options "-O2 -mavx512bw" } */
3 /* { dg-require-effective-target avx512bw } */
5 #define AVX512BW
6 #include "avx512f-helper.h"
8 #include <math.h>
9 #define SIZE (AVX512F_LEN / 8)
10 #include "avx512f-mask-type.h"
12 #if AVX512F_LEN == 512
13 #undef CMP
14 #define CMP(imm, rel) \
15 dst_ref = 0; \
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();
24 #endif
26 #if AVX512F_LEN == 256
27 #undef CMP
28 #define CMP(imm, rel) \
29 dst_ref = 0; \
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();
38 #endif
40 #if AVX512F_LEN == 128
41 #undef CMP
42 #define CMP(imm, rel) \
43 dst_ref = 0; \
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();
52 #endif
54 void
55 TEST ()
57 char s1[64] = {34, 78, 53, 64,
58 1, 57, 11, 231,
59 14, 45, 71, 75,
60 55, 66, 21, 73,
61 34, 68, 3, 56,
62 1, 57, 111, 241,
63 14, 15, 61, 75,
64 55, 16, 52, 3,
65 34, 78, 53, 64,
66 1, 57, 11, 231,
67 14, 45, 71, 75,
68 45, 66, 21, 73,
69 34, 68, 3, 56,
70 1, 57, 111, 241,
71 14, 15, 61, 75,
72 55, 16, 52, 3};
73 char s2[64] = {4, 68, 86, 8,
74 1, 46, 1, 1,
75 45, 67, 36, 3,
76 4, 39, 56, 56,
77 124, 78, 53, 56,
78 1, 46, 1, 12,
79 45, 47, 36, 13,
80 4, 35, 56, 67,
81 4, 68, 86, 8,
82 1, 46, 1, 1,
83 45, 67, 36, 3,
84 4, 39, 56, 56,
85 124, 78, 53, 56,
86 1, 46, 1, 12,
87 45, 47, 36, 13,
88 4, 35, 56, 67};
89 UNION_TYPE (AVX512F_LEN, i_b) source1, source2;
90 MASK_TYPE dst1, dst2, dst_ref;
91 MASK_TYPE mask = MASK_VALUE;
92 int i;
94 CMP(0x00, s1[i] == s2[i]);
95 CMP(0x01, s1[i] < s2[i]);
96 CMP(0x02, s1[i] <= s2[i]);
97 CMP(0x03, 0);
98 CMP(0x04, s1[i] != s2[i]);
99 CMP(0x05, s1[i] >= s2[i]);
100 CMP(0x06, s1[i] > s2[i]);
101 CMP(0x07, 1);