1 ; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=knl | FileCheck %s --check-prefix=KNL
2 ; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=skx | FileCheck %s --check-prefix=SKX
4 attributes #0 = { nounwind }
6 ; KNL-LABEL: trunc_16x32_to_16x8
9 define <16 x i8> @trunc_16x32_to_16x8(<16 x i32> %i) #0 {
10 %x = trunc <16 x i32> %i to <16 x i8>
14 ; KNL-LABEL: trunc_8x64_to_8x16
17 define <8 x i16> @trunc_8x64_to_8x16(<8 x i64> %i) #0 {
18 %x = trunc <8 x i64> %i to <8 x i16>
22 ; KNL-LABEL: trunc_v16i32_to_v16i16
25 define <16 x i16> @trunc_v16i32_to_v16i16(<16 x i32> %x) #0 {
26 %1 = trunc <16 x i32> %x to <16 x i16>
30 define <8 x i8> @trunc_qb_512(<8 x i64> %i) #0 {
31 ; SKX-LABEL: trunc_qb_512:
33 ; SKX-NEXT: vpmovqw %zmm0, %xmm0
35 %x = trunc <8 x i64> %i to <8 x i8>
39 define void @trunc_qb_512_mem(<8 x i64> %i, <8 x i8>* %res) #0 {
40 ; SKX-LABEL: trunc_qb_512_mem:
42 ; SKX-NEXT: vpmovqb %zmm0, (%rdi)
44 %x = trunc <8 x i64> %i to <8 x i8>
45 store <8 x i8> %x, <8 x i8>* %res
49 define <4 x i8> @trunc_qb_256(<4 x i64> %i) #0 {
50 ; SKX-LABEL: trunc_qb_256:
52 ; SKX-NEXT: vpmovqd %ymm0, %xmm0
54 %x = trunc <4 x i64> %i to <4 x i8>
58 define void @trunc_qb_256_mem(<4 x i64> %i, <4 x i8>* %res) #0 {
59 ; SKX-LABEL: trunc_qb_256_mem:
61 ; SKX-NEXT: vpmovqb %ymm0, (%rdi)
63 %x = trunc <4 x i64> %i to <4 x i8>
64 store <4 x i8> %x, <4 x i8>* %res
68 define <2 x i8> @trunc_qb_128(<2 x i64> %i) #0 {
69 ; SKX-LABEL: trunc_qb_128:
72 %x = trunc <2 x i64> %i to <2 x i8>
76 define void @trunc_qb_128_mem(<2 x i64> %i, <2 x i8>* %res) #0 {
77 ; SKX-LABEL: trunc_qb_128_mem:
79 ; SKX-NEXT: vpmovqb %xmm0, (%rdi)
81 %x = trunc <2 x i64> %i to <2 x i8>
82 store <2 x i8> %x, <2 x i8>* %res
86 define <8 x i16> @trunc_qw_512(<8 x i64> %i) #0 {
87 ; SKX-LABEL: trunc_qw_512:
89 ; SKX-NEXT: vpmovqw %zmm0, %xmm0
91 %x = trunc <8 x i64> %i to <8 x i16>
95 define void @trunc_qw_512_mem(<8 x i64> %i, <8 x i16>* %res) #0 {
96 ; SKX-LABEL: trunc_qw_512_mem:
98 ; SKX-NEXT: vpmovqw %zmm0, (%rdi)
100 %x = trunc <8 x i64> %i to <8 x i16>
101 store <8 x i16> %x, <8 x i16>* %res
105 define <4 x i16> @trunc_qw_256(<4 x i64> %i) #0 {
106 ; SKX-LABEL: trunc_qw_256:
108 ; SKX-NEXT: vpmovqd %ymm0, %xmm0
110 %x = trunc <4 x i64> %i to <4 x i16>
114 define void @trunc_qw_256_mem(<4 x i64> %i, <4 x i16>* %res) #0 {
115 ; SKX-LABEL: trunc_qw_256_mem:
117 ; SKX-NEXT: vpmovqw %ymm0, (%rdi)
119 %x = trunc <4 x i64> %i to <4 x i16>
120 store <4 x i16> %x, <4 x i16>* %res
124 define <2 x i16> @trunc_qw_128(<2 x i64> %i) #0 {
125 ; SKX-LABEL: trunc_qw_128:
128 %x = trunc <2 x i64> %i to <2 x i16>
132 define void @trunc_qw_128_mem(<2 x i64> %i, <2 x i16>* %res) #0 {
133 ; SKX-LABEL: trunc_qw_128_mem:
135 ; SKX-NEXT: vpmovqw %xmm0, (%rdi)
137 %x = trunc <2 x i64> %i to <2 x i16>
138 store <2 x i16> %x, <2 x i16>* %res
142 define <8 x i32> @trunc_qd_512(<8 x i64> %i) #0 {
143 ; SKX-LABEL: trunc_qd_512:
145 ; SKX-NEXT: vpmovqd %zmm0, %ymm0
147 %x = trunc <8 x i64> %i to <8 x i32>
151 define void @trunc_qd_512_mem(<8 x i64> %i, <8 x i32>* %res) #0 {
152 ; SKX-LABEL: trunc_qd_512_mem:
154 ; SKX-NEXT: vpmovqd %zmm0, (%rdi)
156 %x = trunc <8 x i64> %i to <8 x i32>
157 store <8 x i32> %x, <8 x i32>* %res
161 define <4 x i32> @trunc_qd_256(<4 x i64> %i) #0 {
162 ; SKX-LABEL: trunc_qd_256:
164 ; SKX-NEXT: vpmovqd %ymm0, %xmm0
166 %x = trunc <4 x i64> %i to <4 x i32>
170 define void @trunc_qd_256_mem(<4 x i64> %i, <4 x i32>* %res) #0 {
171 ; SKX-LABEL: trunc_qd_256_mem:
173 ; SKX-NEXT: vpmovqd %ymm0, (%rdi)
175 %x = trunc <4 x i64> %i to <4 x i32>
176 store <4 x i32> %x, <4 x i32>* %res
180 define <2 x i32> @trunc_qd_128(<2 x i64> %i) #0 {
181 ; SKX-LABEL: trunc_qd_128:
184 %x = trunc <2 x i64> %i to <2 x i32>
188 define void @trunc_qd_128_mem(<2 x i64> %i, <2 x i32>* %res) #0 {
189 ; SKX-LABEL: trunc_qd_128_mem:
191 ; SKX-NEXT: vpmovqd %xmm0, (%rdi)
193 %x = trunc <2 x i64> %i to <2 x i32>
194 store <2 x i32> %x, <2 x i32>* %res
198 define <16 x i8> @trunc_db_512(<16 x i32> %i) #0 {
199 ; SKX-LABEL: trunc_db_512:
201 ; SKX-NEXT: vpmovdb %zmm0, %xmm0
203 %x = trunc <16 x i32> %i to <16 x i8>
207 define void @trunc_db_512_mem(<16 x i32> %i, <16 x i8>* %res) #0 {
208 ; SKX-LABEL: trunc_db_512_mem:
210 ; SKX-NEXT: vpmovdb %zmm0, (%rdi)
212 %x = trunc <16 x i32> %i to <16 x i8>
213 store <16 x i8> %x, <16 x i8>* %res
217 define <8 x i8> @trunc_db_256(<8 x i32> %i) #0 {
218 ; SKX-LABEL: trunc_db_256:
220 ; SKX-NEXT: vpmovdw %ymm0, %xmm0
222 %x = trunc <8 x i32> %i to <8 x i8>
226 define void @trunc_db_256_mem(<8 x i32> %i, <8 x i8>* %res) #0 {
227 ; SKX-LABEL: trunc_db_256_mem:
229 ; SKX-NEXT: vpmovdb %ymm0, (%rdi)
231 %x = trunc <8 x i32> %i to <8 x i8>
232 store <8 x i8> %x, <8 x i8>* %res
236 define <4 x i8> @trunc_db_128(<4 x i32> %i) #0 {
237 ; SKX-LABEL: trunc_db_128:
240 %x = trunc <4 x i32> %i to <4 x i8>
244 define void @trunc_db_128_mem(<4 x i32> %i, <4 x i8>* %res) #0 {
245 ; SKX-LABEL: trunc_db_128_mem:
247 ; SKX-NEXT: vpmovdb %xmm0, (%rdi)
249 %x = trunc <4 x i32> %i to <4 x i8>
250 store <4 x i8> %x, <4 x i8>* %res
254 define <16 x i16> @trunc_dw_512(<16 x i32> %i) #0 {
255 ; SKX-LABEL: trunc_dw_512:
257 ; SKX-NEXT: vpmovdw %zmm0, %ymm0
259 %x = trunc <16 x i32> %i to <16 x i16>
263 define void @trunc_dw_512_mem(<16 x i32> %i, <16 x i16>* %res) #0 {
264 ; SKX-LABEL: trunc_dw_512_mem:
266 ; SKX-NEXT: vpmovdw %zmm0, (%rdi)
268 %x = trunc <16 x i32> %i to <16 x i16>
269 store <16 x i16> %x, <16 x i16>* %res
273 define <8 x i16> @trunc_dw_256(<8 x i32> %i) #0 {
274 ; SKX-LABEL: trunc_dw_256:
276 ; SKX-NEXT: vpmovdw %ymm0, %xmm0
278 %x = trunc <8 x i32> %i to <8 x i16>
282 define void @trunc_dw_256_mem(<8 x i32> %i, <8 x i16>* %res) #0 {
283 ; SKX-LABEL: trunc_dw_256_mem:
285 ; SKX-NEXT: vpmovdw %ymm0, (%rdi)
287 %x = trunc <8 x i32> %i to <8 x i16>
288 store <8 x i16> %x, <8 x i16>* %res
292 define <4 x i16> @trunc_dw_128(<4 x i32> %i) #0 {
293 ; SKX-LABEL: trunc_dw_128:
296 %x = trunc <4 x i32> %i to <4 x i16>
300 define void @trunc_dw_128_mem(<4 x i32> %i, <4 x i16>* %res) #0 {
301 ; SKX-LABEL: trunc_dw_128_mem:
303 ; SKX-NEXT: vpmovdw %xmm0, (%rdi)
305 %x = trunc <4 x i32> %i to <4 x i16>
306 store <4 x i16> %x, <4 x i16>* %res
310 define <32 x i8> @trunc_wb_512(<32 x i16> %i) #0 {
311 ; SKX-LABEL: trunc_wb_512:
313 ; SKX-NEXT: vpmovwb %zmm0, %ymm0
315 %x = trunc <32 x i16> %i to <32 x i8>
319 define void @trunc_wb_512_mem(<32 x i16> %i, <32 x i8>* %res) #0 {
320 ; SKX-LABEL: trunc_wb_512_mem:
322 ; SKX-NEXT: vpmovwb %zmm0, (%rdi)
324 %x = trunc <32 x i16> %i to <32 x i8>
325 store <32 x i8> %x, <32 x i8>* %res
329 define <16 x i8> @trunc_wb_256(<16 x i16> %i) #0 {
330 ; SKX-LABEL: trunc_wb_256:
332 ; SKX-NEXT: vpmovwb %ymm0, %xmm0
334 %x = trunc <16 x i16> %i to <16 x i8>
338 define void @trunc_wb_256_mem(<16 x i16> %i, <16 x i8>* %res) #0 {
339 ; SKX-LABEL: trunc_wb_256_mem:
341 ; SKX-NEXT: vpmovwb %ymm0, (%rdi)
343 %x = trunc <16 x i16> %i to <16 x i8>
344 store <16 x i8> %x, <16 x i8>* %res
348 define <8 x i8> @trunc_wb_128(<8 x i16> %i) #0 {
349 ; SKX-LABEL: trunc_wb_128:
352 %x = trunc <8 x i16> %i to <8 x i8>
356 define void @trunc_wb_128_mem(<8 x i16> %i, <8 x i8>* %res) #0 {
357 ; SKX-LABEL: trunc_wb_128_mem:
359 ; SKX-NEXT: vpmovwb %xmm0, (%rdi)
361 %x = trunc <8 x i16> %i to <8 x i8>
362 store <8 x i8> %x, <8 x i8>* %res