1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4
2 ; RUN: llc < %s -debug-only=legalize-types 2>&1 | FileCheck %s --check-prefix=CHECK-LEGALIZATION
3 ; RUN: llc < %s | FileCheck %s
6 target triple = "aarch64-unknown-linux-gnu"
7 attributes #0 = {"target-features"="+sve" uwtable}
9 declare <vscale x 2 x i64> @llvm.vector.insert.nxv2i64.v8i64(<vscale x 2 x i64>, <8 x i64>, i64)
10 declare <vscale x 2 x double> @llvm.vector.insert.nxv2f64.v8f64(<vscale x 2 x double>, <8 x double>, i64)
12 define <vscale x 2 x i64> @test_nxv2i64_v8i64(<vscale x 2 x i64> %a, <8 x i64> %b) #0 {
13 ; CHECK-LEGALIZATION-LABEL: test_nxv2i64_v8i64:
14 ; CHECK-LEGALIZATION: // %bb.0:
15 ; CHECK-LEGALIZATION-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill
16 ; CHECK-LEGALIZATION-NEXT: .cfi_def_cfa_offset 16
17 ; CHECK-LEGALIZATION-NEXT: .cfi_offset w29, -16
18 ; CHECK-LEGALIZATION-NEXT: addvl sp, sp, #-3
19 ; CHECK-LEGALIZATION-NEXT: .cfi_escape 0x0f, 0x0c, 0x8f, 0x00, 0x11, 0x10, 0x22, 0x11, 0x18, 0x92, 0x2e, 0x00, 0x1e, 0x22 // sp + 16 + 24 * VG
20 ; CHECK-LEGALIZATION-NEXT: cntd x8
21 ; CHECK-LEGALIZATION-NEXT: ptrue p0.d, vl2
22 ; CHECK-LEGALIZATION-NEXT: mov w9, #2 // =0x2
23 ; CHECK-LEGALIZATION-NEXT: sub x8, x8, #2
24 ; CHECK-LEGALIZATION-NEXT: // kill: def $q1 killed $q1 def $z1
25 ; CHECK-LEGALIZATION-NEXT: mov x10, sp
26 ; CHECK-LEGALIZATION-NEXT: cmp x8, #2
27 ; CHECK-LEGALIZATION-NEXT: mov z0.d, p0/m, z1.d
28 ; CHECK-LEGALIZATION-NEXT: ptrue p0.d
29 ; CHECK-LEGALIZATION-NEXT: csel x9, x8, x9, lo
30 ; CHECK-LEGALIZATION-NEXT: cmp x8, #4
31 ; CHECK-LEGALIZATION-NEXT: lsl x9, x9, #3
32 ; CHECK-LEGALIZATION-NEXT: st1d { z0.d }, p0, [sp]
33 ; CHECK-LEGALIZATION-NEXT: str q2, [x10, x9]
34 ; CHECK-LEGALIZATION-NEXT: mov w9, #4 // =0x4
35 ; CHECK-LEGALIZATION-NEXT: addvl x10, sp, #1
36 ; CHECK-LEGALIZATION-NEXT: ld1d { z0.d }, p0/z, [sp]
37 ; CHECK-LEGALIZATION-NEXT: csel x9, x8, x9, lo
38 ; CHECK-LEGALIZATION-NEXT: cmp x8, #6
39 ; CHECK-LEGALIZATION-NEXT: lsl x9, x9, #3
40 ; CHECK-LEGALIZATION-NEXT: st1d { z0.d }, p0, [sp, #1, mul vl]
41 ; CHECK-LEGALIZATION-NEXT: str q3, [x10, x9]
42 ; CHECK-LEGALIZATION-NEXT: mov w9, #6 // =0x6
43 ; CHECK-LEGALIZATION-NEXT: ld1d { z0.d }, p0/z, [sp, #1, mul vl]
44 ; CHECK-LEGALIZATION-NEXT: csel x8, x8, x9, lo
45 ; CHECK-LEGALIZATION-NEXT: addvl x9, sp, #2
46 ; CHECK-LEGALIZATION-NEXT: lsl x8, x8, #3
47 ; CHECK-LEGALIZATION-NEXT: st1d { z0.d }, p0, [sp, #2, mul vl]
48 ; CHECK-LEGALIZATION-NEXT: str q4, [x9, x8]
49 ; CHECK-LEGALIZATION-NEXT: ld1d { z0.d }, p0/z, [sp, #2, mul vl]
50 ; CHECK-LEGALIZATION-NEXT: addvl sp, sp, #3
51 ; CHECK-LEGALIZATION-NEXT: .cfi_def_cfa wsp, 16
52 ; CHECK-LEGALIZATION-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload
53 ; CHECK-LEGALIZATION-NEXT: .cfi_def_cfa_offset 0
54 ; CHECK-LEGALIZATION-NEXT: .cfi_restore w29
55 ; CHECK-LEGALIZATION-NEXT: ret
57 ; CHECK-LABEL: test_nxv2i64_v8i64:
59 ; CHECK-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill
60 ; CHECK-NEXT: .cfi_def_cfa_offset 16
61 ; CHECK-NEXT: .cfi_offset w29, -16
62 ; CHECK-NEXT: addvl sp, sp, #-3
63 ; CHECK-NEXT: .cfi_escape 0x0f, 0x0c, 0x8f, 0x00, 0x11, 0x10, 0x22, 0x11, 0x18, 0x92, 0x2e, 0x00, 0x1e, 0x22 // sp + 16 + 24 * VG
65 ; CHECK-NEXT: ptrue p0.d, vl2
66 ; CHECK-NEXT: mov w9, #2 // =0x2
67 ; CHECK-NEXT: sub x8, x8, #2
68 ; CHECK-NEXT: // kill: def $q1 killed $q1 def $z1
69 ; CHECK-NEXT: mov x10, sp
70 ; CHECK-NEXT: cmp x8, #2
71 ; CHECK-NEXT: mov z0.d, p0/m, z1.d
72 ; CHECK-NEXT: ptrue p0.d
73 ; CHECK-NEXT: csel x9, x8, x9, lo
74 ; CHECK-NEXT: cmp x8, #4
75 ; CHECK-NEXT: lsl x9, x9, #3
76 ; CHECK-NEXT: st1d { z0.d }, p0, [sp]
77 ; CHECK-NEXT: str q2, [x10, x9]
78 ; CHECK-NEXT: mov w9, #4 // =0x4
79 ; CHECK-NEXT: addvl x10, sp, #1
80 ; CHECK-NEXT: ld1d { z0.d }, p0/z, [sp]
81 ; CHECK-NEXT: csel x9, x8, x9, lo
82 ; CHECK-NEXT: cmp x8, #6
83 ; CHECK-NEXT: lsl x9, x9, #3
84 ; CHECK-NEXT: st1d { z0.d }, p0, [sp, #1, mul vl]
85 ; CHECK-NEXT: str q3, [x10, x9]
86 ; CHECK-NEXT: mov w9, #6 // =0x6
87 ; CHECK-NEXT: ld1d { z0.d }, p0/z, [sp, #1, mul vl]
88 ; CHECK-NEXT: csel x8, x8, x9, lo
89 ; CHECK-NEXT: addvl x9, sp, #2
90 ; CHECK-NEXT: lsl x8, x8, #3
91 ; CHECK-NEXT: st1d { z0.d }, p0, [sp, #2, mul vl]
92 ; CHECK-NEXT: str q4, [x9, x8]
93 ; CHECK-NEXT: ld1d { z0.d }, p0/z, [sp, #2, mul vl]
94 ; CHECK-NEXT: addvl sp, sp, #3
95 ; CHECK-NEXT: .cfi_def_cfa wsp, 16
96 ; CHECK-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload
97 ; CHECK-NEXT: .cfi_def_cfa_offset 0
98 ; CHECK-NEXT: .cfi_restore w29
105 %r = call <vscale x 2 x i64> @llvm.vector.insert.nxv2i64.v8i64(<vscale x 2 x i64> %a, <8 x i64> %b, i64 0)
106 ret <vscale x 2 x i64> %r
109 define <vscale x 2 x double> @test_nxv2f64_v8f64(<vscale x 2 x double> %a, <8 x double> %b) #0 {
110 ; CHECK-LEGALIZATION-LABEL: test_nxv2f64_v8f64:
111 ; CHECK-LEGALIZATION: // %bb.0:
112 ; CHECK-LEGALIZATION-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill
113 ; CHECK-LEGALIZATION-NEXT: .cfi_def_cfa_offset 16
114 ; CHECK-LEGALIZATION-NEXT: .cfi_offset w29, -16
115 ; CHECK-LEGALIZATION-NEXT: addvl sp, sp, #-3
116 ; CHECK-LEGALIZATION-NEXT: .cfi_escape 0x0f, 0x0c, 0x8f, 0x00, 0x11, 0x10, 0x22, 0x11, 0x18, 0x92, 0x2e, 0x00, 0x1e, 0x22 // sp + 16 + 24 * VG
117 ; CHECK-LEGALIZATION-NEXT: cntd x8
118 ; CHECK-LEGALIZATION-NEXT: ptrue p0.d, vl2
119 ; CHECK-LEGALIZATION-NEXT: mov w9, #2 // =0x2
120 ; CHECK-LEGALIZATION-NEXT: sub x8, x8, #2
121 ; CHECK-LEGALIZATION-NEXT: // kill: def $q1 killed $q1 def $z1
122 ; CHECK-LEGALIZATION-NEXT: mov x10, sp
123 ; CHECK-LEGALIZATION-NEXT: cmp x8, #2
124 ; CHECK-LEGALIZATION-NEXT: mov z0.d, p0/m, z1.d
125 ; CHECK-LEGALIZATION-NEXT: ptrue p0.d
126 ; CHECK-LEGALIZATION-NEXT: csel x9, x8, x9, lo
127 ; CHECK-LEGALIZATION-NEXT: cmp x8, #4
128 ; CHECK-LEGALIZATION-NEXT: lsl x9, x9, #3
129 ; CHECK-LEGALIZATION-NEXT: st1d { z0.d }, p0, [sp]
130 ; CHECK-LEGALIZATION-NEXT: str q2, [x10, x9]
131 ; CHECK-LEGALIZATION-NEXT: mov w9, #4 // =0x4
132 ; CHECK-LEGALIZATION-NEXT: addvl x10, sp, #1
133 ; CHECK-LEGALIZATION-NEXT: ld1d { z0.d }, p0/z, [sp]
134 ; CHECK-LEGALIZATION-NEXT: csel x9, x8, x9, lo
135 ; CHECK-LEGALIZATION-NEXT: cmp x8, #6
136 ; CHECK-LEGALIZATION-NEXT: lsl x9, x9, #3
137 ; CHECK-LEGALIZATION-NEXT: st1d { z0.d }, p0, [sp, #1, mul vl]
138 ; CHECK-LEGALIZATION-NEXT: str q3, [x10, x9]
139 ; CHECK-LEGALIZATION-NEXT: mov w9, #6 // =0x6
140 ; CHECK-LEGALIZATION-NEXT: ld1d { z0.d }, p0/z, [sp, #1, mul vl]
141 ; CHECK-LEGALIZATION-NEXT: csel x8, x8, x9, lo
142 ; CHECK-LEGALIZATION-NEXT: addvl x9, sp, #2
143 ; CHECK-LEGALIZATION-NEXT: lsl x8, x8, #3
144 ; CHECK-LEGALIZATION-NEXT: st1d { z0.d }, p0, [sp, #2, mul vl]
145 ; CHECK-LEGALIZATION-NEXT: str q4, [x9, x8]
146 ; CHECK-LEGALIZATION-NEXT: ld1d { z0.d }, p0/z, [sp, #2, mul vl]
147 ; CHECK-LEGALIZATION-NEXT: addvl sp, sp, #3
148 ; CHECK-LEGALIZATION-NEXT: .cfi_def_cfa wsp, 16
149 ; CHECK-LEGALIZATION-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload
150 ; CHECK-LEGALIZATION-NEXT: .cfi_def_cfa_offset 0
151 ; CHECK-LEGALIZATION-NEXT: .cfi_restore w29
152 ; CHECK-LEGALIZATION-NEXT: ret
154 ; CHECK-LABEL: test_nxv2f64_v8f64:
156 ; CHECK-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill
157 ; CHECK-NEXT: .cfi_def_cfa_offset 16
158 ; CHECK-NEXT: .cfi_offset w29, -16
159 ; CHECK-NEXT: addvl sp, sp, #-3
160 ; CHECK-NEXT: .cfi_escape 0x0f, 0x0c, 0x8f, 0x00, 0x11, 0x10, 0x22, 0x11, 0x18, 0x92, 0x2e, 0x00, 0x1e, 0x22 // sp + 16 + 24 * VG
161 ; CHECK-NEXT: cntd x8
162 ; CHECK-NEXT: ptrue p0.d, vl2
163 ; CHECK-NEXT: mov w9, #2 // =0x2
164 ; CHECK-NEXT: sub x8, x8, #2
165 ; CHECK-NEXT: // kill: def $q1 killed $q1 def $z1
166 ; CHECK-NEXT: mov x10, sp
167 ; CHECK-NEXT: cmp x8, #2
168 ; CHECK-NEXT: mov z0.d, p0/m, z1.d
169 ; CHECK-NEXT: ptrue p0.d
170 ; CHECK-NEXT: csel x9, x8, x9, lo
171 ; CHECK-NEXT: cmp x8, #4
172 ; CHECK-NEXT: lsl x9, x9, #3
173 ; CHECK-NEXT: st1d { z0.d }, p0, [sp]
174 ; CHECK-NEXT: str q2, [x10, x9]
175 ; CHECK-NEXT: mov w9, #4 // =0x4
176 ; CHECK-NEXT: addvl x10, sp, #1
177 ; CHECK-NEXT: ld1d { z0.d }, p0/z, [sp]
178 ; CHECK-NEXT: csel x9, x8, x9, lo
179 ; CHECK-NEXT: cmp x8, #6
180 ; CHECK-NEXT: lsl x9, x9, #3
181 ; CHECK-NEXT: st1d { z0.d }, p0, [sp, #1, mul vl]
182 ; CHECK-NEXT: str q3, [x10, x9]
183 ; CHECK-NEXT: mov w9, #6 // =0x6
184 ; CHECK-NEXT: ld1d { z0.d }, p0/z, [sp, #1, mul vl]
185 ; CHECK-NEXT: csel x8, x8, x9, lo
186 ; CHECK-NEXT: addvl x9, sp, #2
187 ; CHECK-NEXT: lsl x8, x8, #3
188 ; CHECK-NEXT: st1d { z0.d }, p0, [sp, #2, mul vl]
189 ; CHECK-NEXT: str q4, [x9, x8]
190 ; CHECK-NEXT: ld1d { z0.d }, p0/z, [sp, #2, mul vl]
191 ; CHECK-NEXT: addvl sp, sp, #3
192 ; CHECK-NEXT: .cfi_def_cfa wsp, 16
193 ; CHECK-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload
194 ; CHECK-NEXT: .cfi_def_cfa_offset 0
195 ; CHECK-NEXT: .cfi_restore w29
202 %r = call <vscale x 2 x double> @llvm.vector.insert.nxv2f64.v8f64(<vscale x 2 x double> %a, <8 x double> %b, i64 0)
203 ret <vscale x 2 x double> %r