Debian Codegraph @

clang/test/CIR/CodeGenBuiltins/X86/avx512f-builtins.c

raw
1 // RUN: %clang_cc1 -x c -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +avx512f -fclangir -emit-cir -o %t.cir -Wall -Werror -Wsign-conversion
2 // RUN: FileCheck --check-prefix=CIR --input-file=%t.cir %s
3 // RUN: %clang_cc1 -x c -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +avx512f -fclangir -emit-llvm -o %t.ll -Wall -Werror -Wsign-conversion
4 // RUN: FileCheck --check-prefixes=LLVM --input-file=%t.ll %s
5
6 // RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +avx512f -fclangir -emit-cir -o %t.cir -Wall -Werror -Wsign-conversion
7 // RUN: FileCheck --check-prefix=CIR --input-file=%t.cir %s
8 // RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +avx512f -fclangir -emit-llvm -o %t.ll -Wall -Werror -Wsign-conversion
9 // RUN: FileCheck --check-prefixes=LLVM --input-file=%t.ll %s
10
11 // RUN: %clang_cc1 -x c -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +avx512f -emit-llvm -o - -Wall -Werror -Wsign-conversion | FileCheck %s --check-prefixes=OGCG
12 // RUN: %clang_cc1 -x c -flax-vector-conversions=none -fms-extensions -fms-compatibility -ffreestanding %s -triple=x86_64-windows-msvc -target-feature +avx512f -emit-llvm -o - -Wall -Werror -Wsign-conversion | FileCheck %s --check-prefixes=OGCG
13 // RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +avx512f -emit-llvm -o - -Wall -Werror -Wsign-conversion | FileCheck %s --check-prefixes=OGCG
14 // RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -fms-extensions -fms-compatibility -ffreestanding %s -triple=x86_64-windows-msvc -target-feature +avx512f -emit-llvm -o - -Wall -Werror -Wsign-conversion | FileCheck %s --check-prefixes=OGCG
15
16 #include <immintrin.h>
17
18 __m512 test_mm512_undefined(void) {
19 // CIR-LABEL: _mm512_undefined
20 // CIR: %[[A:.*]] = cir.const #cir.zero : !cir.vector<8 x !cir.double>
21 // CIR: %{{.*}} = cir.cast bitcast %[[A]] : !cir.vector<8 x !cir.double> -> !cir.vector<16 x !cir.float>
22 // CIR: cir.return %{{.*}} : !cir.vector<16 x !cir.float>
23
24 // LLVM-LABEL: test_mm512_undefined
25 // LLVM: store <16 x float> zeroinitializer, ptr %[[A:.*]], align 64
26 // LLVM: %{{.*}} = load <16 x float>, ptr %[[A]], align 64
27 // LLVM: ret <16 x float> %{{.*}}
28
29 // OGCG-LABEL: test_mm512_undefined
30 // OGCG: ret <16 x float> zeroinitializer
31 return _mm512_undefined();
32 }
33
34 __m512 test_mm512_undefined_ps(void) {
35 // CIR-LABEL: _mm512_undefined_ps
36 // CIR: %[[A:.*]] = cir.const #cir.zero : !cir.vector<8 x !cir.double>
37 // CIR: %{{.*}} = cir.cast bitcast %[[A]] : !cir.vector<8 x !cir.double> -> !cir.vector<16 x !cir.float>
38 // CIR: cir.return %{{.*}} : !cir.vector<16 x !cir.float>
39
40 // LLVM-LABEL: test_mm512_undefined_ps
41 // LLVM: store <16 x float> zeroinitializer, ptr %[[A:.*]], align 64
42 // LLVM: %{{.*}} = load <16 x float>, ptr %[[A]], align 64
43 // LLVM: ret <16 x float> %{{.*}}
44
45 // OGCG-LABEL: test_mm512_undefined_ps
46 // OGCG: ret <16 x float> zeroinitializer
47 return _mm512_undefined_ps();
48 }
49
50 __m512d test_mm512_undefined_pd(void) {
51 // CIR-LABEL: _mm512_undefined_pd
52 // CIR: %{{.*}} = cir.const #cir.zero : !cir.vector<8 x !cir.double>
53 // CIR: cir.return %{{.*}} : !cir.vector<8 x !cir.double>
54
55 // LLVM-LABEL: test_mm512_undefined_pd
56 // LLVM: store <8 x double> zeroinitializer, ptr %[[A:.*]], align 64
57 // LLVM: %{{.*}} = load <8 x double>, ptr %[[A]], align 64
58 // LLVM: ret <8 x double> %{{.*}}
59
60 // OGCG-LABEL: test_mm512_undefined_pd
61 // OGCG: ret <8 x double> zeroinitializer
62 return _mm512_undefined_pd();
63 }
64
65 __m512i test_mm512_undefined_epi32(void) {
66 // CIR-LABEL: _mm512_undefined_epi32
67 // CIR: %[[A:.*]] = cir.const #cir.zero : !cir.vector<8 x !cir.double>
68 // CIR: %{{.*}} = cir.cast bitcast %[[A]] : !cir.vector<8 x !cir.double> -> !cir.vector<8 x !s64i>
69 // CIR: cir.return %{{.*}} : !cir.vector<8 x !s64i>
70
71 // LLVM-LABEL: test_mm512_undefined_epi32
72 // LLVM: store <8 x i64> zeroinitializer, ptr %[[A:.*]], align 64
73 // LLVM: %{{.*}} = load <8 x i64>, ptr %[[A]], align 64
74 // LLVM: ret <8 x i64> %{{.*}}
75
76 // OGCG-LABEL: test_mm512_undefined_epi32
77 // OGCG: ret <8 x i64> zeroinitializer
78 return _mm512_undefined_epi32();
79 }
80
81 __m512d test_mm512_shuffle_pd(__m512d __M, __m512d __V) {
82 // CIR-LABEL: test_mm512_shuffle_pd
83 // CIR: %{{.*}} = cir.vec.shuffle(%{{.*}}, %{{.*}} : !cir.vector<8 x !cir.double>) [#cir.int<0> : !s32i, #cir.int<8> : !s32i, #cir.int<3> : !s32i, #cir.int<10> : !s32i, #cir.int<4> : !s32i, #cir.int<12> : !s32i, #cir.int<6> : !s32i, #cir.int<14> : !s32i] : !cir.vector<8 x !cir.double>
84
85 // LLVM-LABEL: test_mm512_shuffle_pd
86 // LLVM: shufflevector <8 x double> %{{.*}}, <8 x double> %{{.*}}, <8 x i32> <i32 0, i32 8, i32 3, i32 10, i32 4, i32 12, i32 6, i32 14>
87
88 // OGCG-LABEL: test_mm512_shuffle_pd
89 // OGCG: shufflevector <8 x double> %{{.*}}, <8 x double> %{{.*}}, <8 x i32> <i32 0, i32 8, i32 3, i32 10, i32 4, i32 12, i32 6, i32 14>
90 return _mm512_shuffle_pd(__M, __V, 4);
91 }
92
93 __m512 test_mm512_shuffle_ps(__m512 __M, __m512 __V) {
94 // CIR-LABEL: test_mm512_shuffle_ps
95 // CIR: %{{.*}} = cir.vec.shuffle(%{{.*}}, %{{.*}} : !cir.vector<16 x !cir.float>) [#cir.int<0> : !s32i, #cir.int<1> : !s32i, #cir.int<16> : !s32i, #cir.int<16> : !s32i, #cir.int<4> : !s32i, #cir.int<5> : !s32i, #cir.int<20> : !s32i, #cir.int<20> : !s32i, #cir.int<8> : !s32i, #cir.int<9> : !s32i, #cir.int<24> : !s32i, #cir.int<24> : !s32i, #cir.int<12> : !s32i, #cir.int<13> : !s32i, #cir.int<28> : !s32i, #cir.int<28> : !s32i] : !cir.vector<16 x !cir.float>
96
97 // LLVM-LABEL: test_mm512_shuffle_ps
98 // LLVM: shufflevector <16 x float> %{{.*}}, <16 x float> %{{.*}}, <16 x i32> <i32 0, i32 1, i32 16, i32 16, i32 4, i32 5, i32 20, i32 20, i32 8, i32 9, i32 24, i32 24, i32 12, i32 13, i32 28, i32 28>
99
100 // OGCG-LABEL: test_mm512_shuffle_ps
101 // OGCG: shufflevector <16 x float> %{{.*}}, <16 x float> %{{.*}}, <16 x i32> <i32 0, i32 1, i32 16, i32 16, i32 4, i32 5, i32 20, i32 20, i32 8, i32 9, i32 24, i32 24, i32 12, i32 13, i32 28, i32 28>
102 return _mm512_shuffle_ps(__M, __V, 4);
103 }
104
105 __m512 test_mm512_permute_ps(__m512 A) {
106 // CIR-LABEL: test_mm512_permute_ps
107 // CIR: cir.vec.shuffle(%{{.*}}, %{{.*}} : !cir.vector<16 x !cir.float>) [#cir.int<2> : !s32i, #cir.int<3> : !s32i, #cir.int<0> : !s32i, #cir.int<1> : !s32i, #cir.int<6> : !s32i, #cir.int<7> : !s32i, #cir.int<4> : !s32i, #cir.int<5> : !s32i, #cir.int<10> : !s32i, #cir.int<11> : !s32i, #cir.int<8> : !s32i, #cir.int<9> : !s32i, #cir.int<14> : !s32i, #cir.int<15> : !s32i, #cir.int<12> : !s32i, #cir.int<13> : !s32i] : !cir.vector<16 x !cir.float>
108
109 // LLVM-LABEL: test_mm512_permute_ps
110 // LLVM: shufflevector <16 x float> %{{.*}}, <16 x float> poison, <16 x i32> <i32 2, i32 3, i32 0, i32 1, i32 6, i32 7, i32 4, i32 5, i32 10, i32 11, i32 8, i32 9, i32 14, i32 15, i32 12, i32 13>
111
112 // OGCG-LABEL: test_mm512_permute_ps
113 // OGCG: shufflevector <16 x float> %{{.*}}, <16 x float> poison, <16 x i32> <i32 2, i32 3, i32 0, i32 1, i32 6, i32 7, i32 4, i32 5, i32 10, i32 11, i32 8, i32 9, i32 14, i32 15, i32 12, i32 13>
114 return _mm512_permute_ps(A, 0x4E);
115 }
116
117 __m512d test_mm512_permute_pd(__m512d A) {
118 // CIR-LABEL: test_mm512_permute_pd
119 // CIR: cir.vec.shuffle(%{{.*}}, %{{.*}} : !cir.vector<8 x !cir.double>) [#cir.int<1> : !s32i, #cir.int<0> : !s32i, #cir.int<3> : !s32i, #cir.int<2> : !s32i, #cir.int<5> : !s32i, #cir.int<4> : !s32i, #cir.int<7> : !s32i, #cir.int<6> : !s32i] : !cir.vector<8 x !cir.double>
120
121 // LLVM-LABEL: test_mm512_permute_pd
122 // LLVM: shufflevector <8 x double> %{{.*}}, <8 x double> poison, <8 x i32> <i32 1, i32 0, i32 3, i32 2, i32 5, i32 4, i32 7, i32 6>
123
124 // OGCG-LABEL: test_mm512_permute_pd
125 // OGCG: shufflevector <8 x double> %{{.*}}, <8 x double> poison, <8 x i32> <i32 1, i32 0, i32 3, i32 2, i32 5, i32 4, i32 7, i32 6>
126 return _mm512_permute_pd(A, 0x55);
127 }
128
129 __m512d test_mm512_insertf64x4(__m512d __A, __m256d __B) {
130 // CIR-LABEL: test_mm512_insertf64x4
131 // CIR: %{{.*}} = cir.vec.shuffle(%{{.*}}, %{{.*}} : !cir.vector<8 x !cir.double>) [#cir.int<0> : !s32i, #cir.int<1> : !s32i, #cir.int<2> : !s32i, #cir.int<3> : !s32i, #cir.int<8> : !s32i, #cir.int<9> : !s32i, #cir.int<10> : !s32i, #cir.int<11> : !s32i] : !cir.vector<8 x !cir.double>
132
133 // LLVM-LABEL: test_mm512_insertf64x4
134 // LLVM: shufflevector <8 x double> %{{.*}}, <8 x double> %{{.*}}, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 8, i32 9, i32 10, i32 11>
135
136 // OGCG-LABEL: test_mm512_insertf64x4
137 // OGCG: shufflevector <8 x double> %{{.*}}, <8 x double> %{{.*}}, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 8, i32 9, i32 10, i32 11>
138 return _mm512_insertf64x4(__A, __B, 1);
139 }
140
141 __m512 test_mm512_insertf32x4(__m512 __A, __m128 __B) {
142 // CIR-LABEL: test_mm512_insertf32x4
143 // CIR: %{{.*}} = cir.vec.shuffle(%{{.*}}, %{{.*}} : !cir.vector<16 x !cir.float>) [#cir.int<0> : !s32i, #cir.int<1> : !s32i, #cir.int<2> : !s32i, #cir.int<3> : !s32i, #cir.int<16> : !s32i, #cir.int<17> : !s32i, #cir.int<18> : !s32i, #cir.int<19> : !s32i, #cir.int<8> : !s32i, #cir.int<9> : !s32i, #cir.int<10> : !s32i, #cir.int<11> : !s32i, #cir.int<12> : !s32i, #cir.int<13> : !s32i, #cir.int<14> : !s32i, #cir.int<15> : !s32i] : !cir.vector<16 x !cir.float>
144
145 // LLVM-LABEL: test_mm512_insertf32x4
146 // LLVM: shufflevector <16 x float> %{{.*}}, <16 x float> %{{.*}}, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 16, i32 17, i32 18, i32 19, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
147
148 // OGCG-LABEL: test_mm512_insertf32x4
149 // OGCG: shufflevector <16 x float> %{{.*}}, <16 x float> %{{.*}}, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 16, i32 17, i32 18, i32 19, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
150 return _mm512_insertf32x4(__A, __B, 1);
151 }
152
153 __m512i test_mm512_inserti64x4(__m512i __A, __m256i __B) {
154 // CIR-LABEL: test_mm512_inserti64x4
155 // CIR: %{{.*}} = cir.vec.shuffle(%{{.*}}, %{{.*}} : !cir.vector<8 x !s64i>) [#cir.int<0> : !s32i, #cir.int<1> : !s32i, #cir.int<2> : !s32i, #cir.int<3> : !s32i, #cir.int<8> : !s32i, #cir.int<9> : !s32i, #cir.int<10> : !s32i, #cir.int<11> : !s32i] : !cir.vector<8 x !s64i>
156
157 // LLVM-LABEL: test_mm512_inserti64x4
158 // LLVM: shufflevector <8 x i64> %{{.*}}, <8 x i64> %{{.*}}, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 8, i32 9, i32 10, i32 11>
159
160 // OGCG-LABEL: test_mm512_inserti64x4
161 // OGCG: shufflevector <8 x i64> %{{.*}}, <8 x i64> %{{.*}}, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 8, i32 9, i32 10, i32 11>
162 return _mm512_inserti64x4(__A, __B, 1);
163 }
164
165 __m512i test_mm512_inserti32x4(__m512i __A, __m128i __B) {
166 // CIR-LABEL: test_mm512_inserti32x4
167 // CIR: %{{.*}} = cir.vec.shuffle(%{{.*}}, %{{.*}} : !cir.vector<16 x !s32i>) [#cir.int<0> : !s32i, #cir.int<1> : !s32i, #cir.int<2> : !s32i, #cir.int<3> : !s32i, #cir.int<16> : !s32i, #cir.int<17> : !s32i, #cir.int<18> : !s32i, #cir.int<19> : !s32i, #cir.int<8> : !s32i, #cir.int<9> : !s32i, #cir.int<10> : !s32i, #cir.int<11> : !s32i, #cir.int<12> : !s32i, #cir.int<13> : !s32i, #cir.int<14> : !s32i, #cir.int<15> : !s32i] : !cir.vector<16 x !s32i>
168
169 // LLVM-LABEL: test_mm512_inserti32x4
170 // LLVM: shufflevector <16 x i32> %{{.*}}, <16 x i32> %{{.*}}, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 16, i32 17, i32 18, i32 19, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
171
172 // OGCG-LABEL: test_mm512_inserti32x4
173 // OGCG: shufflevector <16 x i32> %{{.*}}, <16 x i32> %{{.*}}, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 16, i32 17, i32 18, i32 19, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
174 return _mm512_inserti32x4(__A, __B, 1);
175 }
176
177 __mmask16 test_mm512_kand(__mmask16 A, __mmask16 B) {
178 // CIR-LABEL: _mm512_kand
179 // CIR: cir.cast bitcast {{.*}} : !u16i -> !cir.vector<16 x !cir.int<s, 1>>
180 // CIR: cir.cast bitcast {{.*}} : !u16i -> !cir.vector<16 x !cir.int<s, 1>>
181 // CIR: cir.binop(and, {{.*}}, {{.*}}) : !cir.vector<16 x !cir.int<s, 1>>
182 // CIR: cir.cast bitcast {{.*}} : !cir.vector<16 x !cir.int<s, 1>> -> !u16i
183
184 // LLVM-LABEL: _mm512_kand
185 // LLVM: [[L:%.*]] = bitcast i16 %{{.*}} to <16 x i1>
186 // LLVM: [[R:%.*]] = bitcast i16 %{{.*}} to <16 x i1>
187 // LLVM: [[RES:%.*]] = and <16 x i1> [[L]], [[R]]
188 // LLVM: bitcast <16 x i1> [[RES]] to i16
189
190 // OGCG-LABEL: _mm512_kand
191 // OGCG: bitcast i16 %{{.*}} to <16 x i1>
192 // OGCG: bitcast i16 %{{.*}} to <16 x i1>
193 // OGCG: and <16 x i1>
194 // OGCG: bitcast <16 x i1> {{.*}} to i16
195 return _mm512_kand(A, B);
196 }
197
198 __mmask16 test_mm512_kandn(__mmask16 A, __mmask16 B) {
199 // CIR-LABEL: _mm512_kandn
200 // CIR: cir.cast bitcast {{.*}} : !u16i -> !cir.vector<16 x !cir.int<s, 1>>
201 // CIR: cir.cast bitcast {{.*}} : !u16i -> !cir.vector<16 x !cir.int<s, 1>>
202 // CIR: cir.unary(not, {{.*}}) : !cir.vector<16 x !cir.int<s, 1>>
203 // CIR: cir.binop(and, {{.*}}, {{.*}}) : !cir.vector<16 x !cir.int<s, 1>>
204 // CIR: cir.cast bitcast {{.*}} : !cir.vector<16 x !cir.int<s, 1>> -> !u16i
205
206 // LLVM-LABEL: _mm512_kandn
207 // LLVM: [[L:%.*]] = bitcast i16 %{{.*}} to <16 x i1>
208 // LLVM: [[R:%.*]] = bitcast i16 %{{.*}} to <16 x i1>
209 // LLVM: xor <16 x i1> [[L]], splat (i1 true)
210 // LLVM: and <16 x i1>
211 // LLVM: bitcast <16 x i1> {{.*}} to i16
212
213 // OGCG-LABEL: _mm512_kandn
214 // OGCG: bitcast i16 %{{.*}} to <16 x i1>
215 // OGCG: bitcast i16 %{{.*}} to <16 x i1>
216 // OGCG: xor <16 x i1>
217 // OGCG: and <16 x i1>
218 // OGCG: bitcast <16 x i1> {{.*}} to i16
219 return _mm512_kandn(A, B);
220 }
221
222 __mmask16 test_mm512_kor(__mmask16 A, __mmask16 B) {
223 // CIR-LABEL: _mm512_kor
224 // CIR: cir.cast bitcast {{.*}} : !u16i -> !cir.vector<16 x !cir.int<s, 1>>
225 // CIR: cir.cast bitcast {{.*}} : !u16i -> !cir.vector<16 x !cir.int<s, 1>>
226 // CIR: cir.binop(or, {{.*}}, {{.*}}) : !cir.vector<16 x !cir.int<s, 1>>
227 // CIR: cir.cast bitcast {{.*}} : !cir.vector<16 x !cir.int<s, 1>> -> !u16i
228
229 // LLVM-LABEL: _mm512_kor
230 // LLVM: [[L:%.*]] = bitcast i16 %{{.*}} to <16 x i1>
231 // LLVM: [[R:%.*]] = bitcast i16 %{{.*}} to <16 x i1>
232 // LLVM: or <16 x i1> [[L]], [[R]]
233 // LLVM: bitcast <16 x i1> {{.*}} to i16
234
235 // OGCG-LABEL: _mm512_kor
236 // OGCG: bitcast i16 %{{.*}} to <16 x i1>
237 // OGCG: bitcast i16 %{{.*}} to <16 x i1>
238 // OGCG: or <16 x i1>
239 // OGCG: bitcast <16 x i1> {{.*}} to i16
240 return _mm512_kor(A, B);
241 }
242
243 __mmask16 test_mm512_kxnor(__mmask16 A, __mmask16 B) {
244 // CIR-LABEL: _mm512_kxnor
245 // CIR: cir.cast bitcast {{.*}} : !u16i -> !cir.vector<16 x !cir.int<s, 1>>
246 // CIR: cir.cast bitcast {{.*}} : !u16i -> !cir.vector<16 x !cir.int<s, 1>>
247 // CIR: cir.unary(not, {{.*}}) : !cir.vector<16 x !cir.int<s, 1>>
248 // CIR: cir.binop(xor, {{.*}}, {{.*}}) : !cir.vector<16 x !cir.int<s, 1>>
249 // CIR: cir.cast bitcast {{.*}} : !cir.vector<16 x !cir.int<s, 1>> -> !u16i
250
251 // LLVM-LABEL: _mm512_kxnor
252 // LLVM: [[L:%.*]] = bitcast i16 %{{.*}} to <16 x i1>
253 // LLVM: [[R:%.*]] = bitcast i16 %{{.*}} to <16 x i1>
254 // LLVM: [[NOT:%.*]] = xor <16 x i1> [[L]], splat (i1 true)
255 // LLVM: [[RES:%.*]] = xor <16 x i1> [[NOT]], [[R]]
256 // LLVM: bitcast <16 x i1> [[RES]] to i16
257
258 // OGCG-LABEL: _mm512_kxnor
259 // OGCG: bitcast i16 %{{.*}} to <16 x i1>
260 // OGCG: bitcast i16 %{{.*}} to <16 x i1>
261 // OGCG: xor <16 x i1>
262 // OGCG: xor <16 x i1>
263 // OGCG: bitcast <16 x i1> {{.*}} to i16
264 return _mm512_kxnor(A, B);
265 }
266
267 __mmask16 test_mm512_kxor(__mmask16 A, __mmask16 B) {
268 // CIR-LABEL: _mm512_kxor
269 // CIR: cir.cast bitcast {{.*}} : !u16i -> !cir.vector<16 x !cir.int<s, 1>>
270 // CIR: cir.cast bitcast {{.*}} : !u16i -> !cir.vector<16 x !cir.int<s, 1>>
271 // CIR: cir.binop(xor, {{.*}}, {{.*}}) : !cir.vector<16 x !cir.int<s, 1>>
272 // CIR: cir.cast bitcast {{.*}} : !cir.vector<16 x !cir.int<s, 1>> -> !u16i
273
274 // LLVM-LABEL: _mm512_kxor
275 // LLVM: [[L:%.*]] = bitcast i16 %{{.*}} to <16 x i1>
276 // LLVM: [[R:%.*]] = bitcast i16 %{{.*}} to <16 x i1>
277 // LLVM: xor <16 x i1> [[L]], [[R]]
278 // LLVM: bitcast <16 x i1> {{.*}} to i16
279
280 // OGCG-LABEL: _mm512_kxor
281 // OGCG: bitcast i16 %{{.*}} to <16 x i1>
282 // OGCG: bitcast i16 %{{.*}} to <16 x i1>
283 // OGCG: xor <16 x i1>
284 // OGCG: bitcast <16 x i1> {{.*}} to i16
285 return _mm512_kxor(A, B);
286 }
287
288 __mmask16 test_mm512_knot(__mmask16 A) {
289 // CIR-LABEL: _mm512_knot
290 // CIR: cir.cast bitcast {{.*}} : !u16i -> !cir.vector<16 x !cir.int<s, 1>>
291 // CIR: cir.unary(not, {{.*}}) : !cir.vector<16 x !cir.int<s, 1>>
292 // CIR: cir.cast bitcast {{.*}} : !cir.vector<16 x !cir.int<s, 1>> -> !u16i
293
294 // LLVM-LABEL: _mm512_knot
295 // LLVM: bitcast i16 %{{.*}} to <16 x i1>
296 // LLVM: xor <16 x i1>
297 // LLVM: bitcast <16 x i1> {{.*}} to i16
298
299 // OGCG-LABEL: _mm512_knot
300 // OGCG: bitcast i16 %{{.*}} to <16 x i1>
301 // OGCG: xor <16 x i1>
302 // OGCG: bitcast <16 x i1> {{.*}} to i16
303 return _mm512_knot(A);
304 }
305
306 // Multiple user-level mask helpers inline to this same kmov builtin.
307 // CIR does not implement any special lowering for those helpers.
308 //
309 // Therefore, testing the builtin (__builtin_ia32_kmov*) directly is
310 // sufficient to cover the CIR lowering behavior. Testing each helper
311 // individually would add no new CIR paths.
312
313 __mmask16 test_kmov_w(__mmask16 A) {
314 // CIR-LABEL: test_kmov_w
315 // CIR: cir.cast bitcast {{.*}} : !u16i -> !cir.vector<16 x !cir.int<s, 1>>
316 // CIR: cir.cast bitcast {{.*}} : !cir.vector<16 x !cir.int<s, 1>> -> !u16i
317
318 // LLVM-LABEL: test_kmov_w
319 // LLVM: bitcast i16 %{{.*}} to <16 x i1>
320 // LLVM: bitcast <16 x i1> {{.*}} to i16
321
322 // OGCG-LABEL: test_kmov_w
323 // OGCG: bitcast i16 %{{.*}} to <16 x i1>
324 // OGCG: bitcast <16 x i1> {{.*}} to i16
325 return __builtin_ia32_kmovw(A);
326 }
327
328 __mmask16 test_mm512_kunpackb(__mmask16 A, __mmask16 B) {
329 // CIR-LABEL: _mm512_kunpackb
330 // CIR: cir.cast bitcast {{.*}} : !u16i -> !cir.vector<16 x !cir.int<s, 1>>
331 // CIR: cir.cast bitcast {{.*}} : !u16i -> !cir.vector<16 x !cir.int<s, 1>>
332 // CIR: cir.vec.shuffle
333 // CIR: cir.vec.shuffle
334 // CIR: cir.vec.shuffle
335 // CIR: cir.cast bitcast {{.*}} : !cir.vector<16 x !cir.int<s, 1>> -> !u16i
336
337 // LLVM-LABEL: _mm512_kunpackb
338 // LLVM: [[A_VEC:%.*]] = bitcast i16 %{{.*}} to <16 x i1>
339 // LLVM: [[B_VEC:%.*]] = bitcast i16 %{{.*}} to <16 x i1>
340 // LLVM: [[A_HALF:%.*]] = shufflevector <16 x i1> [[A_VEC]], <16 x i1> [[A_VEC]], <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
341 // LLVM: [[B_HALF:%.*]] = shufflevector <16 x i1> [[B_VEC]], <16 x i1> [[B_VEC]], <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
342 // LLVM: [[RES:%.*]] = shufflevector <8 x i1> [[B_HALF]], <8 x i1> [[A_HALF]], <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
343 // LLVM: bitcast <16 x i1> [[RES]] to i16
344
345 // OGCG-LABEL: _mm512_kunpackb
346 // OGCG: [[A_VEC:%.*]] = bitcast i16 %{{.*}} to <16 x i1>
347 // OGCG: [[B_VEC:%.*]] = bitcast i16 %{{.*}} to <16 x i1>
348 // OGCG: [[A_HALF:%.*]] = shufflevector <16 x i1> [[A_VEC]], <16 x i1> [[A_VEC]], <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
349 // OGCG: [[B_HALF:%.*]] = shufflevector <16 x i1> [[B_VEC]], <16 x i1> [[B_VEC]], <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
350 // OGCG: [[RES:%.*]] = shufflevector <8 x i1> [[B_HALF]], <8 x i1> [[A_HALF]], <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
351 // OGCG: bitcast <16 x i1> [[RES]] to i16
352 return _mm512_kunpackb(A, B);
353 }
354 __m256 test_mm512_i64gather_ps(__m512i __index, void const *__addr) {
355 // CIR-LABEL: test_mm512_i64gather_ps
356 // CIR: cir.call_llvm_intrinsic "x86.avx512.mask.gather.qps.512"
357
358 // LLVM-LABEL: test_mm512_i64gather_ps
359 // LLVM: call <8 x float> @llvm.x86.avx512.mask.gather.qps.512
360
361 // OGCG-LABEL: test_mm512_i64gather_ps
362 // OGCG: call <8 x float> @llvm.x86.avx512.mask.gather.qps.512
363 return _mm512_i64gather_ps(__index, __addr, 2);
364 }
365
366 __m256 test_mm512_mask_i64gather_ps(__m256 __v1_old, __mmask8 __mask, __m512i __index, void const *__addr) {
367 // CIR-LABEL: test_mm512_mask_i64gather_ps
368 // CIR: cir.call_llvm_intrinsic "x86.avx512.mask.gather.qps.512"
369
370 // LLVM-LABEL: test_mm512_mask_i64gather_ps
371 // LLVM: call <8 x float> @llvm.x86.avx512.mask.gather.qps.512
372
373 // OGCG-LABEL: test_mm512_mask_i64gather_ps
374 // OGCG: call <8 x float> @llvm.x86.avx512.mask.gather.qps.512
375 return _mm512_mask_i64gather_ps(__v1_old, __mask, __index, __addr, 2);
376 }
377
378 __m256i test_mm512_i64gather_epi32(__m512i __index, void const *__addr) {
379 // CIR-LABEL: test_mm512_i64gather_epi32
380 // CIR: cir.call_llvm_intrinsic "x86.avx512.mask.gather.qpi.512"
381
382 // LLVM-LABEL: test_mm512_i64gather_epi32
383 // LLVM: call <8 x i32> @llvm.x86.avx512.mask.gather.qpi.512
384
385 // OGCG-LABEL: test_mm512_i64gather_epi32
386 // OGCG: call <8 x i32> @llvm.x86.avx512.mask.gather.qpi.512
387 return _mm512_i64gather_epi32(__index, __addr, 2);
388 }
389
390 __m256i test_mm512_mask_i64gather_epi32(__m256i __v1_old, __mmask8 __mask, __m512i __index, void const *__addr) {
391 // CIR-LABEL: test_mm512_mask_i64gather_epi32
392 // CIR: cir.call_llvm_intrinsic "x86.avx512.mask.gather.qpi.512"
393
394 // LLVM-LABEL: test_mm512_mask_i64gather_epi32
395 // LLVM: call <8 x i32> @llvm.x86.avx512.mask.gather.qpi.512
396
397 // OGCG-LABEL: test_mm512_mask_i64gather_epi32
398 // OGCG: call <8 x i32> @llvm.x86.avx512.mask.gather.qpi.512
399 return _mm512_mask_i64gather_epi32(__v1_old, __mask, __index, __addr, 2);
400 }
401
402 __m512d test_mm512_i64gather_pd(__m512i __index, void const *__addr) {
403 // CIR-LABEL: test_mm512_i64gather_pd
404 // CIR: cir.call_llvm_intrinsic "x86.avx512.mask.gather.qpd.512
405
406 // LLVM-LABEL: test_mm512_i64gather_pd
407 // LLVM: call <8 x double> @llvm.x86.avx512.mask.gather.qpd.512
408
409 // OGCG-LABEL: test_mm512_i64gather_pd
410 // OGCG: call <8 x double> @llvm.x86.avx512.mask.gather.qpd.512
411 return _mm512_i64gather_pd(__index, __addr, 2);
412 }
413
414 __m512d test_mm512_mask_i64gather_pd(__m512d __v1_old, __mmask8 __mask, __m512i __index, void const *__addr) {
415 // CIR-LABEL: test_mm512_mask_i64gather_pd
416 // CIR: cir.call_llvm_intrinsic "x86.avx512.mask.gather.qpd.512
417
418 // LLVM-LABEL: test_mm512_mask_i64gather_pd
419 // LLVM: call <8 x double> @llvm.x86.avx512.mask.gather.qpd.512
420
421 // OGCG-LABEL: test_mm512_mask_i64gather_pd
422 // OGCG: call <8 x double> @llvm.x86.avx512.mask.gather.qpd.512
423 return _mm512_mask_i64gather_pd(__v1_old, __mask, __index, __addr, 2);
424 }
425
426 __m512i test_mm512_i64gather_epi64(__m512i __index, void const *__addr) {
427 // CIR-LABEL: test_mm512_i64gather_epi64
428 // CIR: cir.call_llvm_intrinsic "x86.avx512.mask.gather.qpq.512
429
430 // LLVM-LABEL: test_mm512_i64gather_epi64
431 // LLVM: call <8 x i64> @llvm.x86.avx512.mask.gather.qpq.512
432
433 // OGCG-LABEL: test_mm512_i64gather_epi64
434 // OGCG: call <8 x i64> @llvm.x86.avx512.mask.gather.qpq.512
435 return _mm512_i64gather_epi64(__index, __addr, 2);
436 }
437
438 __m512i test_mm512_mask_i64gather_epi64(__m512i __v1_old, __mmask8 __mask, __m512i __index, void const *__addr) {
439 // CIR-LABEL: test_mm512_mask_i64gather_epi64
440 // CIR: cir.call_llvm_intrinsic "x86.avx512.mask.gather.qpq.512
441
442 // LLVM-LABEL: test_mm512_mask_i64gather_epi64
443 // LLVM: call <8 x i64> @llvm.x86.avx512.mask.gather.qpq.512
444
445 // OGCG-LABEL: test_mm512_mask_i64gather_epi64
446 // OGCG: call <8 x i64> @llvm.x86.avx512.mask.gather.qpq.512
447 return _mm512_mask_i64gather_epi64(__v1_old, __mask, __index, __addr, 2);
448 }
449
450 __m512 test_mm512_i32gather_ps(__m512i __index, void const *__addr) {
451 // CIR-LABEL: test_mm512_i32gather_ps
452 // CIR: cir.call_llvm_intrinsic "x86.avx512.mask.gather.dps.512
453
454 // LLVM-LABEL: test_mm512_i32gather_ps
455 // LLVM: call <16 x float> @llvm.x86.avx512.mask.gather.dps.512
456
457 // OGCG-LABEL: test_mm512_i32gather_ps
458 // OGCG: call <16 x float> @llvm.x86.avx512.mask.gather.dps.512
459 return _mm512_i32gather_ps(__index, __addr, 2);
460 }
461
462 __m512 test_mm512_mask_i32gather_ps(__m512 v1_old, __mmask16 __mask, __m512i __index, void const *__addr) {
463 // CIR-LABEL: test_mm512_mask_i32gather_ps
464 // CIR: cir.call_llvm_intrinsic "x86.avx512.mask.gather.dps.512
465
466 // LLVM-LABEL: test_mm512_mask_i32gather_ps
467 // LLVM: call <16 x float> @llvm.x86.avx512.mask.gather.dps.512
468
469 // OGCG-LABEL: test_mm512_mask_i32gather_ps
470 // OGCG: call <16 x float> @llvm.x86.avx512.mask.gather.dps.512
471 return _mm512_mask_i32gather_ps(v1_old, __mask, __index, __addr, 2);
472 }
473
474 __m512i test_mm512_i32gather_epi32(__m512i __index, void const *__addr) {
475 // CIR-LABEL: test_mm512_i32gather_epi32
476 // CIR: cir.call_llvm_intrinsic "x86.avx512.mask.gather.dpi.512
477
478 // LLVM-LABEL: test_mm512_i32gather_epi32
479 // LLVM: call <16 x i32> @llvm.x86.avx512.mask.gather.dpi.512
480
481 // OGCG-LABEL: test_mm512_i32gather_epi32
482 // OGCG: call <16 x i32> @llvm.x86.avx512.mask.gather.dpi.512
483 return _mm512_i32gather_epi32(__index, __addr, 2);
484 }
485
486 __m512i test_mm512_mask_i32gather_epi32(__m512i __v1_old, __mmask16 __mask, __m512i __index, void const *__addr) {
487 // CIR-LABEL: test_mm512_mask_i32gather_epi32
488 // CIR: cir.call_llvm_intrinsic "x86.avx512.mask.gather.dpi.512
489
490 // LLVM-LABEL: test_mm512_mask_i32gather_epi32
491 // LLVM: call <16 x i32> @llvm.x86.avx512.mask.gather.dpi.512
492
493 // OGCG-LABEL: test_mm512_mask_i32gather_epi32
494 // OGCG: call <16 x i32> @llvm.x86.avx512.mask.gather.dpi.512
495 return _mm512_mask_i32gather_epi32(__v1_old, __mask, __index, __addr, 2);
496 }
497
498 __m512d test_mm512_i32gather_pd(__m256i __index, void const *__addr) {
499 // CIR-LABEL: test_mm512_i32gather_pd
500 // CIR: cir.call_llvm_intrinsic "x86.avx512.mask.gather.dpd.512
501
502 // LLVM-LABEL: test_mm512_i32gather_pd
503 // LLVM: call <8 x double> @llvm.x86.avx512.mask.gather.dpd.512
504
505 // OGCG-LABEL: test_mm512_i32gather_pd
506 // OGCG: call <8 x double> @llvm.x86.avx512.mask.gather.dpd.512
507 return _mm512_i32gather_pd(__index, __addr, 2);
508 }
509
510 __m512d test_mm512_mask_i32gather_pd(__m512d __v1_old, __mmask8 __mask, __m256i __index, void const *__addr) {
511 // CIR-LABEL: test_mm512_mask_i32gather_pd
512 // CIR: cir.call_llvm_intrinsic "x86.avx512.mask.gather.dpd.512
513
514 // LLVM-LABEL: test_mm512_mask_i32gather_pd
515 // LLVM: call <8 x double> @llvm.x86.avx512.mask.gather.dpd.512
516
517 // OGCG-LABEL: test_mm512_mask_i32gather_pd
518 // OGCG: call <8 x double> @llvm.x86.avx512.mask.gather.dpd.512
519 return _mm512_mask_i32gather_pd(__v1_old, __mask, __index, __addr, 2);
520 }
521
522 __m512i test_mm512_i32gather_epi64(__m256i __index, void const *__addr) {
523 // CIR-LABEL: test_mm512_i32gather_epi64
524 // CIR: cir.call_llvm_intrinsic "x86.avx512.mask.gather.dpq.512
525
526 // LLVM-LABEL: test_mm512_i32gather_epi64
527 // LLVM: call <8 x i64> @llvm.x86.avx512.mask.gather.dpq.512
528
529 // OGCG-LABEL: test_mm512_i32gather_epi64
530 // OGCG: call <8 x i64> @llvm.x86.avx512.mask.gather.dpq.512
531 return _mm512_i32gather_epi64(__index, __addr, 2);
532 }
533
534 __m512i test_mm512_mask_i32gather_epi64(__m512i __v1_old, __mmask8 __mask, __m256i __index, void const *__addr) {
535 // CIR-LABEL: test_mm512_mask_i32gather_epi64
536 // CIR: cir.call_llvm_intrinsic "x86.avx512.mask.gather.dpq.512
537
538 // LLVM-LABEL: test_mm512_mask_i32gather_epi64
539 // LLVM: call <8 x i64> @llvm.x86.avx512.mask.gather.dpq.512
540
541 // OGCG-LABEL: test_mm512_mask_i32gather_epi64
542 // OGCG: call <8 x i64> @llvm.x86.avx512.mask.gather.dpq.512
543 return _mm512_mask_i32gather_epi64(__v1_old, __mask, __index, __addr, 2);
544 }
545
546 __m512i test_mm512_ror_epi32(__m512i __A) {
547 // CIR-LABEL: test_mm512_ror_epi32
548 // CIR: cir.vec.splat %{{.*}} : !u32i, !cir.vector<16 x !u32i>
549 // CIR: cir.call_llvm_intrinsic "fshr" %{{.*}}: (!cir.vector<16 x !s32i>, !cir.vector<16 x !s32i>, !cir.vector<16 x !u32i>) -> !cir.vector<16 x !s32i>
550
551 // LLVM-LABEL: test_mm512_ror_epi32
552 // LLVM: %[[CASTED_VAR:.*]] = bitcast <8 x i64> %{{.*}} to <16 x i32>
553 // LLVM: call <16 x i32> @llvm.fshr.v16i32(<16 x i32> %[[CASTED_VAR]], <16 x i32> %[[CASTED_VAR]], <16 x i32> splat (i32 5))
554
555 // OGCG-LABEL: test_mm512_ror_epi32
556 // OGCG: %[[CASTED_VAR:.*]] = bitcast <8 x i64> %{{.*}} to <16 x i32>
557 // OGCG: call <16 x i32> @llvm.fshr.v16i32(<16 x i32> %[[CASTED_VAR]], <16 x i32> %[[CASTED_VAR]], <16 x i32> splat (i32 5))
558 return _mm512_ror_epi32(__A, 5);
559 }
560
561 __m512i test_mm512_ror_epi64(__m512i __A) {
562 // CIR-LABEL: test_mm512_ror_epi64
563 // CIR: cir.vec.splat %{{.*}} : !u64i, !cir.vector<8 x !u64i>
564 // CIR: cir.call_llvm_intrinsic "fshr" %{{.*}}: (!cir.vector<8 x !s64i>, !cir.vector<8 x !s64i>, !cir.vector<8 x !u64i>) -> !cir.vector<8 x !s64i>
565
566 // LLVM-LABEL: test_mm512_ror_epi64
567 // LLVM: %[[VAR:.*]] = load <8 x i64>, ptr %{{.*}}, align 64
568 // LLVM: call <8 x i64> @llvm.fshr.v8i64(<8 x i64> %[[VAR]], <8 x i64> %[[VAR]], <8 x i64> splat (i64 5))
569
570 // OGCG-LABEL: test_mm512_ror_epi64
571 // OGCG: %[[VAR:.*]] = load <8 x i64>, ptr %{{.*}}, align 64
572 // OGCG: call <8 x i64> @llvm.fshr.v8i64(<8 x i64> %[[VAR]], <8 x i64> %[[VAR]], <8 x i64> splat (i64 5))
573 return _mm512_ror_epi64(__A, 5);
574 }
575
576 void test_mm512_i32scatter_pd(void *__addr, __m256i __index, __m512d __v1) {
577 // CIR-LABEL: test_mm512_i32scatter_pd
578 // CIR: cir.call_llvm_intrinsic "x86.avx512.mask.scatter.dpd.512"
579
580 // LLVM-LABEL: test_mm512_i32scatter_pd
581 // LLVM: @llvm.x86.avx512.mask.scatter.dpd.512
582
583 // OGCG-LABEL: test_mm512_i32scatter_pd
584 // OGCG: @llvm.x86.avx512.mask.scatter.dpd.512
585 return _mm512_i32scatter_pd(__addr, __index, __v1, 2);
586 }
587
588 void test_mm512_mask_i32scatter_pd(void *__addr, __mmask8 __mask, __m256i __index, __m512d __v1) {
589 // CIR-LABEL: test_mm512_mask_i32scatter_pd
590 // CIR: cir.call_llvm_intrinsic "x86.avx512.mask.scatter.dpd.512"
591
592 // LLVM-LABEL: test_mm512_mask_i32scatter_pd
593 // LLVM: @llvm.x86.avx512.mask.scatter.dpd.512
594
595 // OGCG-LABEL: test_mm512_mask_i32scatter_pd
596 // OGCG: @llvm.x86.avx512.mask.scatter.dpd.512
597 return _mm512_mask_i32scatter_pd(__addr, __mask, __index, __v1, 2);
598 }
599
600 void test_mm512_i32scatter_ps(void *__addr, __m512i __index, __m512 __v1) {
601 // CIR-LABEL: test_mm512_i32scatter_ps
602 // CIR: cir.call_llvm_intrinsic "x86.avx512.mask.scatter.dps.512"
603
604 // LLVM-LABEL: test_mm512_i32scatter_ps
605 // LLVM: @llvm.x86.avx512.mask.scatter.dps.512
606
607 // OGCG-LABEL: test_mm512_i32scatter_ps
608 // OGCG: @llvm.x86.avx512.mask.scatter.dps.512
609 return _mm512_i32scatter_ps(__addr, __index, __v1, 2);
610 }
611
612 void test_mm512_mask_i32scatter_ps(void *__addr, __mmask16 __mask, __m512i __index, __m512 __v1) {
613 // CIR-LABEL: test_mm512_mask_i32scatter_ps
614 // CIR: cir.call_llvm_intrinsic "x86.avx512.mask.scatter.dps.512"
615
616 // LLVM-LABEL: test_mm512_mask_i32scatter_ps
617 // LLVM: @llvm.x86.avx512.mask.scatter.dps.512
618
619 // OGCG-LABEL: test_mm512_mask_i32scatter_ps
620 // OGCG: @llvm.x86.avx512.mask.scatter.dps.512
621 return _mm512_mask_i32scatter_ps(__addr, __mask, __index, __v1, 2);
622 }
623
624 void test_mm512_i64scatter_pd(void *__addr, __m512i __index, __m512d __v1) {
625 // CIR-LABEL: test_mm512_i64scatter_pd
626 // CIR: cir.call_llvm_intrinsic "x86.avx512.mask.scatter.qpd.512"
627
628 // LLVM-LABEL: test_mm512_i64scatter_pd
629 // LLVM: @llvm.x86.avx512.mask.scatter.qpd.512
630
631 // OGCG-LABEL: test_mm512_i64scatter_pd
632 // OGCG: @llvm.x86.avx512.mask.scatter.qpd.512
633 return _mm512_i64scatter_pd(__addr, __index, __v1, 2);
634 }
635
636 void test_mm512_mask_i64scatter_pd(void *__addr, __mmask8 __mask, __m512i __index, __m512d __v1) {
637 // CIR-LABEL: test_mm512_mask_i64scatter_pd
638 // CIR: cir.call_llvm_intrinsic "x86.avx512.mask.scatter.qpd.512"
639
640 // LLVM-LABEL: test_mm512_mask_i64scatter_pd
641 // LLVM: @llvm.x86.avx512.mask.scatter.qpd.512
642
643 // OGCG-LABEL: test_mm512_mask_i64scatter_pd
644 // OGCG: @llvm.x86.avx512.mask.scatter.qpd.512
645 return _mm512_mask_i64scatter_pd(__addr, __mask, __index, __v1, 2);
646 }
647
648 void test_mm512_i64scatter_ps(void *__addr, __m512i __index, __m256 __v1) {
649 // CIR-LABEL: test_mm512_i64scatter_ps
650 // CIR: cir.call_llvm_intrinsic "x86.avx512.mask.scatter.qps.512"
651
652 // LLVM-LABEL: test_mm512_i64scatter_ps
653 // LLVM: @llvm.x86.avx512.mask.scatter.qps.512
654
655 // OGCG-LABEL: test_mm512_i64scatter_ps
656 // OGCG: @llvm.x86.avx512.mask.scatter.qps.512
657 return _mm512_i64scatter_ps(__addr, __index, __v1, 2);
658 }
659
660 void test_mm512_mask_i64scatter_ps(void *__addr, __mmask8 __mask, __m512i __index, __m256 __v1) {
661 // CIR-LABEL: test_mm512_mask_i64scatter_ps
662 // CIR: cir.call_llvm_intrinsic "x86.avx512.mask.scatter.qps.512"
663
664 // LLVM-LABEL: test_mm512_mask_i64scatter_ps
665 // LLVM: @llvm.x86.avx512.mask.scatter.qps.512
666
667 // OGCG-LABEL: test_mm512_mask_i64scatter_ps
668 // OGCG: @llvm.x86.avx512.mask.scatter.qps.512
669 return _mm512_mask_i64scatter_ps(__addr, __mask, __index, __v1, 2);
670 }
671
672 void test_mm512_i32scatter_epi32(void *__addr, __m512i __index, __m512i __v1) {
673 // CIR-LABEL: test_mm512_i32scatter_epi32
674 // CIR: cir.call_llvm_intrinsic "x86.avx512.mask.scatter.dpi.512"
675
676 // LLVM-LABEL: test_mm512_i32scatter_epi32
677 // LLVM: @llvm.x86.avx512.mask.scatter.dpi.512
678
679 // OGCG-LABEL: test_mm512_i32scatter_epi32
680 // OGCG: @llvm.x86.avx512.mask.scatter.dpi.512
681 return _mm512_i32scatter_epi32(__addr, __index, __v1, 2);
682 }
683
684 void test_mm512_mask_i32scatter_epi32(void *__addr, __mmask16 __mask, __m512i __index, __m512i __v1) {
685 // CIR-LABEL: test_mm512_mask_i32scatter_epi32
686 // CIR: cir.call_llvm_intrinsic "x86.avx512.mask.scatter.dpi.512"
687
688 // LLVM-LABEL: test_mm512_mask_i32scatter_epi32
689 // LLVM: @llvm.x86.avx512.mask.scatter.dpi.512
690
691 // OGCG-LABEL: test_mm512_mask_i32scatter_epi32
692 // OGCG: @llvm.x86.avx512.mask.scatter.dpi.512
693 return _mm512_mask_i32scatter_epi32(__addr, __mask, __index, __v1, 2);
694 }
695
696 void test_mm512_i64scatter_epi64(void *__addr, __m512i __index, __m512i __v1) {
697 // CIR-LABEL: test_mm512_i64scatter_epi64
698 // CIR: cir.call_llvm_intrinsic "x86.avx512.mask.scatter.qpq.512"
699
700 // LLVM-LABEL: test_mm512_i64scatter_epi64
701 // LLVM: @llvm.x86.avx512.mask.scatter.qpq.512
702
703 // OGCG-LABEL: test_mm512_i64scatter_epi64
704 // OGCG: @llvm.x86.avx512.mask.scatter.qpq.512
705 return _mm512_i64scatter_epi64(__addr, __index, __v1, 2);
706 }
707
708 void test_mm512_mask_i64scatter_epi64(void *__addr, __mmask8 __mask, __m512i __index, __m512i __v1) {
709 // CIR-LABEL: test_mm512_mask_i64scatter_epi64
710 // CIR: cir.call_llvm_intrinsic "x86.avx512.mask.scatter.qpq.512"
711
712 // LLVM-LABEL: test_mm512_mask_i64scatter_epi64
713 // LLVM: @llvm.x86.avx512.mask.scatter.qpq.512
714
715 // OGCG-LABEL: test_mm512_mask_i64scatter_epi64
716 // OGCG: @llvm.x86.avx512.mask.scatter.qpq.512
717 return _mm512_mask_i64scatter_epi64(__addr, __mask, __index, __v1, 2);
718 }
719
720 void test_mm512_i64scatter_epi32(void *__addr, __m512i __index, __m256i __v1) {
721 // CIR-LABEL: test_mm512_i64scatter_epi32
722 // CIR: cir.call_llvm_intrinsic "x86.avx512.mask.scatter.qpi.512"
723
724 // LLVM-LABEL: test_mm512_i64scatter_epi32
725 // LLVM: @llvm.x86.avx512.mask.scatter.qpi.512
726
727 // OGCG-LABEL: test_mm512_i64scatter_epi32
728 // OGCG: @llvm.x86.avx512.mask.scatter.qpi.512
729 return _mm512_i64scatter_epi32(__addr, __index, __v1, 2);
730 }
731
732 void test_mm512_mask_i64scatter_epi32(void *__addr, __mmask8 __mask, __m512i __index, __m256i __v1) {
733 // CIR-LABEL: test_mm512_mask_i64scatter_epi32
734 // CIR: cir.call_llvm_intrinsic "x86.avx512.mask.scatter.qpi.512"
735
736 // LLVM-LABEL: test_mm512_mask_i64scatter_epi32
737 // LLVM: @llvm.x86.avx512.mask.scatter.qpi.512
738
739 // OGCG-LABEL: test_mm512_mask_i64scatter_epi32
740 // OGCG: @llvm.x86.avx512.mask.scatter.qpi.512
741 return _mm512_mask_i64scatter_epi32(__addr, __mask, __index, __v1, 2);
742 }
743
744 __m256d test_mm512_extractf64x4_pd(__m512d a)
745 {
746 // CIR-LABEL: test_mm512_extractf64x4_pd
747 // CIR: [[POISON:%.*]] = cir.const #cir.poison : !cir.vector<8 x !cir.double>
748 // CIR: cir.vec.shuffle(%{{.*}}, [[POISON]] : !cir.vector<8 x !cir.double>) [#cir.int<4> : !s32i, #cir.int<5> : !s32i, #cir.int<6> : !s32i, #cir.int<7> : !s32i] : !cir.vector<4 x !cir.double>
749
750 // LLVM-LABEL: test_mm512_extractf64x4_pd
751 // LLVM: shufflevector <8 x double> %{{.*}}, <8 x double> poison, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
752
753 // OGCG-LABEL: test_mm512_extractf64x4_pd
754 // OGCG: shufflevector <8 x double> %{{.*}}, <8 x double> poison, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
755 return _mm512_extractf64x4_pd(a, 1);
756 }
757
758 __m256d test_mm512_mask_extractf64x4_pd(__m256d __W,__mmask8 __U,__m512d __A){
759 // CIR-LABEL: test_mm512_mask_extractf64x4_pd
760 // CIR: [[POISON:%.*]] = cir.const #cir.poison : !cir.vector<8 x !cir.double>
761 // CIR: [[FULL_VEC:%.*]] = cir.vec.shuffle(%{{.*}}, [[POISON]] : !cir.vector<8 x !cir.double>) [#cir.int<4> : !s32i, #cir.int<5> : !s32i, #cir.int<6> : !s32i, #cir.int<7> : !s32i] : !cir.vector<4 x !cir.double>
762 // CIR: [[MASK_VEC:%.*]] = cir.cast bitcast {{.*}} : !u8i -> !cir.vector<8 x !cir.int<s, 1>>
763 // CIR: [[FULL_MASK_VEC:%.*]] = cir.vec.shuffle([[MASK_VEC]], [[MASK_VEC]] : !cir.vector<8 x !cir.int<s, 1>>) [#cir.int<0> : !s32i, #cir.int<1> : !s32i, #cir.int<2> : !s32i, #cir.int<3> : !s32i] : !cir.vector<4 x !cir.int<s, 1>>
764 // CIR: cir.vec.ternary([[FULL_MASK_VEC]], [[FULL_VEC]], {{.*}}) : !cir.vector<4 x !cir.int<s, 1>>, !cir.vector<4 x !cir.double>
765
766 // LLVM-LABEL: test_mm512_mask_extractf64x4_pd
767 // LLVM: shufflevector <8 x double> %{{.*}}, <8 x double> poison, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
768 // LLVM: select <4 x i1> %{{.*}}, <4 x double> %{{.*}}, <4 x double> %{{.*}}
769
770 // OGCG-LABEL: test_mm512_mask_extractf64x4_pd
771 // OGCG: shufflevector <8 x double> %{{.*}}, <8 x double> poison, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
772 // OGCG: select <4 x i1> %{{.*}}, <4 x double> %{{.*}}, <4 x double> %{{.*}}
773 return _mm512_mask_extractf64x4_pd( __W, __U, __A, 1);
774 }
775
776 __m256d test_mm512_maskz_extractf64x4_pd(__mmask8 __U,__m512d __A){
777 // CIR-LABEL: test_mm512_maskz_extractf64x4_pd
778 // CIR: [[POISON:%.*]] = cir.const #cir.poison : !cir.vector<8 x !cir.double>
779 // CIR: [[FULL_VEC:%.*]] = cir.vec.shuffle(%{{.*}}, [[POISON]] : !cir.vector<8 x !cir.double>) [#cir.int<4> : !s32i, #cir.int<5> : !s32i, #cir.int<6> : !s32i, #cir.int<7> : !s32i] : !cir.vector<4 x !cir.double>
780 // CIR: [[MASK_VEC:%.*]] = cir.cast bitcast {{.*}} : !u8i -> !cir.vector<8 x !cir.int<s, 1>>
781 // CIR: [[FULL_MASK_VEC:%.*]] = cir.vec.shuffle([[MASK_VEC]], [[MASK_VEC]] : !cir.vector<8 x !cir.int<s, 1>>) [#cir.int<0> : !s32i, #cir.int<1> : !s32i, #cir.int<2> : !s32i, #cir.int<3> : !s32i] : !cir.vector<4 x !cir.int<s, 1>>
782 // CIR: cir.vec.ternary([[FULL_MASK_VEC]], [[FULL_VEC]], {{.*}}) : !cir.vector<4 x !cir.int<s, 1>>, !cir.vector<4 x !cir.double>
783
784 // LLVM-LABEL: test_mm512_maskz_extractf64x4_pd
785 // LLVM: shufflevector <8 x double> %{{.*}}, <8 x double> poison, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
786 // LLVM: select <4 x i1> %{{.*}}, <4 x double> %{{.*}}, <4 x double> %{{.*}}
787
788 // OGCG-LABEL: test_mm512_maskz_extractf64x4_pd
789 // OGCG: shufflevector <8 x double> %{{.*}}, <8 x double> poison, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
790 // OGCG: select <4 x i1> %{{.*}}, <4 x double> %{{.*}}, <4 x double> %{{.*}}
791 return _mm512_maskz_extractf64x4_pd( __U, __A, 1);
792 }
793
794 __m128 test_mm512_extractf32x4_ps(__m512 a)
795 {
796 // CIR-LABEL: test_mm512_extractf32x4_ps
797 // CIR: [[POISON:%.*]] = cir.const #cir.poison : !cir.vector<16 x !cir.float>
798 // CIR: cir.vec.shuffle(%{{.*}}, [[POISON]] : !cir.vector<16 x !cir.float>) [#cir.int<4> : !s32i, #cir.int<5> : !s32i, #cir.int<6> : !s32i, #cir.int<7> : !s32i] : !cir.vector<4 x !cir.float>
799
800 // LLVM-LABEL: test_mm512_extractf32x4_ps
801 // LLVM: shufflevector <16 x float> %{{.*}}, <16 x float> poison, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
802
803 // OGCG-LABEL: test_mm512_extractf32x4_ps
804 // OGCG: shufflevector <16 x float> %{{.*}}, <16 x float> poison, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
805 return _mm512_extractf32x4_ps(a, 1);
806 }
807
808 __m128 test_mm512_mask_extractf32x4_ps(__m128 __W, __mmask8 __U,__m512 __A){
809 // CIR-LABEL: test_mm512_mask_extractf32x4_ps
810 // CIR: [[POISON:%.*]] = cir.const #cir.poison : !cir.vector<16 x !cir.float>
811 // CIR: [[FULL_VEC:%.*]] = cir.vec.shuffle(%{{.*}}, [[POISON]] : !cir.vector<16 x !cir.float>) [#cir.int<4> : !s32i, #cir.int<5> : !s32i, #cir.int<6> : !s32i, #cir.int<7> : !s32i] : !cir.vector<4 x !cir.float>
812 // CIR: [[MASK_VEC:%.*]] = cir.cast bitcast {{.*}} : !u8i -> !cir.vector<8 x !cir.int<s, 1>>
813 // CIR: [[FULL_MASK_VEC:%.*]] = cir.vec.shuffle([[MASK_VEC]], [[MASK_VEC]] : !cir.vector<8 x !cir.int<s, 1>>) [#cir.int<0> : !s32i, #cir.int<1> : !s32i, #cir.int<2> : !s32i, #cir.int<3> : !s32i] : !cir.vector<4 x !cir.int<s, 1>>
814 // CIR: cir.vec.ternary([[FULL_MASK_VEC]], [[FULL_VEC]], {{.*}}) : !cir.vector<4 x !cir.int<s, 1>>, !cir.vector<4 x !cir.float>
815
816 // LLVM-LABEL: test_mm512_mask_extractf32x4_ps
817 // LLVM: shufflevector <16 x float> %{{.*}}, <16 x float> poison, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
818 // LLVM: select <4 x i1> %{{.*}}, <4 x float> %{{.*}}, <4 x float> %{{.*}}
819
820 // OGCG-LABEL: test_mm512_mask_extractf32x4_ps
821 // OGCG: shufflevector <16 x float> %{{.*}}, <16 x float> poison, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
822 // OGCG: select <4 x i1> %{{.*}}, <4 x float> %{{.*}}, <4 x float> %{{.*}}
823 return _mm512_mask_extractf32x4_ps( __W, __U, __A, 1);
824 }
825
826 __m128 test_mm512_maskz_extractf32x4_ps( __mmask8 __U,__m512 __A){
827 // CIR-LABEL: test_mm512_maskz_extractf32x4_ps
828 // CIR: [[POISON:%.*]] = cir.const #cir.poison : !cir.vector<16 x !cir.float>
829 // CIR: [[FULL_VEC:%.*]] = cir.vec.shuffle(%{{.*}}, [[POISON]] : !cir.vector<16 x !cir.float>) [#cir.int<4> : !s32i, #cir.int<5> : !s32i, #cir.int<6> : !s32i, #cir.int<7> : !s32i] : !cir.vector<4 x !cir.float>
830 // CIR: [[MASK_VEC:%.*]] = cir.cast bitcast {{.*}} : !u8i -> !cir.vector<8 x !cir.int<s, 1>>
831 // CIR: [[FULL_MASK_VEC:%.*]] = cir.vec.shuffle([[MASK_VEC]], [[MASK_VEC]] : !cir.vector<8 x !cir.int<s, 1>>) [#cir.int<0> : !s32i, #cir.int<1> : !s32i, #cir.int<2> : !s32i, #cir.int<3> : !s32i] : !cir.vector<4 x !cir.int<s, 1>>
832 // CIR: cir.vec.ternary([[FULL_MASK_VEC]], [[FULL_VEC]], {{.*}}) : !cir.vector<4 x !cir.int<s, 1>>, !cir.vector<4 x !cir.float>
833
834 // LLVM-LABEL: test_mm512_maskz_extractf32x4_ps
835 // LLVM: shufflevector <16 x float> %{{.*}}, <16 x float> poison, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
836 // LLVM: select <4 x i1> %{{.*}}, <4 x float> %{{.*}}, <4 x float> %{{.*}}
837
838 // OGCG-LABEL: test_mm512_maskz_extractf32x4_ps
839 // OGCG: shufflevector <16 x float> %{{.*}}, <16 x float> poison, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
840 // OGCG: select <4 x i1> %{{.*}}, <4 x float> %{{.*}}, <4 x float> %{{.*}}
841 return _mm512_maskz_extractf32x4_ps(__U, __A, 1);
842 }
843
844 __m128i test_mm512_extracti32x4_epi32(__m512i __A) {
845 // CIR-LABEL: test_mm512_extracti32x4_epi32
846 // CIR: [[POISON:%.*]] = cir.const #cir.poison : !cir.vector<16 x !s32i>
847 // CIR: [[FULL_VEC:%.*]] = cir.vec.shuffle(%{{.*}}, [[POISON]] : !cir.vector<16 x !s32i>) [#cir.int<12> : !s32i, #cir.int<13> : !s32i, #cir.int<14> : !s32i, #cir.int<15> : !s32i] : !cir.vector<4 x !s32i>
848 // CIR: [[MASK_VEC:%.*]] = cir.cast bitcast {{.*}} : !u8i -> !cir.vector<8 x !cir.int<s, 1>>
849 // CIR: [[FULL_MASK_VEC:%.*]] = cir.vec.shuffle([[MASK_VEC]], [[MASK_VEC]] : !cir.vector<8 x !cir.int<s, 1>>) [#cir.int<0> : !s32i, #cir.int<1> : !s32i, #cir.int<2> : !s32i, #cir.int<3> : !s32i] : !cir.vector<4 x !cir.int<s, 1>>
850 // CIR: cir.vec.ternary([[FULL_MASK_VEC]], [[FULL_VEC]], {{.*}}) : !cir.vector<4 x !cir.int<s, 1>>, !cir.vector<4 x !s32i>
851
852 // LLVM-LABEL: test_mm512_extracti32x4_epi32
853 // LLVM: shufflevector <16 x i32> %{{.*}}, <16 x i32> poison, <4 x i32> <i32 12, i32 13, i32 14, i32 15>
854
855 // OGCG-LABEL: test_mm512_extracti32x4_epi32
856 // OGCG: shufflevector <16 x i32> %{{.*}}, <16 x i32> poison, <4 x i32> <i32 12, i32 13, i32 14, i32 15>
857 return _mm512_extracti32x4_epi32(__A, 3);
858 }
859
860 __m128i test_mm512_mask_extracti32x4_epi32(__m128i __W, __mmask8 __U, __m512i __A) {
861 // CIR-LABEL: test_mm512_mask_extracti32x4_epi32
862 // CIR: [[POISON:%.*]] = cir.const #cir.poison : !cir.vector<16 x !s32i>
863 // CIR: [[FULL_VEC:%.*]] = cir.vec.shuffle(%{{.*}}, [[POISON]] : !cir.vector<16 x !s32i>) [#cir.int<12> : !s32i, #cir.int<13> : !s32i, #cir.int<14> : !s32i, #cir.int<15> : !s32i] : !cir.vector<4 x !s32i>
864 // CIR: [[MASK_VEC:%.*]] = cir.cast bitcast {{.*}} : !u8i -> !cir.vector<8 x !cir.int<s, 1>>
865 // CIR: [[FULL_MASK_VEC:%.*]] = cir.vec.shuffle([[MASK_VEC]], [[MASK_VEC]] : !cir.vector<8 x !cir.int<s, 1>>) [#cir.int<0> : !s32i, #cir.int<1> : !s32i, #cir.int<2> : !s32i, #cir.int<3> : !s32i] : !cir.vector<4 x !cir.int<s, 1>>
866 // CIR: cir.vec.ternary([[FULL_MASK_VEC]], [[FULL_VEC]], {{.*}}) : !cir.vector<4 x !cir.int<s, 1>>, !cir.vector<4 x !s32i>
867
868 // LLVM-LABEL: test_mm512_mask_extracti32x4_epi32
869 // LLVM: shufflevector <16 x i32> %{{.*}}, <16 x i32> poison, <4 x i32> <i32 12, i32 13, i32 14, i32 15>
870 // LLVM: select <4 x i1> %{{.*}}, <4 x i32> %{{.*}}, <4 x i32> %{{.*}}
871
872 // OGCG-LABEL: test_mm512_mask_extracti32x4_epi32
873 // OGCG: shufflevector <16 x i32> %{{.*}}, <16 x i32> poison, <4 x i32> <i32 12, i32 13, i32 14, i32 15>
874 // OGCG: select <4 x i1> %{{.*}}, <4 x i32> %{{.*}}, <4 x i32> %{{.*}}
875 return _mm512_mask_extracti32x4_epi32(__W, __U, __A, 3);
876 }
877
878 __m128i test_mm512_maskz_extracti32x4_epi32(__mmask8 __U, __m512i __A) {
879 // CIR-LABEL: test_mm512_maskz_extracti32x4_epi32
880 // CIR: [[POISON:%.*]] = cir.const #cir.poison : !cir.vector<16 x !s32i>
881 // CIR: [[FULL_VEC:%.*]] = cir.vec.shuffle(%{{.*}}, [[POISON]] : !cir.vector<16 x !s32i>) [#cir.int<12> : !s32i, #cir.int<13> : !s32i, #cir.int<14> : !s32i, #cir.int<15> : !s32i] : !cir.vector<4 x !s32i>
882 // CIR: [[MASK_VEC:%.*]] = cir.cast bitcast {{.*}} : !u8i -> !cir.vector<8 x !cir.int<s, 1>>
883 // CIR: [[FULL_MASK_VEC:%.*]] = cir.vec.shuffle([[MASK_VEC]], [[MASK_VEC]] : !cir.vector<8 x !cir.int<s, 1>>) [#cir.int<0> : !s32i, #cir.int<1> : !s32i, #cir.int<2> : !s32i, #cir.int<3> : !s32i] : !cir.vector<4 x !cir.int<s, 1>>
884 // CIR: cir.vec.ternary([[FULL_MASK_VEC]], [[FULL_VEC]], {{.*}}) : !cir.vector<4 x !cir.int<s, 1>>, !cir.vector<4 x !s32i>
885
886 // LLVM-LABEL: test_mm512_maskz_extracti32x4_epi32
887 // LLVM: shufflevector <16 x i32> %{{.*}}, <16 x i32> poison, <4 x i32> <i32 12, i32 13, i32 14, i32 15>
888 // LLVM: select <4 x i1> %{{.*}}, <4 x i32> %{{.*}}, <4 x i32> %{{.*}}
889
890 // OGCG-LABEL: test_mm512_maskz_extracti32x4_epi32
891 // OGCG: shufflevector <16 x i32> %{{.*}}, <16 x i32> poison, <4 x i32> <i32 12, i32 13, i32 14, i32 15>
892 // OGCG: select <4 x i1> %{{.*}}, <4 x i32> %{{.*}}, <4 x i32> %{{.*}}
893 return _mm512_maskz_extracti32x4_epi32(__U, __A, 3);
894 }
895
896 __m256i test_mm512_extracti64x4_epi64(__m512i __A) {
897 // CIR-LABEL: test_mm512_extracti64x4_epi64
898 // CIR: [[POISON:%.*]] = cir.const #cir.poison : !cir.vector<8 x !s64i>
899 // CIR: [[FULL_VEC:%.*]] = cir.vec.shuffle(%{{.*}}, [[POISON]] : !cir.vector<8 x !s64i>) [#cir.int<4> : !s32i, #cir.int<5> : !s32i, #cir.int<6> : !s32i, #cir.int<7> : !s32i] : !cir.vector<4 x !s64i>
900 // CIR: [[MASK_VEC:%.*]] = cir.cast bitcast {{.*}} : !u8i -> !cir.vector<8 x !cir.int<s, 1>>
901 // CIR: [[FULL_MASK_VEC:%.*]] = cir.vec.shuffle([[MASK_VEC]], [[MASK_VEC]] : !cir.vector<8 x !cir.int<s, 1>>) [#cir.int<0> : !s32i, #cir.int<1> : !s32i, #cir.int<2> : !s32i, #cir.int<3> : !s32i] : !cir.vector<4 x !cir.int<s, 1>>
902 // CIR: cir.vec.ternary([[FULL_MASK_VEC]], [[FULL_VEC]], {{.*}}) : !cir.vector<4 x !cir.int<s, 1>>, !cir.vector<4 x !s64i>
903
904 // LLVM-LABEL: test_mm512_extracti64x4_epi64
905 // LLVM: shufflevector <8 x i64> %{{.*}}, <8 x i64> poison, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
906
907 // OGCG-LABEL: test_mm512_extracti64x4_epi64
908 // OGCG: shufflevector <8 x i64> %{{.*}}, <8 x i64> poison, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
909 return _mm512_extracti64x4_epi64(__A, 1);
910 }
911
912 __m256i test_mm512_mask_extracti64x4_epi64(__m256i __W, __mmask8 __U, __m512i __A) {
913 // CIR-LABEL: test_mm512_mask_extracti64x4_epi64
914 // CIR: [[POISON:%.*]] = cir.const #cir.poison : !cir.vector<8 x !s64i>
915 // CIR: [[FULL_VEC:%.*]] = cir.vec.shuffle(%{{.*}}, [[POISON]] : !cir.vector<8 x !s64i>) [#cir.int<4> : !s32i, #cir.int<5> : !s32i, #cir.int<6> : !s32i, #cir.int<7> : !s32i] : !cir.vector<4 x !s64i>
916 // CIR: [[MASK_VEC:%.*]] = cir.cast bitcast {{.*}} : !u8i -> !cir.vector<8 x !cir.int<s, 1>>
917 // CIR: [[FULL_MASK_VEC:%.*]] = cir.vec.shuffle([[MASK_VEC]], [[MASK_VEC]] : !cir.vector<8 x !cir.int<s, 1>>) [#cir.int<0> : !s32i, #cir.int<1> : !s32i, #cir.int<2> : !s32i, #cir.int<3> : !s32i] : !cir.vector<4 x !cir.int<s, 1>>
918 // CIR: cir.vec.ternary([[FULL_MASK_VEC]], [[FULL_VEC]], {{.*}}) : !cir.vector<4 x !cir.int<s, 1>>, !cir.vector<4 x !s64i>
919
920 // LLVM-LABEL: test_mm512_mask_extracti64x4_epi64
921 // LLVM: shufflevector <8 x i64> %{{.*}}, <8 x i64> poison, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
922 // LLVM: select <4 x i1> %{{.*}}, <4 x i64> %{{.*}}, <4 x i64> %{{.*}}
923
924 // OGCG-LABEL: test_mm512_mask_extracti64x4_epi64
925 // OGCG: shufflevector <8 x i64> %{{.*}}, <8 x i64> poison, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
926 // OGCG: select <4 x i1> %{{.*}}, <4 x i64> %{{.*}}, <4 x i64> %{{.*}}
927 return _mm512_mask_extracti64x4_epi64(__W, __U, __A, 1);
928 }
929
930 __m256i test_mm512_maskz_extracti64x4_epi64(__mmask8 __U, __m512i __A) {
931 // CIR-LABEL: test_mm512_maskz_extracti64x4_epi64
932 // CIR: [[POISON:%.*]] = cir.const #cir.poison : !cir.vector<8 x !s64i>
933 // CIR: [[FULL_VEC:%.*]] = cir.vec.shuffle(%{{.*}}, [[POISON]] : !cir.vector<8 x !s64i>) [#cir.int<4> : !s32i, #cir.int<5> : !s32i, #cir.int<6> : !s32i, #cir.int<7> : !s32i] : !cir.vector<4 x !s64i>
934 // CIR: [[MASK_VEC:%.*]] = cir.cast bitcast {{.*}} : !u8i -> !cir.vector<8 x !cir.int<s, 1>>
935 // CIR: [[FULL_MASK_VEC:%.*]] = cir.vec.shuffle([[MASK_VEC]], [[MASK_VEC]] : !cir.vector<8 x !cir.int<s, 1>>) [#cir.int<0> : !s32i, #cir.int<1> : !s32i, #cir.int<2> : !s32i, #cir.int<3> : !s32i] : !cir.vector<4 x !cir.int<s, 1>>
936 // CIR: cir.vec.ternary([[FULL_MASK_VEC]], [[FULL_VEC]], {{.*}}) : !cir.vector<4 x !cir.int<s, 1>>, !cir.vector<4 x !s64i>
937
938 // LLVM-LABEL: test_mm512_maskz_extracti64x4_epi64
939 // LLVM: shufflevector <8 x i64> %{{.*}}, <8 x i64> poison, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
940 // LLVM: select <4 x i1> %{{.*}}, <4 x i64> %{{.*}}, <4 x i64> %{{.*}}
941
942 // OGCG-LABEL: test_mm512_maskz_extracti64x4_epi64
943 // OGCG: shufflevector <8 x i64> %{{.*}}, <8 x i64> poison, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
944 // OGCG: select <4 x i1> %{{.*}}, <4 x i64> %{{.*}}, <4 x i64> %{{.*}}
945 return _mm512_maskz_extracti64x4_epi64(__U, __A, 1);
946 }
947
948 __m512i test_mm512_mul_epi32(__m512i __A, __m512i __B) {
949 // CIR-LABEL: _mm512_mul_epi32
950 // CIR: [[A64:%.*]] = cir.cast bitcast %{{.*}} : !cir.vector<16 x !s32i> -> !cir.vector<8 x !s64i>
951 // CIR: [[B64:%.*]] = cir.cast bitcast %{{.*}} : !cir.vector<16 x !s32i> -> !cir.vector<8 x !s64i>
952 // CIR: [[SC:%.*]] = cir.const #cir.int<32> : !s64i
953 // CIR: [[SV:%.*]] = cir.vec.splat [[SC]] : !s64i, !cir.vector<8 x !s64i>
954 // CIR: [[SHL_A:%.*]] = cir.shift(left, [[A64]] : !cir.vector<8 x !s64i>, [[SV]] : !cir.vector<8 x !s64i>)
955 // CIR: [[ASHR_A:%.*]] = cir.shift(right, [[SHL_A]] : !cir.vector<8 x !s64i>, [[SV]] : !cir.vector<8 x !s64i>)
956 // CIR: [[SHL_B:%.*]] = cir.shift(left, [[B64]] : !cir.vector<8 x !s64i>, [[SV]] : !cir.vector<8 x !s64i>)
957 // CIR: [[ASHR_B:%.*]] = cir.shift(right, [[SHL_B]] : !cir.vector<8 x !s64i>, [[SV]] : !cir.vector<8 x !s64i>)
958 // CIR: [[MUL:%.*]] = cir.binop(mul, [[ASHR_A]], [[ASHR_B]])
959
960 // LLVM-LABEL: _mm512_mul_epi32
961 // LLVM: shl <8 x i64> %{{.*}}, splat (i64 32)
962 // LLVM: ashr <8 x i64> %{{.*}}, splat (i64 32)
963 // LLVM: shl <8 x i64> %{{.*}}, splat (i64 32)
964 // LLVM: ashr <8 x i64> %{{.*}}, splat (i64 32)
965 // LLVM: mul <8 x i64> %{{.*}}, %{{.*}}
966
967 // OGCG-LABEL: _mm512_mul_epi32
968 // OGCG: shl <8 x i64> %{{.*}}, splat (i64 32)
969 // OGCG: ashr <8 x i64> %{{.*}}, splat (i64 32)
970 // OGCG: shl <8 x i64> %{{.*}}, splat (i64 32)
971 // OGCG: ashr <8 x i64> %{{.*}}, splat (i64 32)
972 // OGCG: mul <8 x i64> %{{.*}}, %{{.*}}
973
974 return _mm512_mul_epi32(__A, __B);
975 }
976
977 __m512i test_mm512_mul_epu32(__m512i __A, __m512i __B) {
978 // CIR-LABEL: _mm512_mul_epu32
979 // CIR: [[BC_A:%.*]] = cir.cast bitcast %{{.*}} : {{.*}} -> !cir.vector<8 x !s64i>
980 // CIR: [[BC_B:%.*]] = cir.cast bitcast %{{.*}} : {{.*}} -> !cir.vector<8 x !s64i>
981 // CIR: [[MASK_SCALAR:%.*]] = cir.const #cir.int<4294967295> : !s64i
982 // CIR: [[MASK_VEC:%.*]] = cir.vec.splat [[MASK_SCALAR]] : !s64i, !cir.vector<8 x !s64i>
983 // CIR: [[AND_A:%.*]] = cir.binop(and, [[BC_A]], [[MASK_VEC]])
984 // CIR: [[AND_B:%.*]] = cir.binop(and, [[BC_B]], [[MASK_VEC]])
985 // CIR: [[MUL:%.*]] = cir.binop(mul, [[AND_A]], [[AND_B]])
986
987 // LLVM-LABEL: _mm512_mul_epu32
988 // LLVM: and <8 x i64> %{{.*}}, splat (i64 4294967295)
989 // LLVM: and <8 x i64> %{{.*}}, splat (i64 4294967295)
990 // LLVM: mul <8 x i64> %{{.*}}, %{{.*}}
991
992 // OGCG-LABEL: _mm512_mul_epu32
993 // OGCG: and <8 x i64> %{{.*}}, splat (i64 4294967295)
994 // OGCG: and <8 x i64> %{{.*}}, splat (i64 4294967295)
995 // OGCG: mul <8 x i64> %{{.*}}, %{{.*}}
996
997 return _mm512_mul_epu32(__A, __B);
998 }
999
1000 int test_mm512_kortestc(__mmask16 __A, __mmask16 __B) {
1001 // CIR-LABEL: _mm512_kortestc
1002 // CIR: %[[ALL_ONES:.*]] = cir.const #cir.int<65535> : !u16i
1003 // CIR: %[[LHS:.*]] = cir.cast bitcast {{.*}} : !u16i -> !cir.vector<16 x !cir.int<s, 1>>
1004 // CIR: %[[RHS:.*]] = cir.cast bitcast {{.*}} : !u16i -> !cir.vector<16 x !cir.int<s, 1>>
1005 // CIR: %[[OR:.*]] = cir.binop(or, %[[LHS]], %[[RHS]]) : !cir.vector<16 x !cir.int<s, 1>>
1006 // CIR: %[[OR_INT:.*]] = cir.cast bitcast %[[OR]] : !cir.vector<16 x !cir.int<s, 1>> -> !u16i
1007 // CIR: %[[CMP:.*]] = cir.cmp(eq, %[[OR_INT]], %[[ALL_ONES]]) : !u16i, !cir.bool
1008 // CIR: cir.cast bool_to_int %[[CMP]] : !cir.bool -> !s32i
1009
1010 // LLVM-LABEL: _mm512_kortestc
1011 // LLVM: %[[LHS:.*]] = bitcast i16 %{{.*}} to <16 x i1>
1012 // LLVM: %[[RHS:.*]] = bitcast i16 %{{.*}} to <16 x i1>
1013 // LLVM: %[[OR:.*]] = or <16 x i1> %[[LHS]], %[[RHS]]
1014 // LLVM: %[[CAST:.*]] = bitcast <16 x i1> %[[OR]] to i16
1015 // LLVM: %[[CMP:.*]] = icmp eq i16 %[[CAST]], -1
1016 // LLVM: zext i1 %[[CMP]] to i32
1017
1018 // OGCG-LABEL: _mm512_kortestc
1019 // OGCG: %[[LHS:.*]] = bitcast i16 %{{.*}} to <16 x i1>
1020 // OGCG: %[[RHS:.*]] = bitcast i16 %{{.*}} to <16 x i1>
1021 // OGCG: %[[OR:.*]] = or <16 x i1> %[[LHS]], %[[RHS]]
1022 // OGCG: %[[CAST:.*]] = bitcast <16 x i1> %[[OR]] to i16
1023 // OGCG: %[[CMP:.*]] = icmp eq i16 %[[CAST]], -1
1024 // OGCG: zext i1 %[[CMP]] to i32
1025 return _mm512_kortestc(__A,__B);
1026 }
1027
1028
1029 int test_mm512_kortestz(__mmask16 __A, __mmask16 __B) {
1030 // CIR-LABEL: _mm512_kortestz
1031 // CIR: %[[ZERO:.*]] = cir.const #cir.int<0> : !u16i
1032 // CIR: %[[LHS:.*]] = cir.cast bitcast {{.*}} : !u16i -> !cir.vector<16 x !cir.int<s, 1>>
1033 // CIR: %[[RHS:.*]] = cir.cast bitcast {{.*}} : !u16i -> !cir.vector<16 x !cir.int<s, 1>>
1034 // CIR: %[[OR:.*]] = cir.binop(or, %[[LHS]], %[[RHS]]) : !cir.vector<16 x !cir.int<s, 1>>
1035 // CIR: %[[OR_INT:.*]] = cir.cast bitcast %[[OR]] : !cir.vector<16 x !cir.int<s, 1>> -> !u16i
1036 // CIR: %[[CMP:.*]] = cir.cmp(eq, %[[OR_INT]], %[[ZERO]]) : !u16i, !cir.bool
1037 // CIR: cir.cast bool_to_int %[[CMP]] : !cir.bool -> !s32i
1038
1039 // LLVM-LABEL: _mm512_kortestz
1040 // LLVM: %[[LHS:.*]] = bitcast i16 %{{.*}} to <16 x i1>
1041 // LLVM: %[[RHS:.*]] = bitcast i16 %{{.*}} to <16 x i1>
1042 // LLVM: %[[OR:.*]] = or <16 x i1> %[[LHS]], %[[RHS]]
1043 // LLVM: %[[CAST:.*]] = bitcast <16 x i1> %[[OR]] to i16
1044 // LLVM: %[[CMP:.*]] = icmp eq i16 %[[CAST]], 0
1045 // LLVM: zext i1 %[[CMP]] to i32
1046
1047 // OGCG-LABEL: _mm512_kortestz
1048 // OGCG: %[[LHS:.*]] = bitcast i16 %{{.*}} to <16 x i1>
1049 // OGCG: %[[RHS:.*]] = bitcast i16 %{{.*}} to <16 x i1>
1050 // OGCG: %[[OR:.*]] = or <16 x i1> %[[LHS]], %[[RHS]]
1051 // OGCG: %[[CAST:.*]] = bitcast <16 x i1> %[[OR]] to i16
1052 // OGCG: %[[CMP:.*]] = icmp eq i16 %[[CAST]], 0
1053 // OGCG: zext i1 %[[CMP]] to i32
1054 return _mm512_kortestz(__A,__B);
1055 }
1056
1057 __m256i test_mm512_cvtepi64_epi32(__m512i __A) {
1058 // CIR-LABEL: test_mm512_cvtepi64_epi32
1059 // CIR: %[[TRUNC:.*]] = cir.cast integral {{.*}} : !cir.vector<8 x !s64i> -> !cir.vector<8 x !s32i>
1060 // CIR: %[[RETBC:.*]] = cir.cast bitcast {{.*}} : !cir.vector<8 x !s32i> -> !cir.vector<4 x !s64i>
1061 // CIR: cir.store %[[RETBC]], %[[RETPTR:.*]] : !cir.vector<4 x !s64i>, !cir.ptr<!cir.vector<4 x !s64i>>
1062 // CIR: %[[RETLOAD:.*]] = cir.load %[[RETPTR]] : !cir.ptr<!cir.vector<4 x !s64i>>, !cir.vector<4 x !s64i>
1063 // CIR: cir.return %[[RETLOAD]] : !cir.vector<4 x !s64i>
1064
1065 // LLVM-LABEL: test_mm512_cvtepi64_epi32
1066 // LLVM: %[[TRUNC:.*]] = trunc <8 x i64> %{{.*}} to <8 x i32>
1067 // LLVM: bitcast <8 x i32> %[[TRUNC]] to <4 x i64>
1068
1069 // OGCG-LABEL: test_mm512_cvtepi64_epi32
1070 // OGCG: %[[TRUNC:.*]] = trunc <8 x i64> %{{.*}} to <8 x i32>
1071 // OGCG: bitcast <8 x i32> %[[TRUNC]] to <4 x i64>
1072 return _mm512_cvtepi64_epi32(__A);
1073 }
1074
1075 __m256i test_mm512_mask_cvtepi64_epi32(__m256i __O, __mmask8 __M, __m512i __A) {
1076 // CIR-LABEL: test_mm512_mask_cvtepi64_epi32
1077 // CIR: %[[TRUNC:.*]] = cir.cast integral {{.*}} : !cir.vector<8 x !s64i> -> !cir.vector<8 x !s32i>
1078 // CIR: %[[MASK_VEC:.*]] = cir.cast bitcast {{.*}} : !u8i -> !cir.vector<8 x !cir.int<s, 1>>
1079 // CIR: %[[TER:.*]] = cir.vec.ternary(%[[MASK_VEC]], %[[TRUNC]], {{.*}}) : !cir.vector<8 x !cir.int<s, 1>>, !cir.vector<8 x !s32i>
1080 // CIR: %[[RETBC:.*]] = cir.cast bitcast %[[TER]] : !cir.vector<8 x !s32i> -> !cir.vector<4 x !s64i>
1081 // CIR: cir.store %[[RETBC]], %[[RETPTR:.*]] : !cir.vector<4 x !s64i>, !cir.ptr<!cir.vector<4 x !s64i>>
1082 // CIR: %[[RETLOAD:.*]] = cir.load %[[RETPTR]] : !cir.ptr<!cir.vector<4 x !s64i>>, !cir.vector<4 x !s64i>
1083 // CIR: cir.return %[[RETLOAD]] : !cir.vector<4 x !s64i>
1084
1085 // LLVM-LABEL: test_mm512_mask_cvtepi64_epi32
1086 // LLVM: %[[TRUNC:.*]] = trunc <8 x i64> %{{.*}} to <8 x i32>
1087 // LLVM: %[[MASK_VEC:.*]] = bitcast i8 %{{.*}} to <8 x i1>
1088 // LLVM: %[[SEL:.*]] = select <8 x i1> %[[MASK_VEC]], <8 x i32> %[[TRUNC]], <8 x i32> %{{.*}}
1089 // LLVM: bitcast <8 x i32> %[[SEL]] to <4 x i64>
1090
1091 // OGCG-LABEL: test_mm512_mask_cvtepi64_epi32
1092 // OGCG: %[[TRUNC:.*]] = trunc <8 x i64> %{{.*}} to <8 x i32>
1093 // OGCG: %[[MASK_VEC:.*]] = bitcast i8 %{{.*}} to <8 x i1>
1094 // OGCG: %[[SEL:.*]] = select <8 x i1> %[[MASK_VEC]], <8 x i32> %[[TRUNC]], <8 x i32> %{{.*}}
1095 // OGCG: bitcast <8 x i32> %[[SEL]] to <4 x i64>
1096 return _mm512_mask_cvtepi64_epi32(__O, __M, __A);
1097 }
1098
1099 __m256i test_mm512_maskz_cvtepi64_epi32(__mmask8 __M, __m512i __A) {
1100 // CIR-LABEL: test_mm512_maskz_cvtepi64_epi32
1101 // CIR: %[[CALL:.*]] = cir.call {{.*}} : (!u8i, !cir.vector<8 x !s64i>) -> !cir.vector<4 x !s64i>
1102 // CIR: cir.store %[[CALL]], %[[RETPTR:.*]] : !cir.vector<4 x !s64i>, !cir.ptr<!cir.vector<4 x !s64i>>
1103 // CIR: %[[RETLOAD:.*]] = cir.load %[[RETPTR]] : !cir.ptr<!cir.vector<4 x !s64i>>, !cir.vector<4 x !s64i>
1104 // CIR: cir.return %[[RETLOAD]] : !cir.vector<4 x !s64i>
1105
1106 // LLVM-LABEL: test_mm512_maskz_cvtepi64_epi32
1107 // LLVM: %[[TRUNC:.*]] = trunc <8 x i64> %{{.*}} to <8 x i32>
1108 // LLVM: %[[MASK_VEC:.*]] = bitcast i8 %{{.*}} to <8 x i1>
1109 // LLVM: %[[SEL:.*]] = select <8 x i1> %[[MASK_VEC]], <8 x i32> %[[TRUNC]], <8 x i32> {{.*}}
1110 // LLVM: bitcast <8 x i32> %[[SEL]] to <4 x i64>
1111
1112 // OGCG-LABEL: test_mm512_maskz_cvtepi64_epi32
1113 // OGCG: %[[TRUNC:.*]] = trunc <8 x i64> %{{.*}} to <8 x i32>
1114 // OGCG: %[[MASK_VEC:.*]] = bitcast i8 %{{.*}} to <8 x i1>
1115 // OGCG: %[[SEL:.*]] = select <8 x i1> %[[MASK_VEC]], <8 x i32> %[[TRUNC]], <8 x i32> {{.*}}
1116 // OGCG: bitcast <8 x i32> %[[SEL]] to <4 x i64>
1117 return _mm512_maskz_cvtepi64_epi32(__M, __A);
1118 }