1# RUN: llc -mtriple=aarch64-none-linux-gnu -run-pass=prologepilog %s -o - | FileCheck %s
2
3# Ensure references to scavenged stack slots in the CSR area use the
4# FP as a base when the stack pointer must be aligned to something
5# larger than required by the target. This is necessary because the
6# alignment padding area is between the CSR area and the SP, so the SP
7# cannot be used to reference the CSR area.
8name:            test
9tracksRegLiveness: true
10frameInfo:
11  maxAlignment:    64
12# CHECK:      stack:
13# CHECK:        id: 0, name: '', type: default, offset: -64, size: 4, alignment: 64
14# CHECK-NEXT:     stack-id: 0
15# CHECK-NEXT:     local-offset: -64
16# CHECK:        id: 1, name: '', type: default, offset: -20, size: 4, alignment: 4
17# CHECK-NEXT:     stack-id: 0
18# CHECK-NEXT:     local-offset: -68
19stack:
20  - { id: 0, size: 4, alignment: 64, local-offset: -64 }
21  - { id: 1, size: 4, alignment: 4, local-offset: -68 }
22
23# CHECK: body:
24# CHECK:   $sp = ANDXri killed ${{x[0-9]+}}, 7865
25# CHECK:   STRSui $s0, $sp, 0
26# CHECK:   STURSi $s0, $fp, -4
27body:             |
28  bb.0.entry:
29    liveins: $s0
30
31    STRSui $s0, %stack.0, 0
32    STRSui $s0, %stack.1, 0
33    ; Force preserve a CSR to create a hole in the CSR stack region.
34    $x28 = IMPLICIT_DEF
35    RET_ReallyLR
36