1 # RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sve -run-pass=prologepilog -simplify-mir -verify-machineinstrs %s -o - | FileCheck %s
2 # RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sve -start-before=prologepilog -simplify-mir -verify-machineinstrs %s -o - | FileCheck %s --check-prefix=CHECK-OFFSET
5 define void @testcase_valid_offset() nounwind { entry: unreachable }
6 define void @testcase_offset_out_of_range() nounwind { entry: unreachable }
9 name: testcase_valid_offset
10 tracksRegLiveness: true
12 - { id: 0, name: '', type: default, offset: 0, size: 512, alignment: 16, stack-id: scalable-vector }
17 ; CHECK-LABEL: name: testcase_valid_offset
20 ; CHECK-NEXT: early-clobber $sp = frame-setup STRXpre killed $fp, $sp, -16 :: (store (s64) into %stack.1)
21 ; CHECK-NEXT: $sp = frame-setup ADDVL_XXI $sp, -32
22 ; CHECK-NEXT: renamable $z0_z1 = LD2B_IMM renamable $p0, $sp, -8
23 ; CHECK-NEXT: renamable $z0_z1 = LD2B_IMM renamable $p0, $sp, 7
24 ; CHECK-NEXT: renamable $z0_z1 = LD2H_IMM renamable $p0, $sp, -8
25 ; CHECK-NEXT: renamable $z0_z1 = LD2H_IMM renamable $p0, $sp, 7
26 ; CHECK-NEXT: renamable $z0_z1 = LD2W_IMM renamable $p0, $sp, -8
27 ; CHECK-NEXT: renamable $z0_z1 = LD2W_IMM renamable $p0, $sp, 7
28 ; CHECK-NEXT: renamable $z0_z1 = LD2D_IMM renamable $p0, $sp, -8
29 ; CHECK-NEXT: renamable $z0_z1 = LD2D_IMM renamable $p0, $sp, 7
30 ; CHECK-NEXT: renamable $z0_z1_z2 = LD3B_IMM renamable $p0, $sp, -8
31 ; CHECK-NEXT: renamable $z0_z1_z2 = LD3B_IMM renamable $p0, $sp, 7
32 ; CHECK-NEXT: renamable $z0_z1_z2 = LD3H_IMM renamable $p0, $sp, -8
33 ; CHECK-NEXT: renamable $z0_z1_z2 = LD3H_IMM renamable $p0, $sp, 7
34 ; CHECK-NEXT: renamable $z0_z1_z2 = LD3W_IMM renamable $p0, $sp, -8
35 ; CHECK-NEXT: renamable $z0_z1_z2 = LD3W_IMM renamable $p0, $sp, 7
36 ; CHECK-NEXT: renamable $z0_z1_z2 = LD3D_IMM renamable $p0, $sp, -8
37 ; CHECK-NEXT: renamable $z0_z1_z2 = LD3D_IMM renamable $p0, $sp, 7
38 ; CHECK-NEXT: renamable $z0_z1_z2_z3 = LD4B_IMM renamable $p0, $sp, -8
39 ; CHECK-NEXT: renamable $z0_z1_z2_z3 = LD4B_IMM renamable $p0, $sp, 7
40 ; CHECK-NEXT: renamable $z0_z1_z2_z3 = LD4H_IMM renamable $p0, $sp, -8
41 ; CHECK-NEXT: renamable $z0_z1_z2_z3 = LD4H_IMM renamable $p0, $sp, 7
42 ; CHECK-NEXT: renamable $z0_z1_z2_z3 = LD4W_IMM renamable $p0, $sp, -8
43 ; CHECK-NEXT: renamable $z0_z1_z2_z3 = LD4W_IMM renamable $p0, $sp, 7
44 ; CHECK-NEXT: renamable $z0_z1_z2_z3 = LD4D_IMM renamable $p0, $sp, -8
45 ; CHECK-NEXT: renamable $z0_z1_z2_z3 = LD4D_IMM renamable $p0, $sp, 7
46 ; CHECK-NEXT: $sp = frame-destroy ADDVL_XXI $sp, 31
47 ; CHECK-NEXT: $sp = frame-destroy ADDVL_XXI $sp, 1
48 ; CHECK-NEXT: early-clobber $sp, $fp = frame-destroy LDRXpost $sp, 16 :: (load (s64) from %stack.1)
49 ; CHECK-NEXT: RET_ReallyLR implicit $z0, implicit $z1, implicit $z2, implicit $z3
51 ; CHECK-OFFSET-LABEL: testcase_valid_offset:
52 ; CHECK-OFFSET: str x29, [sp, #-16]!
53 ; CHECK-OFFSET-NEXT: addvl sp, sp, #-32
54 ; CHECK-OFFSET-NEXT: ld2b { z0.b, z1.b }, p0/z, [sp, #-16, mul vl]
55 ; CHECK-OFFSET-NEXT: ld2b { z0.b, z1.b }, p0/z, [sp, #14, mul vl]
56 ; CHECK-OFFSET-NEXT: ld2h { z0.h, z1.h }, p0/z, [sp, #-16, mul vl]
57 ; CHECK-OFFSET-NEXT: ld2h { z0.h, z1.h }, p0/z, [sp, #14, mul vl]
58 ; CHECK-OFFSET-NEXT: ld2w { z0.s, z1.s }, p0/z, [sp, #-16, mul vl]
59 ; CHECK-OFFSET-NEXT: ld2w { z0.s, z1.s }, p0/z, [sp, #14, mul vl]
60 ; CHECK-OFFSET-NEXT: ld2d { z0.d, z1.d }, p0/z, [sp, #-16, mul vl]
61 ; CHECK-OFFSET-NEXT: ld2d { z0.d, z1.d }, p0/z, [sp, #14, mul vl]
62 ; CHECK-OFFSET-NEXT: ld3b { z0.b - z2.b }, p0/z, [sp, #-24, mul vl]
63 ; CHECK-OFFSET-NEXT: ld3b { z0.b - z2.b }, p0/z, [sp, #21, mul vl]
64 ; CHECK-OFFSET-NEXT: ld3h { z0.h - z2.h }, p0/z, [sp, #-24, mul vl]
65 ; CHECK-OFFSET-NEXT: ld3h { z0.h - z2.h }, p0/z, [sp, #21, mul vl]
66 ; CHECK-OFFSET-NEXT: ld3w { z0.s - z2.s }, p0/z, [sp, #-24, mul vl]
67 ; CHECK-OFFSET-NEXT: ld3w { z0.s - z2.s }, p0/z, [sp, #21, mul vl]
68 ; CHECK-OFFSET-NEXT: ld3d { z0.d - z2.d }, p0/z, [sp, #-24, mul vl]
69 ; CHECK-OFFSET-NEXT: ld3d { z0.d - z2.d }, p0/z, [sp, #21, mul vl]
70 ; CHECK-OFFSET-NEXT: ld4b { z0.b - z3.b }, p0/z, [sp, #-32, mul vl]
71 ; CHECK-OFFSET-NEXT: ld4b { z0.b - z3.b }, p0/z, [sp, #28, mul vl]
72 ; CHECK-OFFSET-NEXT: ld4h { z0.h - z3.h }, p0/z, [sp, #-32, mul vl]
73 ; CHECK-OFFSET-NEXT: ld4h { z0.h - z3.h }, p0/z, [sp, #28, mul vl]
74 ; CHECK-OFFSET-NEXT: ld4w { z0.s - z3.s }, p0/z, [sp, #-32, mul vl]
75 ; CHECK-OFFSET-NEXT: ld4w { z0.s - z3.s }, p0/z, [sp, #28, mul vl]
76 ; CHECK-OFFSET-NEXT: ld4d { z0.d - z3.d }, p0/z, [sp, #-32, mul vl]
77 ; CHECK-OFFSET-NEXT: ld4d { z0.d - z3.d }, p0/z, [sp, #28, mul vl]
78 ; CHECK-OFFSET-NEXT: addvl sp, sp, #31
79 ; CHECK-OFFSET-NEXT: addvl sp, sp, #1
80 ; CHECK-OFFSET-NEXT: ldr x29, [sp], #16
81 ; CHECK-OFFSET-NEXT: ret
83 renamable $z0_z1 = LD2B_IMM renamable $p0, %stack.0, -8
84 renamable $z0_z1 = LD2B_IMM renamable $p0, %stack.0, 7
85 renamable $z0_z1 = LD2H_IMM renamable $p0, %stack.0, -8
86 renamable $z0_z1 = LD2H_IMM renamable $p0, %stack.0, 7
87 renamable $z0_z1 = LD2W_IMM renamable $p0, %stack.0, -8
88 renamable $z0_z1 = LD2W_IMM renamable $p0, %stack.0, 7
89 renamable $z0_z1 = LD2D_IMM renamable $p0, %stack.0, -8
90 renamable $z0_z1 = LD2D_IMM renamable $p0, %stack.0, 7
92 renamable $z0_z1_z2 = LD3B_IMM renamable $p0, %stack.0, -8
93 renamable $z0_z1_z2 = LD3B_IMM renamable $p0, %stack.0, 7
94 renamable $z0_z1_z2 = LD3H_IMM renamable $p0, %stack.0, -8
95 renamable $z0_z1_z2 = LD3H_IMM renamable $p0, %stack.0, 7
96 renamable $z0_z1_z2 = LD3W_IMM renamable $p0, %stack.0, -8
97 renamable $z0_z1_z2 = LD3W_IMM renamable $p0, %stack.0, 7
98 renamable $z0_z1_z2 = LD3D_IMM renamable $p0, %stack.0, -8
99 renamable $z0_z1_z2 = LD3D_IMM renamable $p0, %stack.0, 7
101 renamable $z0_z1_z2_z3 = LD4B_IMM renamable $p0, %stack.0, -8
102 renamable $z0_z1_z2_z3 = LD4B_IMM renamable $p0, %stack.0, 7
103 renamable $z0_z1_z2_z3 = LD4H_IMM renamable $p0, %stack.0, -8
104 renamable $z0_z1_z2_z3 = LD4H_IMM renamable $p0, %stack.0, 7
105 renamable $z0_z1_z2_z3 = LD4W_IMM renamable $p0, %stack.0, -8
106 renamable $z0_z1_z2_z3 = LD4W_IMM renamable $p0, %stack.0, 7
107 renamable $z0_z1_z2_z3 = LD4D_IMM renamable $p0, %stack.0, -8
108 renamable $z0_z1_z2_z3 = LD4D_IMM renamable $p0, %stack.0, 7
109 RET_ReallyLR implicit $z0, implicit $z1, implicit $z2, implicit $z3
112 name: testcase_offset_out_of_range
113 tracksRegLiveness: true
115 - { id: 0, name: '', type: default, offset: 0, size: 512, alignment: 16, stack-id: scalable-vector }
120 ; CHECK-LABEL: name: testcase_offset_out_of_range
121 ; CHECK: liveins: $p0
123 ; CHECK-NEXT: early-clobber $sp = frame-setup STRXpre killed $fp, $sp, -16 :: (store (s64) into %stack.1)
124 ; CHECK-NEXT: $sp = frame-setup ADDVL_XXI $sp, -32
125 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, -2
126 ; CHECK-NEXT: renamable $z0_z1 = LD2B_IMM renamable $p0, killed $x8, -8
127 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, 2
128 ; CHECK-NEXT: renamable $z0_z1 = LD2B_IMM renamable $p0, killed $x8, 7
129 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, -2
130 ; CHECK-NEXT: renamable $z0_z1 = LD2H_IMM renamable $p0, killed $x8, -8
131 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, 2
132 ; CHECK-NEXT: renamable $z0_z1 = LD2H_IMM renamable $p0, killed $x8, 7
133 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, -2
134 ; CHECK-NEXT: renamable $z0_z1 = LD2W_IMM renamable $p0, killed $x8, -8
135 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, 2
136 ; CHECK-NEXT: renamable $z0_z1 = LD2W_IMM renamable $p0, killed $x8, 7
137 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, -2
138 ; CHECK-NEXT: renamable $z0_z1 = LD2D_IMM renamable $p0, killed $x8, -8
139 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, 2
140 ; CHECK-NEXT: renamable $z0_z1 = LD2D_IMM renamable $p0, killed $x8, 7
141 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, -3
142 ; CHECK-NEXT: renamable $z0_z1_z2 = LD3B_IMM renamable $p0, killed $x8, -8
143 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, 3
144 ; CHECK-NEXT: renamable $z0_z1_z2 = LD3B_IMM renamable $p0, killed $x8, 7
145 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, -3
146 ; CHECK-NEXT: renamable $z0_z1_z2 = LD3H_IMM renamable $p0, killed $x8, -8
147 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, 3
148 ; CHECK-NEXT: renamable $z0_z1_z2 = LD3H_IMM renamable $p0, killed $x8, 7
149 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, -3
150 ; CHECK-NEXT: renamable $z0_z1_z2 = LD3W_IMM renamable $p0, killed $x8, -8
151 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, 3
152 ; CHECK-NEXT: renamable $z0_z1_z2 = LD3W_IMM renamable $p0, killed $x8, 7
153 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, -3
154 ; CHECK-NEXT: renamable $z0_z1_z2 = LD3D_IMM renamable $p0, killed $x8, -8
155 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, 3
156 ; CHECK-NEXT: renamable $z0_z1_z2 = LD3D_IMM renamable $p0, killed $x8, 7
157 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, -4
158 ; CHECK-NEXT: renamable $z0_z1_z2_z3 = LD4B_IMM renamable $p0, killed $x8, -8
159 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, 4
160 ; CHECK-NEXT: renamable $z0_z1_z2_z3 = LD4B_IMM renamable $p0, killed $x8, 7
161 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, -4
162 ; CHECK-NEXT: renamable $z0_z1_z2_z3 = LD4H_IMM renamable $p0, killed $x8, -8
163 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, 4
164 ; CHECK-NEXT: renamable $z0_z1_z2_z3 = LD4H_IMM renamable $p0, killed $x8, 7
165 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, -4
166 ; CHECK-NEXT: renamable $z0_z1_z2_z3 = LD4W_IMM renamable $p0, killed $x8, -8
167 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, 4
168 ; CHECK-NEXT: renamable $z0_z1_z2_z3 = LD4W_IMM renamable $p0, killed $x8, 7
169 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, -4
170 ; CHECK-NEXT: renamable $z0_z1_z2_z3 = LD4D_IMM renamable $p0, killed $x8, -8
171 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, 4
172 ; CHECK-NEXT: renamable $z0_z1_z2_z3 = LD4D_IMM renamable $p0, killed $x8, 7
173 ; CHECK-NEXT: $sp = frame-destroy ADDVL_XXI $sp, 31
174 ; CHECK-NEXT: $sp = frame-destroy ADDVL_XXI $sp, 1
175 ; CHECK-NEXT: early-clobber $sp, $fp = frame-destroy LDRXpost $sp, 16 :: (load (s64) from %stack.1)
176 ; CHECK-NEXT: RET_ReallyLR implicit $z0, implicit $z1, implicit $z2, implicit $z3
178 ; CHECK-OFFSET-LABEL: testcase_offset_out_of_range:
179 ; CHECK-OFFSET: str x29, [sp, #-16]!
180 ; CHECK-OFFSET-NEXT: addvl sp, sp, #-32
181 ; CHECK-OFFSET-NEXT: addvl x8, sp, #-2
182 ; CHECK-OFFSET-NEXT: ld2b { z0.b, z1.b }, p0/z, [x8, #-16, mul vl]
183 ; CHECK-OFFSET-NEXT: addvl x8, sp, #2
184 ; CHECK-OFFSET-NEXT: ld2b { z0.b, z1.b }, p0/z, [x8, #14, mul vl]
185 ; CHECK-OFFSET-NEXT: addvl x8, sp, #-2
186 ; CHECK-OFFSET-NEXT: ld2h { z0.h, z1.h }, p0/z, [x8, #-16, mul vl]
187 ; CHECK-OFFSET-NEXT: addvl x8, sp, #2
188 ; CHECK-OFFSET-NEXT: ld2h { z0.h, z1.h }, p0/z, [x8, #14, mul vl]
189 ; CHECK-OFFSET-NEXT: addvl x8, sp, #-2
190 ; CHECK-OFFSET-NEXT: ld2w { z0.s, z1.s }, p0/z, [x8, #-16, mul vl]
191 ; CHECK-OFFSET-NEXT: addvl x8, sp, #2
192 ; CHECK-OFFSET-NEXT: ld2w { z0.s, z1.s }, p0/z, [x8, #14, mul vl]
193 ; CHECK-OFFSET-NEXT: addvl x8, sp, #-2
194 ; CHECK-OFFSET-NEXT: ld2d { z0.d, z1.d }, p0/z, [x8, #-16, mul vl]
195 ; CHECK-OFFSET-NEXT: addvl x8, sp, #2
196 ; CHECK-OFFSET-NEXT: ld2d { z0.d, z1.d }, p0/z, [x8, #14, mul vl]
197 ; CHECK-OFFSET-NEXT: addvl x8, sp, #-3
198 ; CHECK-OFFSET-NEXT: ld3b { z0.b - z2.b }, p0/z, [x8, #-24, mul vl]
199 ; CHECK-OFFSET-NEXT: addvl x8, sp, #3
200 ; CHECK-OFFSET-NEXT: ld3b { z0.b - z2.b }, p0/z, [x8, #21, mul vl]
201 ; CHECK-OFFSET-NEXT: addvl x8, sp, #-3
202 ; CHECK-OFFSET-NEXT: ld3h { z0.h - z2.h }, p0/z, [x8, #-24, mul vl]
203 ; CHECK-OFFSET-NEXT: addvl x8, sp, #3
204 ; CHECK-OFFSET-NEXT: ld3h { z0.h - z2.h }, p0/z, [x8, #21, mul vl]
205 ; CHECK-OFFSET-NEXT: addvl x8, sp, #-3
206 ; CHECK-OFFSET-NEXT: ld3w { z0.s - z2.s }, p0/z, [x8, #-24, mul vl]
207 ; CHECK-OFFSET-NEXT: addvl x8, sp, #3
208 ; CHECK-OFFSET-NEXT: ld3w { z0.s - z2.s }, p0/z, [x8, #21, mul vl]
209 ; CHECK-OFFSET-NEXT: addvl x8, sp, #-3
210 ; CHECK-OFFSET-NEXT: ld3d { z0.d - z2.d }, p0/z, [x8, #-24, mul vl]
211 ; CHECK-OFFSET-NEXT: addvl x8, sp, #3
212 ; CHECK-OFFSET-NEXT: ld3d { z0.d - z2.d }, p0/z, [x8, #21, mul vl]
213 ; CHECK-OFFSET-NEXT: addvl x8, sp, #-4
214 ; CHECK-OFFSET-NEXT: ld4b { z0.b - z3.b }, p0/z, [x8, #-32, mul vl]
215 ; CHECK-OFFSET-NEXT: addvl x8, sp, #4
216 ; CHECK-OFFSET-NEXT: ld4b { z0.b - z3.b }, p0/z, [x8, #28, mul vl]
217 ; CHECK-OFFSET-NEXT: addvl x8, sp, #-4
218 ; CHECK-OFFSET-NEXT: ld4h { z0.h - z3.h }, p0/z, [x8, #-32, mul vl]
219 ; CHECK-OFFSET-NEXT: addvl x8, sp, #4
220 ; CHECK-OFFSET-NEXT: ld4h { z0.h - z3.h }, p0/z, [x8, #28, mul vl]
221 ; CHECK-OFFSET-NEXT: addvl x8, sp, #-4
222 ; CHECK-OFFSET-NEXT: ld4w { z0.s - z3.s }, p0/z, [x8, #-32, mul vl]
223 ; CHECK-OFFSET-NEXT: addvl x8, sp, #4
224 ; CHECK-OFFSET-NEXT: ld4w { z0.s - z3.s }, p0/z, [x8, #28, mul vl]
225 ; CHECK-OFFSET-NEXT: addvl x8, sp, #-4
226 ; CHECK-OFFSET-NEXT: ld4d { z0.d - z3.d }, p0/z, [x8, #-32, mul vl]
227 ; CHECK-OFFSET-NEXT: addvl x8, sp, #4
228 ; CHECK-OFFSET-NEXT: ld4d { z0.d - z3.d }, p0/z, [x8, #28, mul vl]
229 ; CHECK-OFFSET-NEXT: addvl sp, sp, #31
230 ; CHECK-OFFSET-NEXT: addvl sp, sp, #1
231 ; CHECK-OFFSET-NEXT: ldr x29, [sp], #16
232 ; CHECK-OFFSET-NEXT: ret
234 renamable $z0_z1 = LD2B_IMM renamable $p0, %stack.0, -9
235 renamable $z0_z1 = LD2B_IMM renamable $p0, %stack.0, 8
236 renamable $z0_z1 = LD2H_IMM renamable $p0, %stack.0, -9
237 renamable $z0_z1 = LD2H_IMM renamable $p0, %stack.0, 8
238 renamable $z0_z1 = LD2W_IMM renamable $p0, %stack.0, -9
239 renamable $z0_z1 = LD2W_IMM renamable $p0, %stack.0, 8
240 renamable $z0_z1 = LD2D_IMM renamable $p0, %stack.0, -9
241 renamable $z0_z1 = LD2D_IMM renamable $p0, %stack.0, 8
243 renamable $z0_z1_z2 = LD3B_IMM renamable $p0, %stack.0, -9
244 renamable $z0_z1_z2 = LD3B_IMM renamable $p0, %stack.0, 8
245 renamable $z0_z1_z2 = LD3H_IMM renamable $p0, %stack.0, -9
246 renamable $z0_z1_z2 = LD3H_IMM renamable $p0, %stack.0, 8
247 renamable $z0_z1_z2 = LD3W_IMM renamable $p0, %stack.0, -9
248 renamable $z0_z1_z2 = LD3W_IMM renamable $p0, %stack.0, 8
249 renamable $z0_z1_z2 = LD3D_IMM renamable $p0, %stack.0, -9
250 renamable $z0_z1_z2 = LD3D_IMM renamable $p0, %stack.0, 8
252 renamable $z0_z1_z2_z3 = LD4B_IMM renamable $p0, %stack.0, -9
253 renamable $z0_z1_z2_z3 = LD4B_IMM renamable $p0, %stack.0, 8
254 renamable $z0_z1_z2_z3 = LD4H_IMM renamable $p0, %stack.0, -9
255 renamable $z0_z1_z2_z3 = LD4H_IMM renamable $p0, %stack.0, 8
256 renamable $z0_z1_z2_z3 = LD4W_IMM renamable $p0, %stack.0, -9
257 renamable $z0_z1_z2_z3 = LD4W_IMM renamable $p0, %stack.0, 8
258 renamable $z0_z1_z2_z3 = LD4D_IMM renamable $p0, %stack.0, -9
259 renamable $z0_z1_z2_z3 = LD4D_IMM renamable $p0, %stack.0, 8
260 RET_ReallyLR implicit $z0, implicit $z1, implicit $z2, implicit $z3