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
18 ; CHECK: liveins: $p0, $z0
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: ST2B_IMM renamable $z0_z1, renamable $p0, $sp, -8
23 ; CHECK-NEXT: ST2B_IMM renamable $z0_z1, renamable $p0, $sp, 7
24 ; CHECK-NEXT: ST2H_IMM renamable $z0_z1, renamable $p0, $sp, -8
25 ; CHECK-NEXT: ST2H_IMM renamable $z0_z1, renamable $p0, $sp, 7
26 ; CHECK-NEXT: ST2W_IMM renamable $z0_z1, renamable $p0, $sp, -8
27 ; CHECK-NEXT: ST2W_IMM renamable $z0_z1, renamable $p0, $sp, 7
28 ; CHECK-NEXT: ST2D_IMM renamable $z0_z1, renamable $p0, $sp, -8
29 ; CHECK-NEXT: ST2D_IMM renamable $z0_z1, renamable $p0, $sp, 7
30 ; CHECK-NEXT: ST3B_IMM renamable $z0_z1_z2, renamable $p0, $sp, -8
31 ; CHECK-NEXT: ST3B_IMM renamable $z0_z1_z2, renamable $p0, $sp, 7
32 ; CHECK-NEXT: ST3H_IMM renamable $z0_z1_z2, renamable $p0, $sp, -8
33 ; CHECK-NEXT: ST3H_IMM renamable $z0_z1_z2, renamable $p0, $sp, 7
34 ; CHECK-NEXT: ST3W_IMM renamable $z0_z1_z2, renamable $p0, $sp, -8
35 ; CHECK-NEXT: ST3W_IMM renamable $z0_z1_z2, renamable $p0, $sp, 7
36 ; CHECK-NEXT: ST3D_IMM renamable $z0_z1_z2, renamable $p0, $sp, -8
37 ; CHECK-NEXT: ST3D_IMM renamable $z0_z1_z2, renamable $p0, $sp, 7
38 ; CHECK-NEXT: ST4B_IMM renamable $z0_z1_z2_z3, renamable $p0, $sp, -8
39 ; CHECK-NEXT: ST4B_IMM renamable $z0_z1_z2_z3, renamable $p0, $sp, 7
40 ; CHECK-NEXT: ST4H_IMM renamable $z0_z1_z2_z3, renamable $p0, $sp, -8
41 ; CHECK-NEXT: ST4H_IMM renamable $z0_z1_z2_z3, renamable $p0, $sp, 7
42 ; CHECK-NEXT: ST4W_IMM renamable $z0_z1_z2_z3, renamable $p0, $sp, -8
43 ; CHECK-NEXT: ST4W_IMM renamable $z0_z1_z2_z3, renamable $p0, $sp, 7
44 ; CHECK-NEXT: ST4D_IMM renamable $z0_z1_z2_z3, renamable $p0, $sp, -8
45 ; CHECK-NEXT: ST4D_IMM renamable $z0_z1_z2_z3, 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
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: st2b { z0.b, z1.b }, p0, [sp, #-16, mul vl]
55 ; CHECK-OFFSET-NEXT: st2b { z0.b, z1.b }, p0, [sp, #14, mul vl]
56 ; CHECK-OFFSET-NEXT: st2h { z0.h, z1.h }, p0, [sp, #-16, mul vl]
57 ; CHECK-OFFSET-NEXT: st2h { z0.h, z1.h }, p0, [sp, #14, mul vl]
58 ; CHECK-OFFSET-NEXT: st2w { z0.s, z1.s }, p0, [sp, #-16, mul vl]
59 ; CHECK-OFFSET-NEXT: st2w { z0.s, z1.s }, p0, [sp, #14, mul vl]
60 ; CHECK-OFFSET-NEXT: st2d { z0.d, z1.d }, p0, [sp, #-16, mul vl]
61 ; CHECK-OFFSET-NEXT: st2d { z0.d, z1.d }, p0, [sp, #14, mul vl]
62 ; CHECK-OFFSET-NEXT: st3b { z0.b - z2.b }, p0, [sp, #-24, mul vl]
63 ; CHECK-OFFSET-NEXT: st3b { z0.b - z2.b }, p0, [sp, #21, mul vl]
64 ; CHECK-OFFSET-NEXT: st3h { z0.h - z2.h }, p0, [sp, #-24, mul vl]
65 ; CHECK-OFFSET-NEXT: st3h { z0.h - z2.h }, p0, [sp, #21, mul vl]
66 ; CHECK-OFFSET-NEXT: st3w { z0.s - z2.s }, p0, [sp, #-24, mul vl]
67 ; CHECK-OFFSET-NEXT: st3w { z0.s - z2.s }, p0, [sp, #21, mul vl]
68 ; CHECK-OFFSET-NEXT: st3d { z0.d - z2.d }, p0, [sp, #-24, mul vl]
69 ; CHECK-OFFSET-NEXT: st3d { z0.d - z2.d }, p0, [sp, #21, mul vl]
70 ; CHECK-OFFSET-NEXT: st4b { z0.b - z3.b }, p0, [sp, #-32, mul vl]
71 ; CHECK-OFFSET-NEXT: st4b { z0.b - z3.b }, p0, [sp, #28, mul vl]
72 ; CHECK-OFFSET-NEXT: st4h { z0.h - z3.h }, p0, [sp, #-32, mul vl]
73 ; CHECK-OFFSET-NEXT: st4h { z0.h - z3.h }, p0, [sp, #28, mul vl]
74 ; CHECK-OFFSET-NEXT: st4w { z0.s - z3.s }, p0, [sp, #-32, mul vl]
75 ; CHECK-OFFSET-NEXT: st4w { z0.s - z3.s }, p0, [sp, #28, mul vl]
76 ; CHECK-OFFSET-NEXT: st4d { z0.d - z3.d }, p0, [sp, #-32, mul vl]
77 ; CHECK-OFFSET-NEXT: st4d { z0.d - z3.d }, p0, [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 ST2B_IMM renamable $z0_z1, renamable $p0, %stack.0, -8
84 ST2B_IMM renamable $z0_z1, renamable $p0, %stack.0, 7
85 ST2H_IMM renamable $z0_z1, renamable $p0, %stack.0, -8
86 ST2H_IMM renamable $z0_z1, renamable $p0, %stack.0, 7
87 ST2W_IMM renamable $z0_z1, renamable $p0, %stack.0, -8
88 ST2W_IMM renamable $z0_z1, renamable $p0, %stack.0, 7
89 ST2D_IMM renamable $z0_z1, renamable $p0, %stack.0, -8
90 ST2D_IMM renamable $z0_z1, renamable $p0, %stack.0, 7
92 ST3B_IMM renamable $z0_z1_z2, renamable $p0, %stack.0, -8
93 ST3B_IMM renamable $z0_z1_z2, renamable $p0, %stack.0, 7
94 ST3H_IMM renamable $z0_z1_z2, renamable $p0, %stack.0, -8
95 ST3H_IMM renamable $z0_z1_z2, renamable $p0, %stack.0, 7
96 ST3W_IMM renamable $z0_z1_z2, renamable $p0, %stack.0, -8
97 ST3W_IMM renamable $z0_z1_z2, renamable $p0, %stack.0, 7
98 ST3D_IMM renamable $z0_z1_z2, renamable $p0, %stack.0, -8
99 ST3D_IMM renamable $z0_z1_z2, renamable $p0, %stack.0, 7
101 ST4B_IMM renamable $z0_z1_z2_z3, renamable $p0, %stack.0, -8
102 ST4B_IMM renamable $z0_z1_z2_z3, renamable $p0, %stack.0, 7
103 ST4H_IMM renamable $z0_z1_z2_z3, renamable $p0, %stack.0, -8
104 ST4H_IMM renamable $z0_z1_z2_z3, renamable $p0, %stack.0, 7
105 ST4W_IMM renamable $z0_z1_z2_z3, renamable $p0, %stack.0, -8
106 ST4W_IMM renamable $z0_z1_z2_z3, renamable $p0, %stack.0, 7
107 ST4D_IMM renamable $z0_z1_z2_z3, renamable $p0, %stack.0, -8
108 ST4D_IMM renamable $z0_z1_z2_z3, renamable $p0, %stack.0, 7
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, $z0
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: ST2B_IMM renamable $z0_z1, renamable $p0, killed $x8, -8
127 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, 2
128 ; CHECK-NEXT: ST2B_IMM renamable $z0_z1, renamable $p0, killed $x8, 7
129 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, -2
130 ; CHECK-NEXT: ST2H_IMM renamable $z0_z1, renamable $p0, killed $x8, -8
131 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, 2
132 ; CHECK-NEXT: ST2H_IMM renamable $z0_z1, renamable $p0, killed $x8, 7
133 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, -2
134 ; CHECK-NEXT: ST2W_IMM renamable $z0_z1, renamable $p0, killed $x8, -8
135 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, 2
136 ; CHECK-NEXT: ST2W_IMM renamable $z0_z1, renamable $p0, killed $x8, 7
137 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, -2
138 ; CHECK-NEXT: ST2D_IMM renamable $z0_z1, renamable $p0, killed $x8, -8
139 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, 2
140 ; CHECK-NEXT: ST2D_IMM renamable $z0_z1, renamable $p0, killed $x8, 7
141 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, -3
142 ; CHECK-NEXT: ST3B_IMM renamable $z0_z1_z2, renamable $p0, killed $x8, -8
143 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, 3
144 ; CHECK-NEXT: ST3B_IMM renamable $z0_z1_z2, renamable $p0, killed $x8, 7
145 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, -3
146 ; CHECK-NEXT: ST3H_IMM renamable $z0_z1_z2, renamable $p0, killed $x8, -8
147 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, 3
148 ; CHECK-NEXT: ST3H_IMM renamable $z0_z1_z2, renamable $p0, killed $x8, 7
149 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, -3
150 ; CHECK-NEXT: ST3W_IMM renamable $z0_z1_z2, renamable $p0, killed $x8, -8
151 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, 3
152 ; CHECK-NEXT: ST3W_IMM renamable $z0_z1_z2, renamable $p0, killed $x8, 7
153 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, -3
154 ; CHECK-NEXT: ST3D_IMM renamable $z0_z1_z2, renamable $p0, killed $x8, -8
155 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, 3
156 ; CHECK-NEXT: ST3D_IMM renamable $z0_z1_z2, renamable $p0, killed $x8, 7
157 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, -4
158 ; CHECK-NEXT: ST4B_IMM renamable $z0_z1_z2_z3, renamable $p0, killed $x8, -8
159 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, 4
160 ; CHECK-NEXT: ST4B_IMM renamable $z0_z1_z2_z3, renamable $p0, killed $x8, 7
161 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, -4
162 ; CHECK-NEXT: ST4H_IMM renamable $z0_z1_z2_z3, renamable $p0, killed $x8, -8
163 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, 4
164 ; CHECK-NEXT: ST4H_IMM renamable $z0_z1_z2_z3, renamable $p0, killed $x8, 7
165 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, -4
166 ; CHECK-NEXT: ST4W_IMM renamable $z0_z1_z2_z3, renamable $p0, killed $x8, -8
167 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, 4
168 ; CHECK-NEXT: ST4W_IMM renamable $z0_z1_z2_z3, renamable $p0, killed $x8, 7
169 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, -4
170 ; CHECK-NEXT: ST4D_IMM renamable $z0_z1_z2_z3, renamable $p0, killed $x8, -8
171 ; CHECK-NEXT: $x8 = ADDVL_XXI $sp, 4
172 ; CHECK-NEXT: ST4D_IMM renamable $z0_z1_z2_z3, 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
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: st2b { z0.b, z1.b }, p0, [x8, #-16, mul vl]
183 ; CHECK-OFFSET-NEXT: addvl x8, sp, #2
184 ; CHECK-OFFSET-NEXT: st2b { z0.b, z1.b }, p0, [x8, #14, mul vl]
185 ; CHECK-OFFSET-NEXT: addvl x8, sp, #-2
186 ; CHECK-OFFSET-NEXT: st2h { z0.h, z1.h }, p0, [x8, #-16, mul vl]
187 ; CHECK-OFFSET-NEXT: addvl x8, sp, #2
188 ; CHECK-OFFSET-NEXT: st2h { z0.h, z1.h }, p0, [x8, #14, mul vl]
189 ; CHECK-OFFSET-NEXT: addvl x8, sp, #-2
190 ; CHECK-OFFSET-NEXT: st2w { z0.s, z1.s }, p0, [x8, #-16, mul vl]
191 ; CHECK-OFFSET-NEXT: addvl x8, sp, #2
192 ; CHECK-OFFSET-NEXT: st2w { z0.s, z1.s }, p0, [x8, #14, mul vl]
193 ; CHECK-OFFSET-NEXT: addvl x8, sp, #-2
194 ; CHECK-OFFSET-NEXT: st2d { z0.d, z1.d }, p0, [x8, #-16, mul vl]
195 ; CHECK-OFFSET-NEXT: addvl x8, sp, #2
196 ; CHECK-OFFSET-NEXT: st2d { z0.d, z1.d }, p0, [x8, #14, mul vl]
197 ; CHECK-OFFSET-NEXT: addvl x8, sp, #-3
198 ; CHECK-OFFSET-NEXT: st3b { z0.b - z2.b }, p0, [x8, #-24, mul vl]
199 ; CHECK-OFFSET-NEXT: addvl x8, sp, #3
200 ; CHECK-OFFSET-NEXT: st3b { z0.b - z2.b }, p0, [x8, #21, mul vl]
201 ; CHECK-OFFSET-NEXT: addvl x8, sp, #-3
202 ; CHECK-OFFSET-NEXT: st3h { z0.h - z2.h }, p0, [x8, #-24, mul vl]
203 ; CHECK-OFFSET-NEXT: addvl x8, sp, #3
204 ; CHECK-OFFSET-NEXT: st3h { z0.h - z2.h }, p0, [x8, #21, mul vl]
205 ; CHECK-OFFSET-NEXT: addvl x8, sp, #-3
206 ; CHECK-OFFSET-NEXT: st3w { z0.s - z2.s }, p0, [x8, #-24, mul vl]
207 ; CHECK-OFFSET-NEXT: addvl x8, sp, #3
208 ; CHECK-OFFSET-NEXT: st3w { z0.s - z2.s }, p0, [x8, #21, mul vl]
209 ; CHECK-OFFSET-NEXT: addvl x8, sp, #-3
210 ; CHECK-OFFSET-NEXT: st3d { z0.d - z2.d }, p0, [x8, #-24, mul vl]
211 ; CHECK-OFFSET-NEXT: addvl x8, sp, #3
212 ; CHECK-OFFSET-NEXT: st3d { z0.d - z2.d }, p0, [x8, #21, mul vl]
213 ; CHECK-OFFSET-NEXT: addvl x8, sp, #-4
214 ; CHECK-OFFSET-NEXT: st4b { z0.b - z3.b }, p0, [x8, #-32, mul vl]
215 ; CHECK-OFFSET-NEXT: addvl x8, sp, #4
216 ; CHECK-OFFSET-NEXT: st4b { z0.b - z3.b }, p0, [x8, #28, mul vl]
217 ; CHECK-OFFSET-NEXT: addvl x8, sp, #-4
218 ; CHECK-OFFSET-NEXT: st4h { z0.h - z3.h }, p0, [x8, #-32, mul vl]
219 ; CHECK-OFFSET-NEXT: addvl x8, sp, #4
220 ; CHECK-OFFSET-NEXT: st4h { z0.h - z3.h }, p0, [x8, #28, mul vl]
221 ; CHECK-OFFSET-NEXT: addvl x8, sp, #-4
222 ; CHECK-OFFSET-NEXT: st4w { z0.s - z3.s }, p0, [x8, #-32, mul vl]
223 ; CHECK-OFFSET-NEXT: addvl x8, sp, #4
224 ; CHECK-OFFSET-NEXT: st4w { z0.s - z3.s }, p0, [x8, #28, mul vl]
225 ; CHECK-OFFSET-NEXT: addvl x8, sp, #-4
226 ; CHECK-OFFSET-NEXT: st4d { z0.d - z3.d }, p0, [x8, #-32, mul vl]
227 ; CHECK-OFFSET-NEXT: addvl x8, sp, #4
228 ; CHECK-OFFSET-NEXT: st4d { z0.d - z3.d }, p0, [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 ST2B_IMM renamable $z0_z1, renamable $p0, %stack.0, -9
235 ST2B_IMM renamable $z0_z1, renamable $p0, %stack.0, 8
236 ST2H_IMM renamable $z0_z1, renamable $p0, %stack.0, -9
237 ST2H_IMM renamable $z0_z1, renamable $p0, %stack.0, 8
238 ST2W_IMM renamable $z0_z1, renamable $p0, %stack.0, -9
239 ST2W_IMM renamable $z0_z1, renamable $p0, %stack.0, 8
240 ST2D_IMM renamable $z0_z1, renamable $p0, %stack.0, -9
241 ST2D_IMM renamable $z0_z1, renamable $p0, %stack.0, 8
243 ST3B_IMM renamable $z0_z1_z2, renamable $p0, %stack.0, -9
244 ST3B_IMM renamable $z0_z1_z2, renamable $p0, %stack.0, 8
245 ST3H_IMM renamable $z0_z1_z2, renamable $p0, %stack.0, -9
246 ST3H_IMM renamable $z0_z1_z2, renamable $p0, %stack.0, 8
247 ST3W_IMM renamable $z0_z1_z2, renamable $p0, %stack.0, -9
248 ST3W_IMM renamable $z0_z1_z2, renamable $p0, %stack.0, 8
249 ST3D_IMM renamable $z0_z1_z2, renamable $p0, %stack.0, -9
250 ST3D_IMM renamable $z0_z1_z2, renamable $p0, %stack.0, 8
252 ST4B_IMM renamable $z0_z1_z2_z3, renamable $p0, %stack.0, -9
253 ST4B_IMM renamable $z0_z1_z2_z3, renamable $p0, %stack.0, 8
254 ST4H_IMM renamable $z0_z1_z2_z3, renamable $p0, %stack.0, -9
255 ST4H_IMM renamable $z0_z1_z2_z3, renamable $p0, %stack.0, 8
256 ST4W_IMM renamable $z0_z1_z2_z3, renamable $p0, %stack.0, -9
257 ST4W_IMM renamable $z0_z1_z2_z3, renamable $p0, %stack.0, 8
258 ST4D_IMM renamable $z0_z1_z2_z3, renamable $p0, %stack.0, -9
259 ST4D_IMM renamable $z0_z1_z2_z3, renamable $p0, %stack.0, 8