1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
2 ; RUN: llc < %s | FileCheck %s
4 target triple = "aarch64"
6 ; This function would normally scavenge a stackslot from the callee-save
7 ; area, which would lead to spilling 's0' to that stackslot before the
8 ; smstop and filling it with 'addvl + <offset>' after the smstop because
9 ; the frame-pointer is not available.
10 ; This would not be valid, since the vector-length has changed so 'addvl'
11 ; cannot be used. This is testing that the stackslot-scavenging is disabled
12 ; when there are any streaming-mode-changing call-sequences in the
14 define void @test_no_stackslot_scavenging(float %f) #0 {
15 ; CHECK-LABEL: test_no_stackslot_scavenging:
17 ; CHECK-NEXT: stp d15, d14, [sp, #-96]! // 16-byte Folded Spill
19 ; CHECK-NEXT: stp d13, d12, [sp, #16] // 16-byte Folded Spill
20 ; CHECK-NEXT: stp d11, d10, [sp, #32] // 16-byte Folded Spill
21 ; CHECK-NEXT: stp d9, d8, [sp, #48] // 16-byte Folded Spill
22 ; CHECK-NEXT: stp x29, x30, [sp, #64] // 16-byte Folded Spill
23 ; CHECK-NEXT: stp x9, x24, [sp, #80] // 16-byte Folded Spill
24 ; CHECK-NEXT: sub sp, sp, #16
25 ; CHECK-NEXT: addvl sp, sp, #-1
26 ; CHECK-NEXT: str s0, [sp, #12] // 4-byte Folded Spill
28 ; CHECK-NEXT: //NO_APP
29 ; CHECK-NEXT: smstop sm
30 ; CHECK-NEXT: ldr s0, [sp, #12] // 4-byte Folded Reload
31 ; CHECK-NEXT: bl use_f
32 ; CHECK-NEXT: smstart sm
33 ; CHECK-NEXT: addvl sp, sp, #1
34 ; CHECK-NEXT: add sp, sp, #16
35 ; CHECK-NEXT: ldp x29, x30, [sp, #64] // 16-byte Folded Reload
36 ; CHECK-NEXT: ldr x24, [sp, #88] // 8-byte Folded Reload
37 ; CHECK-NEXT: ldp d9, d8, [sp, #48] // 16-byte Folded Reload
38 ; CHECK-NEXT: ldp d11, d10, [sp, #32] // 16-byte Folded Reload
39 ; CHECK-NEXT: ldp d13, d12, [sp, #16] // 16-byte Folded Reload
40 ; CHECK-NEXT: ldp d15, d14, [sp], #96 // 16-byte Folded Reload
42 %ptr = alloca <vscale x 16 x i8>
43 call void asm sideeffect "", "~{x24}"() nounwind
44 call void @use_f(float %f)
48 define void @test_no_stackslot_scavenging_with_fp(float %f, i64 %n) #0 "frame-pointer"="all" {
49 ; CHECK-LABEL: test_no_stackslot_scavenging_with_fp:
51 ; CHECK-NEXT: stp d15, d14, [sp, #-128]! // 16-byte Folded Spill
53 ; CHECK-NEXT: stp d13, d12, [sp, #16] // 16-byte Folded Spill
54 ; CHECK-NEXT: stp d11, d10, [sp, #32] // 16-byte Folded Spill
55 ; CHECK-NEXT: stp d9, d8, [sp, #48] // 16-byte Folded Spill
56 ; CHECK-NEXT: stp x29, x30, [sp, #64] // 16-byte Folded Spill
57 ; CHECK-NEXT: add x29, sp, #64
58 ; CHECK-NEXT: str x9, [sp, #80] // 8-byte Folded Spill
59 ; CHECK-NEXT: stp x28, x25, [sp, #96] // 16-byte Folded Spill
60 ; CHECK-NEXT: stp x24, x19, [sp, #112] // 16-byte Folded Spill
61 ; CHECK-NEXT: addvl sp, sp, #-1
62 ; CHECK-NEXT: lsl x9, x0, #3
63 ; CHECK-NEXT: mov x8, sp
64 ; CHECK-NEXT: mov x19, sp
65 ; CHECK-NEXT: str s0, [x29, #28] // 4-byte Folded Spill
66 ; CHECK-NEXT: add x9, x9, #15
67 ; CHECK-NEXT: and x9, x9, #0xfffffffffffffff0
68 ; CHECK-NEXT: sub x8, x8, x9
69 ; CHECK-NEXT: mov sp, x8
71 ; CHECK-NEXT: //NO_APP
72 ; CHECK-NEXT: smstop sm
73 ; CHECK-NEXT: ldr s0, [x29, #28] // 4-byte Folded Reload
74 ; CHECK-NEXT: bl use_f
75 ; CHECK-NEXT: smstart sm
76 ; CHECK-NEXT: sub sp, x29, #64
77 ; CHECK-NEXT: ldp x24, x19, [sp, #112] // 16-byte Folded Reload
78 ; CHECK-NEXT: ldp x28, x25, [sp, #96] // 16-byte Folded Reload
79 ; CHECK-NEXT: ldp x29, x30, [sp, #64] // 16-byte Folded Reload
80 ; CHECK-NEXT: ldp d9, d8, [sp, #48] // 16-byte Folded Reload
81 ; CHECK-NEXT: ldp d11, d10, [sp, #32] // 16-byte Folded Reload
82 ; CHECK-NEXT: ldp d13, d12, [sp, #16] // 16-byte Folded Reload
83 ; CHECK-NEXT: ldp d15, d14, [sp], #128 // 16-byte Folded Reload
85 %ptr2 = alloca i64, i64 %n, align 8
86 %ptr = alloca <vscale x 16 x i8>
87 call void asm sideeffect "", "~{x24},~{x25}"() nounwind
88 call void @use_f(float %f)
92 declare void @use_f(float)
93 declare void @use_f_and_ptr(float, ptr)
95 attributes #0 = { nounwind "target-features"="+sve,+sme" "aarch64_pstate_sm_enabled" }