1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s | FileCheck %s
4 target triple = "aarch64-unknown-linux-gnu"
6 ; Currently there is no custom lowering for vector shuffles operating on types
7 ; bigger than NEON. However, having no support opens us up to a code generator
8 ; hang when expanding BUILD_VECTOR. Here we just validate the promblematic case
9 ; successfully exits code generation.
10 define void @hang_when_merging_stores_after_legalisation(ptr %a, <2 x i32> %b) vscale_range(2,2) #0 {
11 ; CHECK-LABEL: hang_when_merging_stores_after_legalisation:
13 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
14 ; CHECK-NEXT: mov z0.s, s0
15 ; CHECK-NEXT: mov z1.d, z0.d
16 ; CHECK-NEXT: ext z1.b, z1.b, z1.b, #16
17 ; CHECK-NEXT: st2 { v0.4s, v1.4s }, [x0]
19 %splat = shufflevector <2 x i32> %b, <2 x i32> undef, <8 x i32> zeroinitializer
20 %interleaved.vec = shufflevector <8 x i32> %splat, <8 x i32> undef, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7>
21 store <8 x i32> %interleaved.vec, ptr %a, align 4
25 ; Ensure we don't crash when trying to lower a shuffle via an extract
26 define void @crash_when_lowering_extract_shuffle(ptr %dst, i1 %cond) vscale_range(2,2) #0 {
27 ; CHECK-LABEL: crash_when_lowering_extract_shuffle:
29 ; CHECK-NEXT: tbnz w1, #0, .LBB1_2
30 ; CHECK-NEXT: // %bb.1: // %vector.body
31 ; CHECK-NEXT: mov z0.b, #0 // =0x0
32 ; CHECK-NEXT: ptrue p0.s
33 ; CHECK-NEXT: umov w8, v0.b[8]
34 ; CHECK-NEXT: umov w9, v0.b[9]
35 ; CHECK-NEXT: umov w10, v0.b[1]
36 ; CHECK-NEXT: mov v1.16b, v0.16b
37 ; CHECK-NEXT: umov w11, v0.b[15]
38 ; CHECK-NEXT: fmov s2, w8
39 ; CHECK-NEXT: umov w8, v0.b[10]
40 ; CHECK-NEXT: mov v1.b[1], w10
41 ; CHECK-NEXT: umov w10, v0.b[11]
42 ; CHECK-NEXT: mov v2.b[1], w9
43 ; CHECK-NEXT: umov w9, v0.b[2]
44 ; CHECK-NEXT: mov v2.b[2], w8
45 ; CHECK-NEXT: umov w8, v0.b[3]
46 ; CHECK-NEXT: mov v1.b[2], w9
47 ; CHECK-NEXT: umov w9, v0.b[12]
48 ; CHECK-NEXT: mov v2.b[3], w10
49 ; CHECK-NEXT: umov w10, v0.b[4]
50 ; CHECK-NEXT: mov v1.b[3], w8
51 ; CHECK-NEXT: umov w8, v0.b[13]
52 ; CHECK-NEXT: mov v2.b[4], w9
53 ; CHECK-NEXT: umov w9, v0.b[5]
54 ; CHECK-NEXT: mov v1.b[4], w10
55 ; CHECK-NEXT: umov w10, v0.b[14]
56 ; CHECK-NEXT: mov v2.b[5], w8
57 ; CHECK-NEXT: umov w8, v0.b[6]
58 ; CHECK-NEXT: mov v1.b[5], w9
59 ; CHECK-NEXT: umov w9, v0.b[7]
60 ; CHECK-NEXT: ext z0.b, z0.b, z0.b, #16
61 ; CHECK-NEXT: mov v2.b[6], w10
62 ; CHECK-NEXT: mov v1.b[6], w8
63 ; CHECK-NEXT: ext v3.16b, v0.16b, v0.16b, #8
64 ; CHECK-NEXT: uunpklo z0.h, z0.b
65 ; CHECK-NEXT: mov x8, #16 // =0x10
66 ; CHECK-NEXT: mov x10, #8 // =0x8
67 ; CHECK-NEXT: mov v2.b[7], w11
68 ; CHECK-NEXT: mov v1.b[7], w9
69 ; CHECK-NEXT: uunpklo z3.h, z3.b
70 ; CHECK-NEXT: uunpklo z0.s, z0.h
71 ; CHECK-NEXT: mov x9, #24 // =0x18
72 ; CHECK-NEXT: uunpklo z2.h, z2.b
73 ; CHECK-NEXT: uunpklo z1.h, z1.b
74 ; CHECK-NEXT: uunpklo z3.s, z3.h
75 ; CHECK-NEXT: lsl z0.s, z0.s, #31
76 ; CHECK-NEXT: uunpklo z2.s, z2.h
77 ; CHECK-NEXT: uunpklo z1.s, z1.h
78 ; CHECK-NEXT: lsl z3.s, z3.s, #31
79 ; CHECK-NEXT: asr z0.s, z0.s, #31
80 ; CHECK-NEXT: asr z3.s, z3.s, #31
81 ; CHECK-NEXT: lsl z2.s, z2.s, #31
82 ; CHECK-NEXT: lsl z1.s, z1.s, #31
83 ; CHECK-NEXT: and z0.s, z0.s, #0x1
84 ; CHECK-NEXT: and z3.s, z3.s, #0x1
85 ; CHECK-NEXT: asr z2.s, z2.s, #31
86 ; CHECK-NEXT: asr z1.s, z1.s, #31
87 ; CHECK-NEXT: cmpne p1.s, p0/z, z0.s, #0
88 ; CHECK-NEXT: ld1w { z0.s }, p0/z, [x0, x8, lsl #2]
89 ; CHECK-NEXT: cmpne p2.s, p0/z, z3.s, #0
90 ; CHECK-NEXT: ld1w { z3.s }, p0/z, [x0, x9, lsl #2]
91 ; CHECK-NEXT: and z2.s, z2.s, #0x1
92 ; CHECK-NEXT: and z1.s, z1.s, #0x1
93 ; CHECK-NEXT: mov z0.s, p1/m, #0 // =0x0
94 ; CHECK-NEXT: cmpne p3.s, p0/z, z2.s, #0
95 ; CHECK-NEXT: cmpne p4.s, p0/z, z1.s, #0
96 ; CHECK-NEXT: ld1w { z2.s }, p0/z, [x0, x10, lsl #2]
97 ; CHECK-NEXT: ld1w { z1.s }, p0/z, [x0]
98 ; CHECK-NEXT: mov z3.s, p2/m, #0 // =0x0
99 ; CHECK-NEXT: st1w { z0.s }, p0, [x0, x8, lsl #2]
100 ; CHECK-NEXT: mov z2.s, p3/m, #0 // =0x0
101 ; CHECK-NEXT: mov z1.s, p4/m, #0 // =0x0
102 ; CHECK-NEXT: st1w { z3.s }, p0, [x0, x9, lsl #2]
103 ; CHECK-NEXT: st1w { z2.s }, p0, [x0, x10, lsl #2]
104 ; CHECK-NEXT: st1w { z1.s }, p0, [x0]
105 ; CHECK-NEXT: .LBB1_2: // %exit
107 %broadcast.splat = shufflevector <32 x i1> zeroinitializer, <32 x i1> zeroinitializer, <32 x i32> zeroinitializer
108 br i1 %cond, label %exit, label %vector.body
111 %1 = load <32 x i32>, ptr %dst, align 16
112 %predphi = select <32 x i1> %broadcast.splat, <32 x i32> zeroinitializer, <32 x i32> %1
113 store <32 x i32> %predphi, ptr %dst, align 16
120 attributes #0 = { "target-features"="+sve" }