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-SD-LABEL: xtn_v3i16_v3i8:
228 ; CHECK-SD: // %bb.0: // %entry
229 ; CHECK-SD-NEXT: // kill: def $d0 killed $d0 def $q0
230 ; CHECK-SD-NEXT: umov w0, v0.h[0]
231 ; CHECK-SD-NEXT: umov w1, v0.h[1]
232 ; CHECK-SD-NEXT: umov w2, v0.h[2]
235 ; CHECK-GI-LABEL: xtn_v3i16_v3i8:
236 ; CHECK-GI: // %bb.0: // %entry
237 ; CHECK-GI-NEXT: // kill: def $d0 killed $d0 def $q0
238 ; CHECK-GI-NEXT: mov h1, v0.h[1]
239 ; CHECK-GI-NEXT: mov h2, v0.h[2]
240 ; CHECK-GI-NEXT: fmov w0, s0
241 ; CHECK-GI-NEXT: fmov w1, s1
242 ; CHECK-GI-NEXT: fmov w2, s2
245 %arg1 = trunc <3 x i16> %a to <3 x i8>
249 define <3 x i8> @xtn_v3i32_v3i8(<3 x i32> %a) {
250 ; CHECK-SD-LABEL: xtn_v3i32_v3i8:
251 ; CHECK-SD: // %bb.0: // %entry
252 ; CHECK-SD-NEXT: xtn v0.4h, v0.4s
253 ; CHECK-SD-NEXT: umov w0, v0.h[0]
254 ; CHECK-SD-NEXT: umov w1, v0.h[1]
255 ; CHECK-SD-NEXT: umov w2, v0.h[2]
258 ; CHECK-GI-LABEL: xtn_v3i32_v3i8:
259 ; CHECK-GI: // %bb.0: // %entry
260 ; CHECK-GI-NEXT: mov s1, v0.s[1]
261 ; CHECK-GI-NEXT: mov s2, v0.s[2]
262 ; CHECK-GI-NEXT: fmov w0, s0
263 ; CHECK-GI-NEXT: fmov w1, s1
264 ; CHECK-GI-NEXT: fmov w2, s2
267 %arg1 = trunc <3 x i32> %a to <3 x i8>
271 define <3 x i8> @xtn_v3i64_v3i8(<3 x i64> %a) {
272 ; CHECK-SD-LABEL: xtn_v3i64_v3i8:
273 ; CHECK-SD: // %bb.0: // %entry
274 ; CHECK-SD-NEXT: // kill: def $d0 killed $d0 def $q0
275 ; CHECK-SD-NEXT: // kill: def $d1 killed $d1 def $q1
276 ; CHECK-SD-NEXT: // kill: def $d2 killed $d2 def $q2
277 ; CHECK-SD-NEXT: mov v0.d[1], v1.d[0]
278 ; CHECK-SD-NEXT: xtn v1.2s, v2.2d
279 ; CHECK-SD-NEXT: xtn v0.2s, v0.2d
280 ; CHECK-SD-NEXT: fmov w2, s1
281 ; CHECK-SD-NEXT: mov w1, v0.s[1]
282 ; CHECK-SD-NEXT: fmov w0, s0
285 ; CHECK-GI-LABEL: xtn_v3i64_v3i8:
286 ; CHECK-GI: // %bb.0: // %entry
287 ; CHECK-GI-NEXT: fmov x0, d0
288 ; CHECK-GI-NEXT: fmov x1, d1
289 ; CHECK-GI-NEXT: fmov x2, d2
290 ; CHECK-GI-NEXT: // kill: def $w0 killed $w0 killed $x0
291 ; CHECK-GI-NEXT: // kill: def $w1 killed $w1 killed $x1
292 ; CHECK-GI-NEXT: // kill: def $w2 killed $w2 killed $x2
295 %arg1 = trunc <3 x i64> %a to <3 x i8>
299 define <3 x i16> @xtn_v3i32_v3i16(<3 x i32> %a) {
300 ; CHECK-SD-LABEL: xtn_v3i32_v3i16:
301 ; CHECK-SD: // %bb.0: // %entry
302 ; CHECK-SD-NEXT: xtn v0.4h, v0.4s
305 ; CHECK-GI-LABEL: xtn_v3i32_v3i16:
306 ; CHECK-GI: // %bb.0: // %entry
307 ; CHECK-GI-NEXT: mov s1, v0.s[1]
308 ; CHECK-GI-NEXT: mov s2, v0.s[2]
309 ; CHECK-GI-NEXT: mov v0.h[1], v1.h[0]
310 ; CHECK-GI-NEXT: mov v0.h[2], v2.h[0]
311 ; CHECK-GI-NEXT: mov v0.h[3], v0.h[0]
312 ; CHECK-GI-NEXT: // kill: def $d0 killed $d0 killed $q0
315 %arg1 = trunc <3 x i32> %a to <3 x i16>
319 define <3 x i16> @xtn_v3i64_v3i16(<3 x i64> %a) {
320 ; CHECK-SD-LABEL: xtn_v3i64_v3i16:
321 ; CHECK-SD: // %bb.0: // %entry
322 ; CHECK-SD-NEXT: // kill: def $d0 killed $d0 def $q0
323 ; CHECK-SD-NEXT: // kill: def $d1 killed $d1 def $q1
324 ; CHECK-SD-NEXT: // kill: def $d2 killed $d2 def $q2
325 ; CHECK-SD-NEXT: mov v0.d[1], v1.d[0]
326 ; CHECK-SD-NEXT: uzp1 v0.4s, v0.4s, v2.4s
327 ; CHECK-SD-NEXT: xtn v0.4h, v0.4s
330 ; CHECK-GI-LABEL: xtn_v3i64_v3i16:
331 ; CHECK-GI: // %bb.0: // %entry
332 ; CHECK-GI-NEXT: fmov x8, d0
333 ; CHECK-GI-NEXT: fmov x9, d1
334 ; CHECK-GI-NEXT: fmov s0, w8
335 ; CHECK-GI-NEXT: fmov s1, w9
336 ; CHECK-GI-NEXT: fmov x8, d2
337 ; CHECK-GI-NEXT: mov v0.h[1], v1.h[0]
338 ; CHECK-GI-NEXT: fmov s1, w8
339 ; CHECK-GI-NEXT: mov v0.h[2], v1.h[0]
340 ; CHECK-GI-NEXT: mov v0.h[3], v0.h[0]
341 ; CHECK-GI-NEXT: // kill: def $d0 killed $d0 killed $q0
344 %arg1 = trunc <3 x i64> %a to <3 x i16>
348 define <3 x i32> @xtn_v3i64_v3i32(<3 x i64> %a) {
349 ; CHECK-SD-LABEL: xtn_v3i64_v3i32:
350 ; CHECK-SD: // %bb.0: // %entry
351 ; CHECK-SD-NEXT: // kill: def $d0 killed $d0 def $q0
352 ; CHECK-SD-NEXT: // kill: def $d1 killed $d1 def $q1
353 ; CHECK-SD-NEXT: // kill: def $d2 killed $d2 def $q2
354 ; CHECK-SD-NEXT: mov v0.d[1], v1.d[0]
355 ; CHECK-SD-NEXT: uzp1 v0.4s, v0.4s, v2.4s
358 ; CHECK-GI-LABEL: xtn_v3i64_v3i32:
359 ; CHECK-GI: // %bb.0: // %entry
360 ; CHECK-GI-NEXT: fmov x8, d0
361 ; CHECK-GI-NEXT: fmov x9, d1
362 ; CHECK-GI-NEXT: fmov s0, w8
363 ; CHECK-GI-NEXT: fmov x8, d2
364 ; CHECK-GI-NEXT: mov v0.s[1], w9
365 ; CHECK-GI-NEXT: mov v0.s[2], w8
366 ; CHECK-GI-NEXT: mov v0.s[3], w8
369 %arg1 = trunc <3 x i64> %a to <3 x i32>
373 define <4 x i8> @xtn_v4i16_v4i8(<4 x i16> %a) {
374 ; CHECK-LABEL: xtn_v4i16_v4i8:
375 ; CHECK: // %bb.0: // %entry
378 %arg1 = trunc <4 x i16> %a to <4 x i8>
382 define <4 x i8> @xtn_v4i32_v4i8(<4 x i32> %a) {
383 ; CHECK-LABEL: xtn_v4i32_v4i8:
384 ; CHECK: // %bb.0: // %entry
385 ; CHECK-NEXT: xtn v0.4h, v0.4s
388 %arg1 = trunc <4 x i32> %a to <4 x i8>
392 define <4 x i8> @xtn_v4i64_v4i8(<4 x i64> %a) {
393 ; CHECK-LABEL: xtn_v4i64_v4i8:
394 ; CHECK: // %bb.0: // %entry
395 ; CHECK-NEXT: uzp1 v0.4s, v0.4s, v1.4s
396 ; CHECK-NEXT: xtn v0.4h, v0.4s
399 %arg1 = trunc <4 x i64> %a to <4 x i8>
403 define <4 x i16> @xtn_v4i32_v4i16(<4 x i32> %a) {
404 ; CHECK-LABEL: xtn_v4i32_v4i16:
405 ; CHECK: // %bb.0: // %entry
406 ; CHECK-NEXT: xtn v0.4h, v0.4s
409 %arg1 = trunc <4 x i32> %a to <4 x i16>
413 define <4 x i16> @xtn_v4i64_v4i16(<4 x i64> %a) {
414 ; CHECK-LABEL: xtn_v4i64_v4i16:
415 ; CHECK: // %bb.0: // %entry
416 ; CHECK-NEXT: uzp1 v0.4s, v0.4s, v1.4s
417 ; CHECK-NEXT: xtn v0.4h, v0.4s
420 %arg1 = trunc <4 x i64> %a to <4 x i16>
424 define <4 x i32> @xtn_v4i64_v4i32(<4 x i64> %a) {
425 ; CHECK-LABEL: xtn_v4i64_v4i32:
426 ; CHECK: // %bb.0: // %entry
427 ; CHECK-NEXT: uzp1 v0.4s, v0.4s, v1.4s
430 %arg1 = trunc <4 x i64> %a to <4 x i32>
434 define <8 x i8> @xtn_v8i16_v8i8(<8 x i16> %a) {
435 ; CHECK-LABEL: xtn_v8i16_v8i8:
436 ; CHECK: // %bb.0: // %entry
437 ; CHECK-NEXT: xtn v0.8b, v0.8h
440 %arg1 = trunc <8 x i16> %a to <8 x i8>
444 define <8 x i8> @xtn_v8i32_v8i8(<8 x i32> %a) {
445 ; CHECK-LABEL: xtn_v8i32_v8i8:
446 ; CHECK: // %bb.0: // %entry
447 ; CHECK-NEXT: uzp1 v0.8h, v0.8h, v1.8h
448 ; CHECK-NEXT: xtn v0.8b, v0.8h
451 %arg1 = trunc <8 x i32> %a to <8 x i8>
455 define <8 x i16> @xtn_v8i32_v8i16(<8 x i32> %a) {
456 ; CHECK-LABEL: xtn_v8i32_v8i16:
457 ; CHECK: // %bb.0: // %entry
458 ; CHECK-NEXT: uzp1 v0.8h, v0.8h, v1.8h
461 %arg1 = trunc <8 x i32> %a to <8 x i16>
465 define <16 x i8> @xtn_v16i16_v16i8(<16 x i16> %a) {
466 ; CHECK-LABEL: xtn_v16i16_v16i8:
467 ; CHECK: // %bb.0: // %entry
468 ; CHECK-NEXT: uzp1 v0.16b, v0.16b, v1.16b
471 %arg1 = trunc <16 x i16> %a to <16 x i8>