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
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
|
; 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) uwtable 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: .cfi_def_cfa_offset 16
; CHECK-NEXT: .cfi_offset w30, -8
; CHECK-NEXT: .cfi_offset w29, -16
; CHECK-NEXT: addvl sp, sp, #-18
; CHECK-NEXT: .cfi_escape 0x0f, 0x0d, 0x8f, 0x00, 0x11, 0x10, 0x22, 0x11, 0x90, 0x01, 0x92, 0x2e, 0x00, 0x1e, 0x22 // sp + 16 + 144 * VG
; 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: .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: 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_remember_state
; 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: .cfi_escape 0x0f, 0x0d, 0x8f, 0x00, 0x11, 0x10, 0x22, 0x11, 0x90, 0x01, 0x92, 0x2e, 0x00, 0x1e, 0x22 // sp + 16 + 144 * VG
; 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: .cfi_def_cfa wsp, 16
; CHECK-NEXT: .cfi_restore z8
; CHECK-NEXT: .cfi_restore z9
; CHECK-NEXT: .cfi_restore z10
; CHECK-NEXT: .cfi_restore z11
; CHECK-NEXT: .cfi_restore z12
; CHECK-NEXT: .cfi_restore z13
; CHECK-NEXT: .cfi_restore z14
; CHECK-NEXT: .cfi_restore z15
; CHECK-NEXT: ldp x29, x30, [sp], #16 // 16-byte Folded Reload
; CHECK-NEXT: .cfi_def_cfa_offset 0
; CHECK-NEXT: .cfi_restore w30
; CHECK-NEXT: .cfi_restore w29
; CHECK-NEXT: ret
; CHECK-NEXT: .LBB0_2: // %.Lunwind
; CHECK-NEXT: .cfi_restore_state
; CHECK-NEXT: .Ltmp2:
; CHECK-NEXT: ldr z0, [sp] // 16-byte Folded Reload
; CHECK-NEXT: addvl sp, sp, #2
; CHECK-NEXT: .cfi_escape 0x0f, 0x0d, 0x8f, 0x00, 0x11, 0x10, 0x22, 0x11, 0x90, 0x01, 0x92, 0x2e, 0x00, 0x1e, 0x22 // sp + 16 + 144 * VG
; 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: .cfi_def_cfa wsp, 16
; CHECK-NEXT: .cfi_restore z8
; CHECK-NEXT: .cfi_restore z9
; CHECK-NEXT: .cfi_restore z10
; CHECK-NEXT: .cfi_restore z11
; CHECK-NEXT: .cfi_restore z12
; CHECK-NEXT: .cfi_restore z13
; CHECK-NEXT: .cfi_restore z14
; CHECK-NEXT: .cfi_restore z15
; CHECK-NEXT: ldp x29, x30, [sp], #16 // 16-byte Folded Reload
; CHECK-NEXT: .cfi_def_cfa_offset 0
; CHECK-NEXT: .cfi_restore w30
; CHECK-NEXT: .cfi_restore w29
; 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: .cfi_def_cfa_offset 16
; GISEL-NEXT: .cfi_offset w30, -8
; GISEL-NEXT: .cfi_offset w29, -16
; GISEL-NEXT: addvl sp, sp, #-18
; GISEL-NEXT: .cfi_escape 0x0f, 0x0d, 0x8f, 0x00, 0x11, 0x10, 0x22, 0x11, 0x90, 0x01, 0x92, 0x2e, 0x00, 0x1e, 0x22 // sp + 16 + 144 * VG
; 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: .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: 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_remember_state
; 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: .cfi_escape 0x0f, 0x0d, 0x8f, 0x00, 0x11, 0x10, 0x22, 0x11, 0x90, 0x01, 0x92, 0x2e, 0x00, 0x1e, 0x22 // sp + 16 + 144 * VG
; 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: .cfi_def_cfa wsp, 16
; GISEL-NEXT: .cfi_restore z8
; GISEL-NEXT: .cfi_restore z9
; GISEL-NEXT: .cfi_restore z10
; GISEL-NEXT: .cfi_restore z11
; GISEL-NEXT: .cfi_restore z12
; GISEL-NEXT: .cfi_restore z13
; GISEL-NEXT: .cfi_restore z14
; GISEL-NEXT: .cfi_restore z15
; GISEL-NEXT: ldp x29, x30, [sp], #16 // 16-byte Folded Reload
; GISEL-NEXT: .cfi_def_cfa_offset 0
; GISEL-NEXT: .cfi_restore w30
; GISEL-NEXT: .cfi_restore w29
; GISEL-NEXT: ret
; GISEL-NEXT: .LBB0_2: // %.Lunwind
; GISEL-NEXT: .cfi_restore_state
; GISEL-NEXT: .Ltmp2:
; GISEL-NEXT: ldr z0, [sp] // 16-byte Folded Reload
; GISEL-NEXT: addvl sp, sp, #2
; GISEL-NEXT: .cfi_escape 0x0f, 0x0d, 0x8f, 0x00, 0x11, 0x10, 0x22, 0x11, 0x90, 0x01, 0x92, 0x2e, 0x00, 0x1e, 0x22 // sp + 16 + 144 * VG
; 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: .cfi_def_cfa wsp, 16
; GISEL-NEXT: .cfi_restore z8
; GISEL-NEXT: .cfi_restore z9
; GISEL-NEXT: .cfi_restore z10
; GISEL-NEXT: .cfi_restore z11
; GISEL-NEXT: .cfi_restore z12
; GISEL-NEXT: .cfi_restore z13
; GISEL-NEXT: .cfi_restore z14
; GISEL-NEXT: .cfi_restore z15
; GISEL-NEXT: ldp x29, x30, [sp], #16 // 16-byte Folded Reload
; GISEL-NEXT: .cfi_def_cfa_offset 0
; GISEL-NEXT: .cfi_restore w30
; GISEL-NEXT: .cfi_restore w29
; 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 { ptr, 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) uwtable 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
; CHECK-NEXT: .cfi_def_cfa_offset 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_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: .cfi_remember_state
; 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
; CHECK-NEXT: .cfi_def_cfa_offset 0
; CHECK-NEXT: .cfi_restore w30
; CHECK-NEXT: .cfi_restore w29
; CHECK-NEXT: .cfi_restore b8
; CHECK-NEXT: .cfi_restore b9
; CHECK-NEXT: .cfi_restore b10
; CHECK-NEXT: .cfi_restore b11
; CHECK-NEXT: .cfi_restore b12
; CHECK-NEXT: .cfi_restore b13
; CHECK-NEXT: .cfi_restore b14
; CHECK-NEXT: .cfi_restore b15
; CHECK-NEXT: .cfi_restore b16
; CHECK-NEXT: .cfi_restore b17
; CHECK-NEXT: .cfi_restore b18
; CHECK-NEXT: .cfi_restore b19
; CHECK-NEXT: .cfi_restore b20
; CHECK-NEXT: .cfi_restore b21
; CHECK-NEXT: .cfi_restore b22
; CHECK-NEXT: .cfi_restore b23
; CHECK-NEXT: ret
; CHECK-NEXT: .LBB1_2: // %.Lunwind
; CHECK-NEXT: .cfi_restore_state
; 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
; CHECK-NEXT: .cfi_def_cfa_offset 0
; CHECK-NEXT: .cfi_restore w30
; CHECK-NEXT: .cfi_restore w29
; CHECK-NEXT: .cfi_restore b8
; CHECK-NEXT: .cfi_restore b9
; CHECK-NEXT: .cfi_restore b10
; CHECK-NEXT: .cfi_restore b11
; CHECK-NEXT: .cfi_restore b12
; CHECK-NEXT: .cfi_restore b13
; CHECK-NEXT: .cfi_restore b14
; CHECK-NEXT: .cfi_restore b15
; CHECK-NEXT: .cfi_restore b16
; CHECK-NEXT: .cfi_restore b17
; CHECK-NEXT: .cfi_restore b18
; CHECK-NEXT: .cfi_restore b19
; CHECK-NEXT: .cfi_restore b20
; CHECK-NEXT: .cfi_restore b21
; CHECK-NEXT: .cfi_restore b22
; CHECK-NEXT: .cfi_restore b23
; 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
; GISEL-NEXT: .cfi_def_cfa_offset 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_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: .cfi_remember_state
; 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: b .LBB1_1
; GISEL-NEXT: .LBB1_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
; GISEL-NEXT: .cfi_def_cfa_offset 0
; GISEL-NEXT: .cfi_restore w30
; GISEL-NEXT: .cfi_restore w29
; GISEL-NEXT: .cfi_restore b8
; GISEL-NEXT: .cfi_restore b9
; GISEL-NEXT: .cfi_restore b10
; GISEL-NEXT: .cfi_restore b11
; GISEL-NEXT: .cfi_restore b12
; GISEL-NEXT: .cfi_restore b13
; GISEL-NEXT: .cfi_restore b14
; GISEL-NEXT: .cfi_restore b15
; GISEL-NEXT: .cfi_restore b16
; GISEL-NEXT: .cfi_restore b17
; GISEL-NEXT: .cfi_restore b18
; GISEL-NEXT: .cfi_restore b19
; GISEL-NEXT: .cfi_restore b20
; GISEL-NEXT: .cfi_restore b21
; GISEL-NEXT: .cfi_restore b22
; GISEL-NEXT: .cfi_restore b23
; GISEL-NEXT: ret
; GISEL-NEXT: .LBB1_2: // %.Lunwind
; GISEL-NEXT: .cfi_restore_state
; 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
; GISEL-NEXT: .cfi_def_cfa_offset 0
; GISEL-NEXT: .cfi_restore w30
; GISEL-NEXT: .cfi_restore w29
; GISEL-NEXT: .cfi_restore b8
; GISEL-NEXT: .cfi_restore b9
; GISEL-NEXT: .cfi_restore b10
; GISEL-NEXT: .cfi_restore b11
; GISEL-NEXT: .cfi_restore b12
; GISEL-NEXT: .cfi_restore b13
; GISEL-NEXT: .cfi_restore b14
; GISEL-NEXT: .cfi_restore b15
; GISEL-NEXT: .cfi_restore b16
; GISEL-NEXT: .cfi_restore b17
; GISEL-NEXT: .cfi_restore b18
; GISEL-NEXT: .cfi_restore b19
; GISEL-NEXT: .cfi_restore b20
; GISEL-NEXT: .cfi_restore b21
; GISEL-NEXT: .cfi_restore b22
; GISEL-NEXT: .cfi_restore b23
; 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 { ptr, i32 } cleanup
ret <4 x i32> %v;
}
declare aarch64_vector_pcs <4 x i32> @may_throw_neon(<4 x i32> %v);
|