1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=aarch64 %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-ISEL
3 ; RUN: llc -mtriple=aarch64 -global-isel %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-GLOBAL
5 define i64 @extract_v2i64(<2 x i64> %x, i32 %y) {
6 ; CHECK-ISEL-LABEL: extract_v2i64:
7 ; CHECK-ISEL: // %bb.0:
8 ; CHECK-ISEL-NEXT: mov x0, v0.d[1]
11 ; CHECK-GLOBAL-LABEL: extract_v2i64:
12 ; CHECK-GLOBAL: // %bb.0:
13 ; CHECK-GLOBAL-NEXT: mov d0, v0.d[1]
14 ; CHECK-GLOBAL-NEXT: fmov x0, d0
15 ; CHECK-GLOBAL-NEXT: ret
16 %ext = extractelement <2 x i64> %x, i32 1
20 define i64 @extract_v1i64(<1 x i64> %x, i32 %y) {
21 ; CHECK-ISEL-LABEL: extract_v1i64:
22 ; CHECK-ISEL: // %bb.0:
23 ; CHECK-ISEL-NEXT: ret
25 ; CHECK-GLOBAL-LABEL: extract_v1i64:
26 ; CHECK-GLOBAL: // %bb.0:
27 ; CHECK-GLOBAL-NEXT: fmov x0, d0
28 ; CHECK-GLOBAL-NEXT: ret
29 %ext = extractelement <1 x i64> %x, i32 1
33 define i32 @extract_v4i32(<4 x i32> %x, i32 %y) {
34 ; CHECK-ISEL-LABEL: extract_v4i32:
35 ; CHECK-ISEL: // %bb.0:
36 ; CHECK-ISEL-NEXT: mov w0, v0.s[1]
37 ; CHECK-ISEL-NEXT: ret
39 ; CHECK-GLOBAL-LABEL: extract_v4i32:
40 ; CHECK-GLOBAL: // %bb.0:
41 ; CHECK-GLOBAL-NEXT: mov s0, v0.s[1]
42 ; CHECK-GLOBAL-NEXT: fmov w0, s0
43 ; CHECK-GLOBAL-NEXT: ret
44 %ext = extractelement <4 x i32> %x, i32 1
48 define i32 @extract_v2i32(<2 x i32> %x, i32 %y) {
49 ; CHECK-ISEL-LABEL: extract_v2i32:
50 ; CHECK-ISEL: // %bb.0:
51 ; CHECK-ISEL-NEXT: // kill: def $d0 killed $d0 def $q0
52 ; CHECK-ISEL-NEXT: mov w0, v0.s[1]
53 ; CHECK-ISEL-NEXT: ret
55 ; CHECK-GLOBAL-LABEL: extract_v2i32:
56 ; CHECK-GLOBAL: // %bb.0:
57 ; CHECK-GLOBAL-NEXT: // kill: def $d0 killed $d0 def $q0
58 ; CHECK-GLOBAL-NEXT: mov s0, v0.s[1]
59 ; CHECK-GLOBAL-NEXT: fmov w0, s0
60 ; CHECK-GLOBAL-NEXT: ret
61 %ext = extractelement <2 x i32> %x, i32 1
65 define i16 @extract_v8i16(<8 x i16> %x, i32 %y) {
66 ; CHECK-LABEL: extract_v8i16:
68 ; CHECK-NEXT: umov w0, v0.h[1]
70 %ext = extractelement <8 x i16> %x, i32 1
74 define i16 @extract_v4i16(<4 x i16> %x, i32 %y) {
75 ; CHECK-LABEL: extract_v4i16:
77 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0
78 ; CHECK-NEXT: umov w0, v0.h[1]
80 %ext = extractelement <4 x i16> %x, i32 1
84 define i8 @extract_v16i8(<16 x i8> %x, i32 %y) {
85 ; CHECK-LABEL: extract_v16i8:
87 ; CHECK-NEXT: umov w0, v0.b[1]
89 %ext = extractelement <16 x i8> %x, i32 1
93 define i8 @extract_v8i8(<8 x i8> %x, i32 %y) {
94 ; CHECK-LABEL: extract_v8i8:
96 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0
97 ; CHECK-NEXT: umov w0, v0.b[1]
99 %ext = extractelement <8 x i8> %x, i32 1
104 define i64 @sv2i32i64(<2 x i32> %x) {
105 ; CHECK-LABEL: sv2i32i64:
107 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0
108 ; CHECK-NEXT: smov x0, v0.s[1]
110 %e = extractelement <2 x i32> %x, i64 1
111 %s = sext i32 %e to i64
115 define i64 @sv4i32i64(<4 x i32> %x) {
116 ; CHECK-LABEL: sv4i32i64:
118 ; CHECK-NEXT: smov x0, v0.s[2]
120 %e = extractelement <4 x i32> %x, i64 2
121 %s = sext i32 %e to i64
125 define i64 @sv4i16i64(<4 x i16> %x) {
126 ; CHECK-LABEL: sv4i16i64:
128 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0
129 ; CHECK-NEXT: smov x0, v0.h[2]
131 %e = extractelement <4 x i16> %x, i64 2
132 %s = sext i16 %e to i64
136 define i64 @sv8i16i64(<8 x i16> %x) {
137 ; CHECK-LABEL: sv8i16i64:
139 ; CHECK-NEXT: smov x0, v0.h[2]
141 %e = extractelement <8 x i16> %x, i64 2
142 %s = sext i16 %e to i64
146 define i64 @sv8i8i64(<8 x i8> %x) {
147 ; CHECK-LABEL: sv8i8i64:
149 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0
150 ; CHECK-NEXT: smov x0, v0.b[2]
152 %e = extractelement <8 x i8> %x, i64 2
153 %s = sext i8 %e to i64
157 define i64 @sv16i8i64(<16 x i8> %x) {
158 ; CHECK-LABEL: sv16i8i64:
160 ; CHECK-NEXT: smov x0, v0.b[2]
162 %e = extractelement <16 x i8> %x, i64 2
163 %s = sext i8 %e to i64
167 define i32 @sv8i16i32(<8 x i16> %x) {
168 ; CHECK-LABEL: sv8i16i32:
170 ; CHECK-NEXT: smov w0, v0.h[2]
172 %e = extractelement <8 x i16> %x, i64 2
173 %s = sext i16 %e to i32
177 define i32 @sv4i16i32(<4 x i16> %x) {
178 ; CHECK-LABEL: sv4i16i32:
180 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0
181 ; CHECK-NEXT: smov w0, v0.h[2]
183 %e = extractelement <4 x i16> %x, i64 2
184 %s = sext i16 %e to i32
188 define i32 @sv16i8i32(<16 x i8> %x) {
189 ; CHECK-LABEL: sv16i8i32:
191 ; CHECK-NEXT: smov w0, v0.b[2]
193 %e = extractelement <16 x i8> %x, i64 2
194 %s = sext i8 %e to i32
198 define i32 @sv8i8i32(<8 x i8> %x) {
199 ; CHECK-LABEL: sv8i8i32:
201 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0
202 ; CHECK-NEXT: smov w0, v0.b[2]
204 %e = extractelement <8 x i8> %x, i64 2
205 %s = sext i8 %e to i32
209 define i16 @sv16i8i16(<16 x i8> %x) {
210 ; CHECK-LABEL: sv16i8i16:
212 ; CHECK-NEXT: smov w0, v0.b[2]
214 %e = extractelement <16 x i8> %x, i64 2
215 %s = sext i8 %e to i16
219 define i16 @sv8i8i16(<8 x i8> %x) {
220 ; CHECK-LABEL: sv8i8i16:
222 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0
223 ; CHECK-NEXT: smov w0, v0.b[2]
225 %e = extractelement <8 x i8> %x, i64 2
226 %s = sext i8 %e to i16
232 define i64 @zv2i32i64(<2 x i32> %x) {
233 ; CHECK-LABEL: zv2i32i64:
235 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0
236 ; CHECK-NEXT: mov w0, v0.s[1]
238 %e = extractelement <2 x i32> %x, i64 1
239 %s = zext i32 %e to i64
243 define i64 @zv4i32i64(<4 x i32> %x) {
244 ; CHECK-LABEL: zv4i32i64:
246 ; CHECK-NEXT: mov w0, v0.s[2]
248 %e = extractelement <4 x i32> %x, i64 2
249 %s = zext i32 %e to i64
253 define i64 @zv4i16i64(<4 x i16> %x) {
254 ; CHECK-LABEL: zv4i16i64:
256 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0
257 ; CHECK-NEXT: umov w0, v0.h[2]
259 %e = extractelement <4 x i16> %x, i64 2
260 %s = zext i16 %e to i64
264 define i64 @zv8i16i64(<8 x i16> %x) {
265 ; CHECK-LABEL: zv8i16i64:
267 ; CHECK-NEXT: umov w0, v0.h[2]
269 %e = extractelement <8 x i16> %x, i64 2
270 %s = zext i16 %e to i64
274 define i64 @zv8i8i64(<8 x i8> %x) {
275 ; CHECK-LABEL: zv8i8i64:
277 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0
278 ; CHECK-NEXT: umov w0, v0.b[2]
280 %e = extractelement <8 x i8> %x, i64 2
281 %s = zext i8 %e to i64
285 define i64 @zv16i8i64(<16 x i8> %x) {
286 ; CHECK-LABEL: zv16i8i64:
288 ; CHECK-NEXT: umov w0, v0.b[2]
290 %e = extractelement <16 x i8> %x, i64 2
291 %s = zext i8 %e to i64
295 define i32 @zv8i16i32(<8 x i16> %x) {
296 ; CHECK-LABEL: zv8i16i32:
298 ; CHECK-NEXT: umov w0, v0.h[2]
300 %e = extractelement <8 x i16> %x, i64 2
301 %s = zext i16 %e to i32
305 define i32 @zv4i16i32(<4 x i16> %x) {
306 ; CHECK-LABEL: zv4i16i32:
308 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0
309 ; CHECK-NEXT: umov w0, v0.h[2]
311 %e = extractelement <4 x i16> %x, i64 2
312 %s = zext i16 %e to i32
316 define i32 @zv16i8i32(<16 x i8> %x) {
317 ; CHECK-LABEL: zv16i8i32:
319 ; CHECK-NEXT: umov w0, v0.b[2]
321 %e = extractelement <16 x i8> %x, i64 2
322 %s = zext i8 %e to i32
326 define i32 @zv8i8i32(<8 x i8> %x) {
327 ; CHECK-LABEL: zv8i8i32:
329 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0
330 ; CHECK-NEXT: umov w0, v0.b[2]
332 %e = extractelement <8 x i8> %x, i64 2
333 %s = zext i8 %e to i32
337 define i16 @zv16i8i16(<16 x i8> %x) {
338 ; CHECK-LABEL: zv16i8i16:
340 ; CHECK-NEXT: umov w0, v0.b[2]
342 %e = extractelement <16 x i8> %x, i64 2
343 %s = zext i8 %e to i16
347 define i16 @zv8i8i16(<8 x i8> %x) {
348 ; CHECK-LABEL: zv8i8i16:
350 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0
351 ; CHECK-NEXT: umov w0, v0.b[2]
353 %e = extractelement <8 x i8> %x, i64 2
354 %s = zext i8 %e to i16
359 define i32 @both_i16i32(<8 x i16> %x) {
360 ; CHECK-LABEL: both_i16i32:
362 ; CHECK-NEXT: umov w8, v0.h[2]
363 ; CHECK-NEXT: smov w9, v0.h[2]
364 ; CHECK-NEXT: eor w0, w8, w9
366 %e = extractelement <8 x i16> %x, i64 2
367 %s = zext i16 %e to i32
368 %t = sext i16 %e to i32
373 define i32 @redundant_i16i32(<8 x i16> %x) {
374 ; CHECK-LABEL: redundant_i16i32:
376 ; CHECK-NEXT: smov w8, v0.h[2]
377 ; CHECK-NEXT: eor w0, w8, w8, lsl #16
379 %e = extractelement <8 x i16> %x, i64 2
380 %s = sext i16 %e to i32
386 define i32 @both_i8i32(<8 x i8> %x) {
387 ; CHECK-LABEL: both_i8i32:
389 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0
390 ; CHECK-NEXT: umov w8, v0.b[2]
391 ; CHECK-NEXT: smov w9, v0.b[2]
392 ; CHECK-NEXT: eor w0, w8, w9
394 %e = extractelement <8 x i8> %x, i64 2
395 %s = zext i8 %e to i32
396 %t = sext i8 %e to i32
401 define i32 @redundant_i8i32(<8 x i8> %x) {
402 ; CHECK-LABEL: redundant_i8i32:
404 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0
405 ; CHECK-NEXT: smov w8, v0.b[2]
406 ; CHECK-NEXT: eor w0, w8, w8, lsl #24
408 %e = extractelement <8 x i8> %x, i64 2
409 %s = sext i8 %e to i32
415 define i64 @both_i32i64(<4 x i32> %x) {
416 ; CHECK-LABEL: both_i32i64:
418 ; CHECK-NEXT: mov w8, v0.s[2]
419 ; CHECK-NEXT: smov x9, v0.s[2]
420 ; CHECK-NEXT: eor x0, x8, x9
422 %e = extractelement <4 x i32> %x, i64 2
423 %s = zext i32 %e to i64
424 %t = sext i32 %e to i64
429 define i64 @redundant_i32i64(<4 x i32> %x) {
430 ; CHECK-LABEL: redundant_i32i64:
432 ; CHECK-NEXT: smov x8, v0.s[2]
433 ; CHECK-NEXT: eor x0, x8, x8, lsl #32
435 %e = extractelement <4 x i32> %x, i64 2
436 %s = sext i32 %e to i64
442 define i64 @both_i16i64(<8 x i16> %x) {
443 ; CHECK-LABEL: both_i16i64:
445 ; CHECK-NEXT: umov w8, v0.h[2]
446 ; CHECK-NEXT: smov x9, v0.h[2]
447 ; CHECK-NEXT: eor x0, x8, x9
449 %e = extractelement <8 x i16> %x, i64 2
450 %s = zext i16 %e to i64
451 %t = sext i16 %e to i64
456 define i64 @redundant_i16i64(<8 x i16> %x) {
457 ; CHECK-LABEL: redundant_i16i64:
459 ; CHECK-NEXT: smov x8, v0.h[2]
460 ; CHECK-NEXT: eor x0, x8, x8, lsl #48
462 %e = extractelement <8 x i16> %x, i64 2
463 %s = sext i16 %e to i64
469 define i64 @both_i8i64(<8 x i8> %x) {
470 ; CHECK-LABEL: both_i8i64:
472 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0
473 ; CHECK-NEXT: umov w8, v0.b[2]
474 ; CHECK-NEXT: smov x9, v0.b[2]
475 ; CHECK-NEXT: eor x0, x8, x9
477 %e = extractelement <8 x i8> %x, i64 2
478 %s = zext i8 %e to i64
479 %t = sext i8 %e to i64
484 define i64 @redundant_i8i64(<8 x i8> %x) {
485 ; CHECK-LABEL: redundant_i8i64:
487 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0
488 ; CHECK-NEXT: smov x8, v0.b[2]
489 ; CHECK-NEXT: eor x0, x8, x8, lsl #56
491 %e = extractelement <8 x i8> %x, i64 2
492 %s = sext i8 %e to i64