aboutsummaryrefslogtreecommitdiff
blob: 33bbdfaa2cfd16f79c1b112b08a43e646fdce30d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --extra_scrub
; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sve -O0 -global-isel=0 -global-isel-abort=0 < %s | FileCheck %s
; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sve -O0 -global-isel=1 -global-isel-abort=0 < %s | FileCheck %s --check-prefix=GISEL

; Test that z0 is saved/restored, as the unwinder may only retain the low 64bits (d0).
define <vscale x 4 x i32> @invoke_callee_may_throw_sve(<vscale x 4 x i32> %v) personality i8 0 {
; CHECK-LABEL: invoke_callee_may_throw_sve:
; CHECK:       .Lfunc_begin0:
; CHECK-NEXT:    .cfi_startproc
; CHECK-NEXT:  // %bb.0:
; CHECK-NEXT:    stp x29, x30, [sp, #-16]! // 16-byte Folded Spill
; CHECK-NEXT:    addvl sp, sp, #-18
; CHECK-NEXT:    str p15, [sp, #4, mul vl] // 2-byte Folded Spill
; CHECK-NEXT:    str p14, [sp, #5, mul vl] // 2-byte Folded Spill
; CHECK-NEXT:    str p13, [sp, #6, mul vl] // 2-byte Folded Spill
; CHECK-NEXT:    str p12, [sp, #7, mul vl] // 2-byte Folded Spill
; CHECK-NEXT:    str p11, [sp, #8, mul vl] // 2-byte Folded Spill
; CHECK-NEXT:    str p10, [sp, #9, mul vl] // 2-byte Folded Spill
; CHECK-NEXT:    str p9, [sp, #10, mul vl] // 2-byte Folded Spill
; CHECK-NEXT:    str p8, [sp, #11, mul vl] // 2-byte Folded Spill
; CHECK-NEXT:    str p7, [sp, #12, mul vl] // 2-byte Folded Spill
; CHECK-NEXT:    str p6, [sp, #13, mul vl] // 2-byte Folded Spill
; CHECK-NEXT:    str p5, [sp, #14, mul vl] // 2-byte Folded Spill
; CHECK-NEXT:    str p4, [sp, #15, mul vl] // 2-byte Folded Spill
; CHECK-NEXT:    str z23, [sp, #2, mul vl] // 16-byte Folded Spill
; CHECK-NEXT:    str z22, [sp, #3, mul vl] // 16-byte Folded Spill
; CHECK-NEXT:    str z21, [sp, #4, mul vl] // 16-byte Folded Spill
; CHECK-NEXT:    str z20, [sp, #5, mul vl] // 16-byte Folded Spill
; CHECK-NEXT:    str z19, [sp, #6, mul vl] // 16-byte Folded Spill
; CHECK-NEXT:    str z18, [sp, #7, mul vl] // 16-byte Folded Spill
; CHECK-NEXT:    str z17, [sp, #8, mul vl] // 16-byte Folded Spill
; CHECK-NEXT:    str z16, [sp, #9, mul vl] // 16-byte Folded Spill
; CHECK-NEXT:    str z15, [sp, #10, mul vl] // 16-byte Folded Spill
; CHECK-NEXT:    str z14, [sp, #11, mul vl] // 16-byte Folded Spill
; CHECK-NEXT:    str z13, [sp, #12, mul vl] // 16-byte Folded Spill
; CHECK-NEXT:    str z12, [sp, #13, mul vl] // 16-byte Folded Spill
; CHECK-NEXT:    str z11, [sp, #14, mul vl] // 16-byte Folded Spill
; CHECK-NEXT:    str z10, [sp, #15, mul vl] // 16-byte Folded Spill
; CHECK-NEXT:    str z9, [sp, #16, mul vl] // 16-byte Folded Spill
; CHECK-NEXT:    str z8, [sp, #17, mul vl] // 16-byte Folded Spill
; CHECK-NEXT:    addvl sp, sp, #-2
; CHECK-NEXT:    .cfi_escape 0x0f, 0x0d, 0x8f, 0x00, 0x11, 0x10, 0x22, 0x11, 0xa0, 0x01, 0x92, 0x2e, 0x00, 0x1e, 0x22 // sp + 16 + 160 * VG
; CHECK-NEXT:    .cfi_escape 0x10, 0x48, 0x0a, 0x11, 0x70, 0x22, 0x11, 0x78, 0x92, 0x2e, 0x00, 0x1e, 0x22 // $d8 @ cfa - 16 - 8 * VG
; CHECK-NEXT:    .cfi_escape 0x10, 0x49, 0x0a, 0x11, 0x70, 0x22, 0x11, 0x70, 0x92, 0x2e, 0x00, 0x1e, 0x22 // $d9 @ cfa - 16 - 16 * VG
; CHECK-NEXT:    .cfi_escape 0x10, 0x4a, 0x0a, 0x11, 0x70, 0x22, 0x11, 0x68, 0x92, 0x2e, 0x00, 0x1e, 0x22 // $d10 @ cfa - 16 - 24 * VG
; CHECK-NEXT:    .cfi_escape 0x10, 0x4b, 0x0a, 0x11, 0x70, 0x22, 0x11, 0x60, 0x92, 0x2e, 0x00, 0x1e, 0x22 // $d11 @ cfa - 16 - 32 * VG
; CHECK-NEXT:    .cfi_escape 0x10, 0x4c, 0x0a, 0x11, 0x70, 0x22, 0x11, 0x58, 0x92, 0x2e, 0x00, 0x1e, 0x22 // $d12 @ cfa - 16 - 40 * VG
; CHECK-NEXT:    .cfi_escape 0x10, 0x4d, 0x0a, 0x11, 0x70, 0x22, 0x11, 0x50, 0x92, 0x2e, 0x00, 0x1e, 0x22 // $d13 @ cfa - 16 - 48 * VG
; CHECK-NEXT:    .cfi_escape 0x10, 0x4e, 0x0a, 0x11, 0x70, 0x22, 0x11, 0x48, 0x92, 0x2e, 0x00, 0x1e, 0x22 // $d14 @ cfa - 16 - 56 * VG
; CHECK-NEXT:    .cfi_escape 0x10, 0x4f, 0x0a, 0x11, 0x70, 0x22, 0x11, 0x40, 0x92, 0x2e, 0x00, 0x1e, 0x22 // $d15 @ cfa - 16 - 64 * VG
; CHECK-NEXT:    .cfi_offset w30, -8
; CHECK-NEXT:    .cfi_offset w29, -16
; CHECK-NEXT:    str z0, [sp] // 16-byte Folded Spill
; CHECK-NEXT:  .Ltmp0:
; CHECK-NEXT:    bl may_throw_sve
; CHECK-NEXT:  .Ltmp1:
; CHECK-NEXT:    str z0, [sp, #1, mul vl] // 16-byte Folded Spill
; CHECK-NEXT:    b .LBB0_1
; CHECK-NEXT:  .LBB0_1: // %.Lcontinue
; CHECK-NEXT:    ldr z0, [sp, #1, mul vl] // 16-byte Folded Reload
; CHECK-NEXT:    addvl sp, sp, #2
; CHECK-NEXT:    ldr p15, [sp, #4, mul vl] // 2-byte Folded Reload
; CHECK-NEXT:    ldr p14, [sp, #5, mul vl] // 2-byte Folded Reload
; CHECK-NEXT:    ldr p13, [sp, #6, mul vl] // 2-byte Folded Reload
; CHECK-NEXT:    ldr p12, [sp, #7, mul vl] // 2-byte Folded Reload
; CHECK-NEXT:    ldr p11, [sp, #8, mul vl] // 2-byte Folded Reload
; CHECK-NEXT:    ldr p10, [sp, #9, mul vl] // 2-byte Folded Reload
; CHECK-NEXT:    ldr p9, [sp, #10, mul vl] // 2-byte Folded Reload
; CHECK-NEXT:    ldr p8, [sp, #11, mul vl] // 2-byte Folded Reload
; CHECK-NEXT:    ldr p7, [sp, #12, mul vl] // 2-byte Folded Reload
; CHECK-NEXT:    ldr p6, [sp, #13, mul vl] // 2-byte Folded Reload
; CHECK-NEXT:    ldr p5, [sp, #14, mul vl] // 2-byte Folded Reload
; CHECK-NEXT:    ldr p4, [sp, #15, mul vl] // 2-byte Folded Reload
; CHECK-NEXT:    ldr z23, [sp, #2, mul vl] // 16-byte Folded Reload
; CHECK-NEXT:    ldr z22, [sp, #3, mul vl] // 16-byte Folded Reload
; CHECK-NEXT:    ldr z21, [sp, #4, mul vl] // 16-byte Folded Reload
; CHECK-NEXT:    ldr z20, [sp, #5, mul vl] // 16-byte Folded Reload
; CHECK-NEXT:    ldr z19, [sp, #6, mul vl] // 16-byte Folded Reload
; CHECK-NEXT:    ldr z18, [sp, #7, mul vl] // 16-byte Folded Reload
; CHECK-NEXT:    ldr z17, [sp, #8, mul vl] // 16-byte Folded Reload
; CHECK-NEXT:    ldr z16, [sp, #9, mul vl] // 16-byte Folded Reload
; CHECK-NEXT:    ldr z15, [sp, #10, mul vl] // 16-byte Folded Reload
; CHECK-NEXT:    ldr z14, [sp, #11, mul vl] // 16-byte Folded Reload
; CHECK-NEXT:    ldr z13, [sp, #12, mul vl] // 16-byte Folded Reload
; CHECK-NEXT:    ldr z12, [sp, #13, mul vl] // 16-byte Folded Reload
; CHECK-NEXT:    ldr z11, [sp, #14, mul vl] // 16-byte Folded Reload
; CHECK-NEXT:    ldr z10, [sp, #15, mul vl] // 16-byte Folded Reload
; CHECK-NEXT:    ldr z9, [sp, #16, mul vl] // 16-byte Folded Reload
; CHECK-NEXT:    ldr z8, [sp, #17, mul vl] // 16-byte Folded Reload
; CHECK-NEXT:    addvl sp, sp, #18
; CHECK-NEXT:    ldp x29, x30, [sp], #16 // 16-byte Folded Reload
; CHECK-NEXT:    ret
; CHECK-NEXT:  .LBB0_2: // %.Lunwind
; CHECK-NEXT:  .Ltmp2:
; CHECK-NEXT:    ldr z0, [sp] // 16-byte Folded Reload
; CHECK-NEXT:    addvl sp, sp, #2
; CHECK-NEXT:    ldr p15, [sp, #4, mul vl] // 2-byte Folded Reload
; CHECK-NEXT:    ldr p14, [sp, #5, mul vl] // 2-byte Folded Reload
; CHECK-NEXT:    ldr p13, [sp, #6, mul vl] // 2-byte Folded Reload
; CHECK-NEXT:    ldr p12, [sp, #7, mul vl] // 2-byte Folded Reload
; CHECK-NEXT:    ldr p11, [sp, #8, mul vl] // 2-byte Folded Reload
; CHECK-NEXT:    ldr p10, [sp, #9, mul vl] // 2-byte Folded Reload
; CHECK-NEXT:    ldr p9, [sp, #10, mul vl] // 2-byte Folded Reload
; CHECK-NEXT:    ldr p8, [sp, #11, mul vl] // 2-byte Folded Reload
; CHECK-NEXT:    ldr p7, [sp, #12, mul vl] // 2-byte Folded Reload
; CHECK-NEXT:    ldr p6, [sp, #13, mul vl] // 2-byte Folded Reload
; CHECK-NEXT:    ldr p5, [sp, #14, mul vl] // 2-byte Folded Reload
; CHECK-NEXT:    ldr p4, [sp, #15, mul vl] // 2-byte Folded Reload
; CHECK-NEXT:    ldr z23, [sp, #2, mul vl] // 16-byte Folded Reload
; CHECK-NEXT:    ldr z22, [sp, #3, mul vl] // 16-byte Folded Reload
; CHECK-NEXT:    ldr z21, [sp, #4, mul vl] // 16-byte Folded Reload
; CHECK-NEXT:    ldr z20, [sp, #5, mul vl] // 16-byte Folded Reload
; CHECK-NEXT:    ldr z19, [sp, #6, mul vl] // 16-byte Folded Reload
; CHECK-NEXT:    ldr z18, [sp, #7, mul vl] // 16-byte Folded Reload
; CHECK-NEXT:    ldr z17, [sp, #8, mul vl] // 16-byte Folded Reload
; CHECK-NEXT:    ldr z16, [sp, #9, mul vl] // 16-byte Folded Reload
; CHECK-NEXT:    ldr z15, [sp, #10, mul vl] // 16-byte Folded Reload
; CHECK-NEXT:    ldr z14, [sp, #11, mul vl] // 16-byte Folded Reload
; CHECK-NEXT:    ldr z13, [sp, #12, mul vl] // 16-byte Folded Reload
; CHECK-NEXT:    ldr z12, [sp, #13, mul vl] // 16-byte Folded Reload
; CHECK-NEXT:    ldr z11, [sp, #14, mul vl] // 16-byte Folded Reload
; CHECK-NEXT:    ldr z10, [sp, #15, mul vl] // 16-byte Folded Reload
; CHECK-NEXT:    ldr z9, [sp, #16, mul vl] // 16-byte Folded Reload
; CHECK-NEXT:    ldr z8, [sp, #17, mul vl] // 16-byte Folded Reload
; CHECK-NEXT:    addvl sp, sp, #18
; CHECK-NEXT:    ldp x29, x30, [sp], #16 // 16-byte Folded Reload
; CHECK-NEXT:    ret
;
; GISEL-LABEL: invoke_callee_may_throw_sve:
; GISEL:       .Lfunc_begin0:
; GISEL-NEXT:    .cfi_startproc
; GISEL-NEXT:  // %bb.0:
; GISEL-NEXT:    stp x29, x30, [sp, #-16]! // 16-byte Folded Spill
; GISEL-NEXT:    addvl sp, sp, #-18
; GISEL-NEXT:    str p15, [sp, #4, mul vl] // 2-byte Folded Spill
; GISEL-NEXT:    str p14, [sp, #5, mul vl] // 2-byte Folded Spill
; GISEL-NEXT:    str p13, [sp, #6, mul vl] // 2-byte Folded Spill
; GISEL-NEXT:    str p12, [sp, #7, mul vl] // 2-byte Folded Spill
; GISEL-NEXT:    str p11, [sp, #8, mul vl] // 2-byte Folded Spill
; GISEL-NEXT:    str p10, [sp, #9, mul vl] // 2-byte Folded Spill
; GISEL-NEXT:    str p9, [sp, #10, mul vl] // 2-byte Folded Spill
; GISEL-NEXT:    str p8, [sp, #11, mul vl] // 2-byte Folded Spill
; GISEL-NEXT:    str p7, [sp, #12, mul vl] // 2-byte Folded Spill
; GISEL-NEXT:    str p6, [sp, #13, mul vl] // 2-byte Folded Spill
; GISEL-NEXT:    str p5, [sp, #14, mul vl] // 2-byte Folded Spill
; GISEL-NEXT:    str p4, [sp, #15, mul vl] // 2-byte Folded Spill
; GISEL-NEXT:    str z23, [sp, #2, mul vl] // 16-byte Folded Spill
; GISEL-NEXT:    str z22, [sp, #3, mul vl] // 16-byte Folded Spill
; GISEL-NEXT:    str z21, [sp, #4, mul vl] // 16-byte Folded Spill
; GISEL-NEXT:    str z20, [sp, #5, mul vl] // 16-byte Folded Spill
; GISEL-NEXT:    str z19, [sp, #6, mul vl] // 16-byte Folded Spill
; GISEL-NEXT:    str z18, [sp, #7, mul vl] // 16-byte Folded Spill
; GISEL-NEXT:    str z17, [sp, #8, mul vl] // 16-byte Folded Spill
; GISEL-NEXT:    str z16, [sp, #9, mul vl] // 16-byte Folded Spill
; GISEL-NEXT:    str z15, [sp, #10, mul vl] // 16-byte Folded Spill
; GISEL-NEXT:    str z14, [sp, #11, mul vl] // 16-byte Folded Spill
; GISEL-NEXT:    str z13, [sp, #12, mul vl] // 16-byte Folded Spill
; GISEL-NEXT:    str z12, [sp, #13, mul vl] // 16-byte Folded Spill
; GISEL-NEXT:    str z11, [sp, #14, mul vl] // 16-byte Folded Spill
; GISEL-NEXT:    str z10, [sp, #15, mul vl] // 16-byte Folded Spill
; GISEL-NEXT:    str z9, [sp, #16, mul vl] // 16-byte Folded Spill
; GISEL-NEXT:    str z8, [sp, #17, mul vl] // 16-byte Folded Spill
; GISEL-NEXT:    addvl sp, sp, #-2
; GISEL-NEXT:    .cfi_escape 0x0f, 0x0d, 0x8f, 0x00, 0x11, 0x10, 0x22, 0x11, 0xa0, 0x01, 0x92, 0x2e, 0x00, 0x1e, 0x22 // sp + 16 + 160 * VG
; GISEL-NEXT:    .cfi_escape 0x10, 0x48, 0x0a, 0x11, 0x70, 0x22, 0x11, 0x78, 0x92, 0x2e, 0x00, 0x1e, 0x22 // $d8 @ cfa - 16 - 8 * VG
; GISEL-NEXT:    .cfi_escape 0x10, 0x49, 0x0a, 0x11, 0x70, 0x22, 0x11, 0x70, 0x92, 0x2e, 0x00, 0x1e, 0x22 // $d9 @ cfa - 16 - 16 * VG
; GISEL-NEXT:    .cfi_escape 0x10, 0x4a, 0x0a, 0x11, 0x70, 0x22, 0x11, 0x68, 0x92, 0x2e, 0x00, 0x1e, 0x22 // $d10 @ cfa - 16 - 24 * VG
; GISEL-NEXT:    .cfi_escape 0x10, 0x4b, 0x0a, 0x11, 0x70, 0x22, 0x11, 0x60, 0x92, 0x2e, 0x00, 0x1e, 0x22 // $d11 @ cfa - 16 - 32 * VG
; GISEL-NEXT:    .cfi_escape 0x10, 0x4c, 0x0a, 0x11, 0x70, 0x22, 0x11, 0x58, 0x92, 0x2e, 0x00, 0x1e, 0x22 // $d12 @ cfa - 16 - 40 * VG
; GISEL-NEXT:    .cfi_escape 0x10, 0x4d, 0x0a, 0x11, 0x70, 0x22, 0x11, 0x50, 0x92, 0x2e, 0x00, 0x1e, 0x22 // $d13 @ cfa - 16 - 48 * VG
; GISEL-NEXT:    .cfi_escape 0x10, 0x4e, 0x0a, 0x11, 0x70, 0x22, 0x11, 0x48, 0x92, 0x2e, 0x00, 0x1e, 0x22 // $d14 @ cfa - 16 - 56 * VG
; GISEL-NEXT:    .cfi_escape 0x10, 0x4f, 0x0a, 0x11, 0x70, 0x22, 0x11, 0x40, 0x92, 0x2e, 0x00, 0x1e, 0x22 // $d15 @ cfa - 16 - 64 * VG
; GISEL-NEXT:    .cfi_offset w30, -8
; GISEL-NEXT:    .cfi_offset w29, -16
; GISEL-NEXT:    str z0, [sp] // 16-byte Folded Spill
; GISEL-NEXT:  .Ltmp0:
; GISEL-NEXT:    bl may_throw_sve
; GISEL-NEXT:  .Ltmp1:
; GISEL-NEXT:    str z0, [sp, #1, mul vl] // 16-byte Folded Spill
; GISEL-NEXT:    b .LBB0_1
; GISEL-NEXT:  .LBB0_1: // %.Lcontinue
; GISEL-NEXT:    ldr z0, [sp, #1, mul vl] // 16-byte Folded Reload
; GISEL-NEXT:    addvl sp, sp, #2
; GISEL-NEXT:    ldr p15, [sp, #4, mul vl] // 2-byte Folded Reload
; GISEL-NEXT:    ldr p14, [sp, #5, mul vl] // 2-byte Folded Reload
; GISEL-NEXT:    ldr p13, [sp, #6, mul vl] // 2-byte Folded Reload
; GISEL-NEXT:    ldr p12, [sp, #7, mul vl] // 2-byte Folded Reload
; GISEL-NEXT:    ldr p11, [sp, #8, mul vl] // 2-byte Folded Reload
; GISEL-NEXT:    ldr p10, [sp, #9, mul vl] // 2-byte Folded Reload
; GISEL-NEXT:    ldr p9, [sp, #10, mul vl] // 2-byte Folded Reload
; GISEL-NEXT:    ldr p8, [sp, #11, mul vl] // 2-byte Folded Reload
; GISEL-NEXT:    ldr p7, [sp, #12, mul vl] // 2-byte Folded Reload
; GISEL-NEXT:    ldr p6, [sp, #13, mul vl] // 2-byte Folded Reload
; GISEL-NEXT:    ldr p5, [sp, #14, mul vl] // 2-byte Folded Reload
; GISEL-NEXT:    ldr p4, [sp, #15, mul vl] // 2-byte Folded Reload
; GISEL-NEXT:    ldr z23, [sp, #2, mul vl] // 16-byte Folded Reload
; GISEL-NEXT:    ldr z22, [sp, #3, mul vl] // 16-byte Folded Reload
; GISEL-NEXT:    ldr z21, [sp, #4, mul vl] // 16-byte Folded Reload
; GISEL-NEXT:    ldr z20, [sp, #5, mul vl] // 16-byte Folded Reload
; GISEL-NEXT:    ldr z19, [sp, #6, mul vl] // 16-byte Folded Reload
; GISEL-NEXT:    ldr z18, [sp, #7, mul vl] // 16-byte Folded Reload
; GISEL-NEXT:    ldr z17, [sp, #8, mul vl] // 16-byte Folded Reload
; GISEL-NEXT:    ldr z16, [sp, #9, mul vl] // 16-byte Folded Reload
; GISEL-NEXT:    ldr z15, [sp, #10, mul vl] // 16-byte Folded Reload
; GISEL-NEXT:    ldr z14, [sp, #11, mul vl] // 16-byte Folded Reload
; GISEL-NEXT:    ldr z13, [sp, #12, mul vl] // 16-byte Folded Reload
; GISEL-NEXT:    ldr z12, [sp, #13, mul vl] // 16-byte Folded Reload
; GISEL-NEXT:    ldr z11, [sp, #14, mul vl] // 16-byte Folded Reload
; GISEL-NEXT:    ldr z10, [sp, #15, mul vl] // 16-byte Folded Reload
; GISEL-NEXT:    ldr z9, [sp, #16, mul vl] // 16-byte Folded Reload
; GISEL-NEXT:    ldr z8, [sp, #17, mul vl] // 16-byte Folded Reload
; GISEL-NEXT:    addvl sp, sp, #18
; GISEL-NEXT:    ldp x29, x30, [sp], #16 // 16-byte Folded Reload
; GISEL-NEXT:    ret
; GISEL-NEXT:  .LBB0_2: // %.Lunwind
; GISEL-NEXT:  .Ltmp2:
; GISEL-NEXT:    ldr z0, [sp] // 16-byte Folded Reload
; GISEL-NEXT:    addvl sp, sp, #2
; GISEL-NEXT:    ldr p15, [sp, #4, mul vl] // 2-byte Folded Reload
; GISEL-NEXT:    ldr p14, [sp, #5, mul vl] // 2-byte Folded Reload
; GISEL-NEXT:    ldr p13, [sp, #6, mul vl] // 2-byte Folded Reload
; GISEL-NEXT:    ldr p12, [sp, #7, mul vl] // 2-byte Folded Reload
; GISEL-NEXT:    ldr p11, [sp, #8, mul vl] // 2-byte Folded Reload
; GISEL-NEXT:    ldr p10, [sp, #9, mul vl] // 2-byte Folded Reload
; GISEL-NEXT:    ldr p9, [sp, #10, mul vl] // 2-byte Folded Reload
; GISEL-NEXT:    ldr p8, [sp, #11, mul vl] // 2-byte Folded Reload
; GISEL-NEXT:    ldr p7, [sp, #12, mul vl] // 2-byte Folded Reload
; GISEL-NEXT:    ldr p6, [sp, #13, mul vl] // 2-byte Folded Reload
; GISEL-NEXT:    ldr p5, [sp, #14, mul vl] // 2-byte Folded Reload
; GISEL-NEXT:    ldr p4, [sp, #15, mul vl] // 2-byte Folded Reload
; GISEL-NEXT:    ldr z23, [sp, #2, mul vl] // 16-byte Folded Reload
; GISEL-NEXT:    ldr z22, [sp, #3, mul vl] // 16-byte Folded Reload
; GISEL-NEXT:    ldr z21, [sp, #4, mul vl] // 16-byte Folded Reload
; GISEL-NEXT:    ldr z20, [sp, #5, mul vl] // 16-byte Folded Reload
; GISEL-NEXT:    ldr z19, [sp, #6, mul vl] // 16-byte Folded Reload
; GISEL-NEXT:    ldr z18, [sp, #7, mul vl] // 16-byte Folded Reload
; GISEL-NEXT:    ldr z17, [sp, #8, mul vl] // 16-byte Folded Reload
; GISEL-NEXT:    ldr z16, [sp, #9, mul vl] // 16-byte Folded Reload
; GISEL-NEXT:    ldr z15, [sp, #10, mul vl] // 16-byte Folded Reload
; GISEL-NEXT:    ldr z14, [sp, #11, mul vl] // 16-byte Folded Reload
; GISEL-NEXT:    ldr z13, [sp, #12, mul vl] // 16-byte Folded Reload
; GISEL-NEXT:    ldr z12, [sp, #13, mul vl] // 16-byte Folded Reload
; GISEL-NEXT:    ldr z11, [sp, #14, mul vl] // 16-byte Folded Reload
; GISEL-NEXT:    ldr z10, [sp, #15, mul vl] // 16-byte Folded Reload
; GISEL-NEXT:    ldr z9, [sp, #16, mul vl] // 16-byte Folded Reload
; GISEL-NEXT:    ldr z8, [sp, #17, mul vl] // 16-byte Folded Reload
; GISEL-NEXT:    addvl sp, sp, #18
; GISEL-NEXT:    ldp x29, x30, [sp], #16 // 16-byte Folded Reload
; GISEL-NEXT:    ret
  %result = invoke <vscale x 4 x i32> @may_throw_sve(<vscale x 4 x i32> %v) to label %.Lcontinue unwind label %.Lunwind
.Lcontinue:
  ret <vscale x 4 x i32> %result
.Lunwind:
  %lp = landingpad { i8*, i32 } cleanup
  ret <vscale x 4 x i32> %v;
}

declare <vscale x 4 x i32> @may_throw_sve(<vscale x 4 x i32> %v);


; Test that q0 is saved/restored, as the unwinder may only retain the low 64bits (d0).
define aarch64_vector_pcs <4 x i32> @invoke_callee_may_throw_neon(<4 x i32> %v) personality i8 0 {
; CHECK-LABEL: invoke_callee_may_throw_neon:
; CHECK:       .Lfunc_begin1:
; CHECK-NEXT:    .cfi_startproc
; CHECK-NEXT:  // %bb.0:
; CHECK-NEXT:    sub sp, sp, #304 // =304
; CHECK-NEXT:    stp q23, q22, [sp, #32] // 32-byte Folded Spill
; CHECK-NEXT:    stp q21, q20, [sp, #64] // 32-byte Folded Spill
; CHECK-NEXT:    stp q19, q18, [sp, #96] // 32-byte Folded Spill
; CHECK-NEXT:    stp q17, q16, [sp, #128] // 32-byte Folded Spill
; CHECK-NEXT:    stp q15, q14, [sp, #160] // 32-byte Folded Spill
; CHECK-NEXT:    stp q13, q12, [sp, #192] // 32-byte Folded Spill
; CHECK-NEXT:    stp q11, q10, [sp, #224] // 32-byte Folded Spill
; CHECK-NEXT:    stp q9, q8, [sp, #256] // 32-byte Folded Spill
; CHECK-NEXT:    stp x29, x30, [sp, #288] // 16-byte Folded Spill
; CHECK-NEXT:    .cfi_def_cfa_offset 304
; CHECK-NEXT:    .cfi_offset w30, -8
; CHECK-NEXT:    .cfi_offset w29, -16
; CHECK-NEXT:    .cfi_offset b8, -32
; CHECK-NEXT:    .cfi_offset b9, -48
; CHECK-NEXT:    .cfi_offset b10, -64
; CHECK-NEXT:    .cfi_offset b11, -80
; CHECK-NEXT:    .cfi_offset b12, -96
; CHECK-NEXT:    .cfi_offset b13, -112
; CHECK-NEXT:    .cfi_offset b14, -128
; CHECK-NEXT:    .cfi_offset b15, -144
; CHECK-NEXT:    .cfi_offset b16, -160
; CHECK-NEXT:    .cfi_offset b17, -176
; CHECK-NEXT:    .cfi_offset b18, -192
; CHECK-NEXT:    .cfi_offset b19, -208
; CHECK-NEXT:    .cfi_offset b20, -224
; CHECK-NEXT:    .cfi_offset b21, -240
; CHECK-NEXT:    .cfi_offset b22, -256
; CHECK-NEXT:    .cfi_offset b23, -272
; CHECK-NEXT:    str q0, [sp] // 16-byte Folded Spill
; CHECK-NEXT:  .Ltmp3:
; CHECK-NEXT:    bl may_throw_neon
; CHECK-NEXT:  .Ltmp4:
; CHECK-NEXT:    str q0, [sp, #16] // 16-byte Folded Spill
; CHECK-NEXT:    b .LBB1_1
; CHECK-NEXT:  .LBB1_1: // %.Lcontinue
; CHECK-NEXT:    ldr q0, [sp, #16] // 16-byte Folded Reload
; CHECK-NEXT:    ldp x29, x30, [sp, #288] // 16-byte Folded Reload
; CHECK-NEXT:    ldp q9, q8, [sp, #256] // 32-byte Folded Reload
; CHECK-NEXT:    ldp q11, q10, [sp, #224] // 32-byte Folded Reload
; CHECK-NEXT:    ldp q13, q12, [sp, #192] // 32-byte Folded Reload
; CHECK-NEXT:    ldp q15, q14, [sp, #160] // 32-byte Folded Reload
; CHECK-NEXT:    ldp q17, q16, [sp, #128] // 32-byte Folded Reload
; CHECK-NEXT:    ldp q19, q18, [sp, #96] // 32-byte Folded Reload
; CHECK-NEXT:    ldp q21, q20, [sp, #64] // 32-byte Folded Reload
; CHECK-NEXT:    ldp q23, q22, [sp, #32] // 32-byte Folded Reload
; CHECK-NEXT:    add sp, sp, #304 // =304
; CHECK-NEXT:    ret
; CHECK-NEXT:  .LBB1_2: // %.Lunwind
; CHECK-NEXT:  .Ltmp5:
; CHECK-NEXT:    ldr q0, [sp] // 16-byte Folded Reload
; CHECK-NEXT:    ldp x29, x30, [sp, #288] // 16-byte Folded Reload
; CHECK-NEXT:    ldp q9, q8, [sp, #256] // 32-byte Folded Reload
; CHECK-NEXT:    ldp q11, q10, [sp, #224] // 32-byte Folded Reload
; CHECK-NEXT:    ldp q13, q12, [sp, #192] // 32-byte Folded Reload
; CHECK-NEXT:    ldp q15, q14, [sp, #160] // 32-byte Folded Reload
; CHECK-NEXT:    ldp q17, q16, [sp, #128] // 32-byte Folded Reload
; CHECK-NEXT:    ldp q19, q18, [sp, #96] // 32-byte Folded Reload
; CHECK-NEXT:    ldp q21, q20, [sp, #64] // 32-byte Folded Reload
; CHECK-NEXT:    ldp q23, q22, [sp, #32] // 32-byte Folded Reload
; CHECK-NEXT:    add sp, sp, #304 // =304
; CHECK-NEXT:    ret
;
; GISEL-LABEL: invoke_callee_may_throw_neon:
; GISEL:       .Lfunc_begin1:
; GISEL-NEXT:    .cfi_startproc
; GISEL-NEXT:  // %bb.0:
; GISEL-NEXT:    sub sp, sp, #304 // =304
; GISEL-NEXT:    stp q23, q22, [sp, #32] // 32-byte Folded Spill
; GISEL-NEXT:    stp q21, q20, [sp, #64] // 32-byte Folded Spill
; GISEL-NEXT:    stp q19, q18, [sp, #96] // 32-byte Folded Spill
; GISEL-NEXT:    stp q17, q16, [sp, #128] // 32-byte Folded Spill
; GISEL-NEXT:    stp q15, q14, [sp, #160] // 32-byte Folded Spill
; GISEL-NEXT:    stp q13, q12, [sp, #192] // 32-byte Folded Spill
; GISEL-NEXT:    stp q11, q10, [sp, #224] // 32-byte Folded Spill
; GISEL-NEXT:    stp q9, q8, [sp, #256] // 32-byte Folded Spill
; GISEL-NEXT:    stp x29, x30, [sp, #288] // 16-byte Folded Spill
; GISEL-NEXT:    .cfi_def_cfa_offset 304
; GISEL-NEXT:    .cfi_offset w30, -8
; GISEL-NEXT:    .cfi_offset w29, -16
; GISEL-NEXT:    .cfi_offset b8, -32
; GISEL-NEXT:    .cfi_offset b9, -48
; GISEL-NEXT:    .cfi_offset b10, -64
; GISEL-NEXT:    .cfi_offset b11, -80
; GISEL-NEXT:    .cfi_offset b12, -96
; GISEL-NEXT:    .cfi_offset b13, -112
; GISEL-NEXT:    .cfi_offset b14, -128
; GISEL-NEXT:    .cfi_offset b15, -144
; GISEL-NEXT:    .cfi_offset b16, -160
; GISEL-NEXT:    .cfi_offset b17, -176
; GISEL-NEXT:    .cfi_offset b18, -192
; GISEL-NEXT:    .cfi_offset b19, -208
; GISEL-NEXT:    .cfi_offset b20, -224
; GISEL-NEXT:    .cfi_offset b21, -240
; GISEL-NEXT:    .cfi_offset b22, -256
; GISEL-NEXT:    .cfi_offset b23, -272
; GISEL-NEXT:    str q0, [sp] // 16-byte Folded Spill
; GISEL-NEXT:  .Ltmp3:
; GISEL-NEXT:    bl may_throw_neon
; GISEL-NEXT:    str q0, [sp, #16] // 16-byte Folded Spill
; GISEL-NEXT:  .Ltmp4:
; GISEL-NEXT:  // %bb.1: // %.Lcontinue
; GISEL-NEXT:    ldr q0, [sp, #16] // 16-byte Folded Reload
; GISEL-NEXT:    ldp x29, x30, [sp, #288] // 16-byte Folded Reload
; GISEL-NEXT:    ldp q9, q8, [sp, #256] // 32-byte Folded Reload
; GISEL-NEXT:    ldp q11, q10, [sp, #224] // 32-byte Folded Reload
; GISEL-NEXT:    ldp q13, q12, [sp, #192] // 32-byte Folded Reload
; GISEL-NEXT:    ldp q15, q14, [sp, #160] // 32-byte Folded Reload
; GISEL-NEXT:    ldp q17, q16, [sp, #128] // 32-byte Folded Reload
; GISEL-NEXT:    ldp q19, q18, [sp, #96] // 32-byte Folded Reload
; GISEL-NEXT:    ldp q21, q20, [sp, #64] // 32-byte Folded Reload
; GISEL-NEXT:    ldp q23, q22, [sp, #32] // 32-byte Folded Reload
; GISEL-NEXT:    add sp, sp, #304 // =304
; GISEL-NEXT:    ret
; GISEL-NEXT:  .LBB1_2: // %.Lunwind
; GISEL-NEXT:  .Ltmp5:
; GISEL-NEXT:    ldr q0, [sp] // 16-byte Folded Reload
; GISEL-NEXT:    ldp x29, x30, [sp, #288] // 16-byte Folded Reload
; GISEL-NEXT:    ldp q9, q8, [sp, #256] // 32-byte Folded Reload
; GISEL-NEXT:    ldp q11, q10, [sp, #224] // 32-byte Folded Reload
; GISEL-NEXT:    ldp q13, q12, [sp, #192] // 32-byte Folded Reload
; GISEL-NEXT:    ldp q15, q14, [sp, #160] // 32-byte Folded Reload
; GISEL-NEXT:    ldp q17, q16, [sp, #128] // 32-byte Folded Reload
; GISEL-NEXT:    ldp q19, q18, [sp, #96] // 32-byte Folded Reload
; GISEL-NEXT:    ldp q21, q20, [sp, #64] // 32-byte Folded Reload
; GISEL-NEXT:    ldp q23, q22, [sp, #32] // 32-byte Folded Reload
; GISEL-NEXT:    add sp, sp, #304 // =304
; GISEL-NEXT:    ret
  %result = invoke aarch64_vector_pcs <4 x i32> @may_throw_neon(<4 x i32> %v) to label %.Lcontinue unwind label %.Lunwind
.Lcontinue:
  ret <4 x i32> %result
.Lunwind:
  %lp = landingpad { i8*, i32 } cleanup
  ret <4 x i32> %v;
}

declare aarch64_vector_pcs <4 x i32> @may_throw_neon(<4 x i32> %v);