1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 3
2 ; RUN: llc -mtriple=aarch64 -verify-machineinstrs %s -o - 2>&1 | FileCheck %s --check-prefixes=CHECK,CHECK-SD
3 ; RUN: llc -mtriple=aarch64 -global-isel -global-isel-abort=2 -verify-machineinstrs %s -o - 2>&1 | FileCheck %s --check-prefixes=CHECK,CHECK-GI
5 define i8 @xtn_i16_to_i8(i16 %a) {
6 ; CHECK-LABEL: xtn_i16_to_i8:
7 ; CHECK: // %bb.0: // %entry
10 %arg1 = trunc i16 %a to i8
14 define i8 @xtn_i32_to_i8(i32 %a) {
15 ; CHECK-LABEL: xtn_i32_to_i8:
16 ; CHECK: // %bb.0: // %entry
19 %arg1 = trunc i32 %a to i8
23 define i8 @xtn_i64_to_i8(i64 %a) {
24 ; CHECK-LABEL: xtn_i64_to_i8:
25 ; CHECK: // %bb.0: // %entry
26 ; CHECK-NEXT: // kill: def $w0 killed $w0 killed $x0
29 %arg1 = trunc i64 %a to i8
33 define i8 @xtn_i128_to_i8(i128 %a) {
34 ; CHECK-LABEL: xtn_i128_to_i8:
35 ; CHECK: // %bb.0: // %entry
36 ; CHECK-NEXT: // kill: def $w0 killed $w0 killed $x0
39 %arg1 = trunc i128 %a to i8
43 define i16 @xtn_i32_to_i16(i32 %a) {
44 ; CHECK-LABEL: xtn_i32_to_i16:
45 ; CHECK: // %bb.0: // %entry
48 %arg1 = trunc i32 %a to i16
52 define i16 @xtn_i64_to_i16(i64 %a) {
53 ; CHECK-LABEL: xtn_i64_to_i16:
54 ; CHECK: // %bb.0: // %entry
55 ; CHECK-NEXT: // kill: def $w0 killed $w0 killed $x0
58 %arg1 = trunc i64 %a to i16
62 define i16 @xtn_i128_to_i16(i128 %a) {
63 ; CHECK-LABEL: xtn_i128_to_i16:
64 ; CHECK: // %bb.0: // %entry
65 ; CHECK-NEXT: // kill: def $w0 killed $w0 killed $x0
68 %arg1 = trunc i128 %a to i16
72 define i32 @xtn_i64_to_i32(i64 %a) {
73 ; CHECK-LABEL: xtn_i64_to_i32:
74 ; CHECK: // %bb.0: // %entry
75 ; CHECK-NEXT: // kill: def $w0 killed $w0 killed $x0
78 %arg1 = trunc i64 %a to i32
82 define i32 @xtn_i128_to_i32(i128 %a) {
83 ; CHECK-LABEL: xtn_i128_to_i32:
84 ; CHECK: // %bb.0: // %entry
85 ; CHECK-NEXT: // kill: def $w0 killed $w0 killed $x0
88 %arg1 = trunc i128 %a to i32
92 define i64 @xtn_i128_to_i64(i128 %a) {
93 ; CHECK-LABEL: xtn_i128_to_i64:
94 ; CHECK: // %bb.0: // %entry
97 %arg1 = trunc i128 %a to i64
101 define <2 x i8> @xtn_v2i16_v2i8(<2 x i16> %a) {
102 ; CHECK-LABEL: xtn_v2i16_v2i8:
103 ; CHECK: // %bb.0: // %entry
106 %arg1 = trunc <2 x i16> %a to <2 x i8>
110 define <2 x i8> @xtn_v2i32_v2i8(<2 x i32> %a) {
111 ; CHECK-LABEL: xtn_v2i32_v2i8:
112 ; CHECK: // %bb.0: // %entry
115 %arg1 = trunc <2 x i32> %a to <2 x i8>
119 define <2 x i8> @xtn_v2i64_v2i8(<2 x i64> %a) {
120 ; CHECK-LABEL: xtn_v2i64_v2i8:
121 ; CHECK: // %bb.0: // %entry
122 ; CHECK-NEXT: xtn v0.2s, v0.2d
125 %arg1 = trunc <2 x i64> %a to <2 x i8>
129 define <2 x i8> @xtn_v2i128_v2i8(<2 x i128> %a) {
130 ; CHECK-SD-LABEL: xtn_v2i128_v2i8:
131 ; CHECK-SD: // %bb.0: // %entry
132 ; CHECK-SD-NEXT: fmov s0, w0
133 ; CHECK-SD-NEXT: mov v0.s[1], w2
134 ; CHECK-SD-NEXT: // kill: def $d0 killed $d0 killed $q0
137 ; CHECK-GI-LABEL: xtn_v2i128_v2i8:
138 ; CHECK-GI: // %bb.0: // %entry
139 ; CHECK-GI-NEXT: fmov d0, x0
140 ; CHECK-GI-NEXT: mov v0.d[1], x2
141 ; CHECK-GI-NEXT: xtn v0.2s, v0.2d
144 %arg1 = trunc <2 x i128> %a to <2 x i8>
148 define <2 x i16> @xtn_v2i32_v2i16(<2 x i32> %a) {
149 ; CHECK-LABEL: xtn_v2i32_v2i16:
150 ; CHECK: // %bb.0: // %entry
153 %arg1 = trunc <2 x i32> %a to <2 x i16>
157 define <2 x i16> @xtn_v2i64_v2i16(<2 x i64> %a) {
158 ; CHECK-LABEL: xtn_v2i64_v2i16:
159 ; CHECK: // %bb.0: // %entry
160 ; CHECK-NEXT: xtn v0.2s, v0.2d
163 %arg1 = trunc <2 x i64> %a to <2 x i16>
167 define <2 x i16> @xtn_v2i128_v2i16(<2 x i128> %a) {
168 ; CHECK-SD-LABEL: xtn_v2i128_v2i16:
169 ; CHECK-SD: // %bb.0: // %entry
170 ; CHECK-SD-NEXT: fmov s0, w0
171 ; CHECK-SD-NEXT: mov v0.s[1], w2
172 ; CHECK-SD-NEXT: // kill: def $d0 killed $d0 killed $q0
175 ; CHECK-GI-LABEL: xtn_v2i128_v2i16:
176 ; CHECK-GI: // %bb.0: // %entry
177 ; CHECK-GI-NEXT: fmov d0, x0
178 ; CHECK-GI-NEXT: mov v0.d[1], x2
179 ; CHECK-GI-NEXT: xtn v0.2s, v0.2d
182 %arg1 = trunc <2 x i128> %a to <2 x i16>
186 define <2 x i32> @xtn_v2i64_v2i32(<2 x i64> %a) {
187 ; CHECK-LABEL: xtn_v2i64_v2i32:
188 ; CHECK: // %bb.0: // %entry
189 ; CHECK-NEXT: xtn v0.2s, v0.2d
192 %arg1 = trunc <2 x i64> %a to <2 x i32>
196 define <2 x i32> @xtn_v2i128_v2i32(<2 x i128> %a) {
197 ; CHECK-SD-LABEL: xtn_v2i128_v2i32:
198 ; CHECK-SD: // %bb.0: // %entry
199 ; CHECK-SD-NEXT: fmov s0, w0
200 ; CHECK-SD-NEXT: mov v0.s[1], w2
201 ; CHECK-SD-NEXT: // kill: def $d0 killed $d0 killed $q0
204 ; CHECK-GI-LABEL: xtn_v2i128_v2i32:
205 ; CHECK-GI: // %bb.0: // %entry
206 ; CHECK-GI-NEXT: fmov d0, x0
207 ; CHECK-GI-NEXT: mov v0.d[1], x2
208 ; CHECK-GI-NEXT: xtn v0.2s, v0.2d
211 %arg1 = trunc <2 x i128> %a to <2 x i32>
215 define <2 x i64> @xtn_v2i128_v2i64(<2 x i128> %a) {
216 ; CHECK-LABEL: xtn_v2i128_v2i64:
217 ; CHECK: // %bb.0: // %entry
218 ; CHECK-NEXT: fmov d0, x0
219 ; CHECK-NEXT: mov v0.d[1], x2
222 %arg1 = trunc <2 x i128> %a to <2 x i64>
226 define <3 x i8> @xtn_v3i16_v3i8(<3 x i16> %a) {
227 ; CHECK-LABEL: xtn_v3i16_v3i8:
228 ; CHECK: // %bb.0: // %entry
229 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0
230 ; CHECK-NEXT: umov w0, v0.h[0]
231 ; CHECK-NEXT: umov w1, v0.h[1]
232 ; CHECK-NEXT: umov w2, v0.h[2]
235 %arg1 = trunc <3 x i16> %a to <3 x i8>
239 define <3 x i8> @xtn_v3i32_v3i8(<3 x i32> %a) {
240 ; CHECK-SD-LABEL: xtn_v3i32_v3i8:
241 ; CHECK-SD: // %bb.0: // %entry
242 ; CHECK-SD-NEXT: xtn v0.4h, v0.4s
243 ; CHECK-SD-NEXT: umov w0, v0.h[0]
244 ; CHECK-SD-NEXT: umov w1, v0.h[1]
245 ; CHECK-SD-NEXT: umov w2, v0.h[2]
248 ; CHECK-GI-LABEL: xtn_v3i32_v3i8:
249 ; CHECK-GI: // %bb.0: // %entry
250 ; CHECK-GI-NEXT: mov s1, v0.s[1]
251 ; CHECK-GI-NEXT: mov s2, v0.s[2]
252 ; CHECK-GI-NEXT: fmov w0, s0
253 ; CHECK-GI-NEXT: fmov w1, s1
254 ; CHECK-GI-NEXT: fmov w2, s2
257 %arg1 = trunc <3 x i32> %a to <3 x i8>
261 define <3 x i8> @xtn_v3i64_v3i8(<3 x i64> %a) {
262 ; CHECK-SD-LABEL: xtn_v3i64_v3i8:
263 ; CHECK-SD: // %bb.0: // %entry
264 ; CHECK-SD-NEXT: // kill: def $d0 killed $d0 def $q0
265 ; CHECK-SD-NEXT: // kill: def $d1 killed $d1 def $q1
266 ; CHECK-SD-NEXT: // kill: def $d2 killed $d2 def $q2
267 ; CHECK-SD-NEXT: mov v0.d[1], v1.d[0]
268 ; CHECK-SD-NEXT: xtn v1.2s, v2.2d
269 ; CHECK-SD-NEXT: xtn v0.2s, v0.2d
270 ; CHECK-SD-NEXT: fmov w2, s1
271 ; CHECK-SD-NEXT: mov w1, v0.s[1]
272 ; CHECK-SD-NEXT: fmov w0, s0
275 ; CHECK-GI-LABEL: xtn_v3i64_v3i8:
276 ; CHECK-GI: // %bb.0: // %entry
277 ; CHECK-GI-NEXT: fmov x0, d0
278 ; CHECK-GI-NEXT: fmov x1, d1
279 ; CHECK-GI-NEXT: fmov x2, d2
280 ; CHECK-GI-NEXT: // kill: def $w0 killed $w0 killed $x0
281 ; CHECK-GI-NEXT: // kill: def $w1 killed $w1 killed $x1
282 ; CHECK-GI-NEXT: // kill: def $w2 killed $w2 killed $x2
285 %arg1 = trunc <3 x i64> %a to <3 x i8>
289 define <3 x i16> @xtn_v3i32_v3i16(<3 x i32> %a) {
290 ; CHECK-SD-LABEL: xtn_v3i32_v3i16:
291 ; CHECK-SD: // %bb.0: // %entry
292 ; CHECK-SD-NEXT: xtn v0.4h, v0.4s
295 ; CHECK-GI-LABEL: xtn_v3i32_v3i16:
296 ; CHECK-GI: // %bb.0: // %entry
297 ; CHECK-GI-NEXT: mov s1, v0.s[1]
298 ; CHECK-GI-NEXT: mov s2, v0.s[2]
299 ; CHECK-GI-NEXT: mov v0.h[1], v1.h[0]
300 ; CHECK-GI-NEXT: mov v0.h[2], v2.h[0]
301 ; CHECK-GI-NEXT: mov v0.h[3], v0.h[0]
302 ; CHECK-GI-NEXT: // kill: def $d0 killed $d0 killed $q0
305 %arg1 = trunc <3 x i32> %a to <3 x i16>
309 define <3 x i16> @xtn_v3i64_v3i16(<3 x i64> %a) {
310 ; CHECK-SD-LABEL: xtn_v3i64_v3i16:
311 ; CHECK-SD: // %bb.0: // %entry
312 ; CHECK-SD-NEXT: // kill: def $d0 killed $d0 def $q0
313 ; CHECK-SD-NEXT: // kill: def $d1 killed $d1 def $q1
314 ; CHECK-SD-NEXT: // kill: def $d2 killed $d2 def $q2
315 ; CHECK-SD-NEXT: mov v0.d[1], v1.d[0]
316 ; CHECK-SD-NEXT: uzp1 v0.4s, v0.4s, v2.4s
317 ; CHECK-SD-NEXT: xtn v0.4h, v0.4s
320 ; CHECK-GI-LABEL: xtn_v3i64_v3i16:
321 ; CHECK-GI: // %bb.0: // %entry
322 ; CHECK-GI-NEXT: fmov x8, d0
323 ; CHECK-GI-NEXT: fmov x9, d1
324 ; CHECK-GI-NEXT: fmov s0, w8
325 ; CHECK-GI-NEXT: fmov s1, w9
326 ; CHECK-GI-NEXT: fmov x8, d2
327 ; CHECK-GI-NEXT: mov v0.h[1], v1.h[0]
328 ; CHECK-GI-NEXT: fmov s1, w8
329 ; CHECK-GI-NEXT: mov v0.h[2], v1.h[0]
330 ; CHECK-GI-NEXT: mov v0.h[3], v0.h[0]
331 ; CHECK-GI-NEXT: // kill: def $d0 killed $d0 killed $q0
334 %arg1 = trunc <3 x i64> %a to <3 x i16>
338 define <3 x i32> @xtn_v3i64_v3i32(<3 x i64> %a) {
339 ; CHECK-SD-LABEL: xtn_v3i64_v3i32:
340 ; CHECK-SD: // %bb.0: // %entry
341 ; CHECK-SD-NEXT: // kill: def $d0 killed $d0 def $q0
342 ; CHECK-SD-NEXT: // kill: def $d1 killed $d1 def $q1
343 ; CHECK-SD-NEXT: // kill: def $d2 killed $d2 def $q2
344 ; CHECK-SD-NEXT: mov v0.d[1], v1.d[0]
345 ; CHECK-SD-NEXT: uzp1 v0.4s, v0.4s, v2.4s
348 ; CHECK-GI-LABEL: xtn_v3i64_v3i32:
349 ; CHECK-GI: // %bb.0: // %entry
350 ; CHECK-GI-NEXT: fmov x8, d0
351 ; CHECK-GI-NEXT: fmov x9, d1
352 ; CHECK-GI-NEXT: fmov s0, w8
353 ; CHECK-GI-NEXT: fmov x8, d2
354 ; CHECK-GI-NEXT: mov v0.s[1], w9
355 ; CHECK-GI-NEXT: mov v0.s[2], w8
356 ; CHECK-GI-NEXT: mov v0.s[3], w8
359 %arg1 = trunc <3 x i64> %a to <3 x i32>
363 define <4 x i8> @xtn_v4i16_v4i8(<4 x i16> %a) {
364 ; CHECK-LABEL: xtn_v4i16_v4i8:
365 ; CHECK: // %bb.0: // %entry
368 %arg1 = trunc <4 x i16> %a to <4 x i8>
372 define <4 x i8> @xtn_v4i32_v4i8(<4 x i32> %a) {
373 ; CHECK-LABEL: xtn_v4i32_v4i8:
374 ; CHECK: // %bb.0: // %entry
375 ; CHECK-NEXT: xtn v0.4h, v0.4s
378 %arg1 = trunc <4 x i32> %a to <4 x i8>
382 define <4 x i8> @xtn_v4i64_v4i8(<4 x i64> %a) {
383 ; CHECK-LABEL: xtn_v4i64_v4i8:
384 ; CHECK: // %bb.0: // %entry
385 ; CHECK-NEXT: uzp1 v0.4s, v0.4s, v1.4s
386 ; CHECK-NEXT: xtn v0.4h, v0.4s
389 %arg1 = trunc <4 x i64> %a to <4 x i8>
393 define <4 x i16> @xtn_v4i32_v4i16(<4 x i32> %a) {
394 ; CHECK-LABEL: xtn_v4i32_v4i16:
395 ; CHECK: // %bb.0: // %entry
396 ; CHECK-NEXT: xtn v0.4h, v0.4s
399 %arg1 = trunc <4 x i32> %a to <4 x i16>
403 define <4 x i16> @xtn_v4i64_v4i16(<4 x i64> %a) {
404 ; CHECK-LABEL: xtn_v4i64_v4i16:
405 ; CHECK: // %bb.0: // %entry
406 ; CHECK-NEXT: uzp1 v0.4s, v0.4s, v1.4s
407 ; CHECK-NEXT: xtn v0.4h, v0.4s
410 %arg1 = trunc <4 x i64> %a to <4 x i16>
414 define <4 x i32> @xtn_v4i64_v4i32(<4 x i64> %a) {
415 ; CHECK-LABEL: xtn_v4i64_v4i32:
416 ; CHECK: // %bb.0: // %entry
417 ; CHECK-NEXT: uzp1 v0.4s, v0.4s, v1.4s
420 %arg1 = trunc <4 x i64> %a to <4 x i32>
424 define <8 x i8> @xtn_v8i16_v8i8(<8 x i16> %a) {
425 ; CHECK-LABEL: xtn_v8i16_v8i8:
426 ; CHECK: // %bb.0: // %entry
427 ; CHECK-NEXT: xtn v0.8b, v0.8h
430 %arg1 = trunc <8 x i16> %a to <8 x i8>
434 define <8 x i8> @xtn_v8i32_v8i8(<8 x i32> %a) {
435 ; CHECK-LABEL: xtn_v8i32_v8i8:
436 ; CHECK: // %bb.0: // %entry
437 ; CHECK-NEXT: uzp1 v0.8h, v0.8h, v1.8h
438 ; CHECK-NEXT: xtn v0.8b, v0.8h
441 %arg1 = trunc <8 x i32> %a to <8 x i8>
445 define <8 x i16> @xtn_v8i32_v8i16(<8 x i32> %a) {
446 ; CHECK-LABEL: xtn_v8i32_v8i16:
447 ; CHECK: // %bb.0: // %entry
448 ; CHECK-NEXT: uzp1 v0.8h, v0.8h, v1.8h
451 %arg1 = trunc <8 x i32> %a to <8 x i16>
455 define <16 x i8> @xtn_v16i16_v16i8(<16 x i16> %a) {
456 ; CHECK-LABEL: xtn_v16i16_v16i8:
457 ; CHECK: // %bb.0: // %entry
458 ; CHECK-NEXT: uzp1 v0.16b, v0.16b, v1.16b
461 %arg1 = trunc <16 x i16> %a to <16 x i8>