1 # NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
3 # RUN: llc -mtriple riscv64 -start-before=prologepilog -o - \
4 # RUN: -verify-machineinstrs %s | FileCheck %s
6 # RUN: llc -mtriple riscv64 -start-before=prologepilog -o /dev/null \
7 # RUN: -debug-only=prologepilog -verify-machineinstrs %s 2>&1 \
8 # RUN: | FileCheck --check-prefix=DEBUG %s
10 # DEBUG: Adjusting emergency spill slots!
11 # DEBUG: Adjusting offset of emergency spill slot #4 from -4112 to -8192
13 # FIXME: The code generated here is incorrect. It stores a0 to 0(sp) before
14 # sub sp, sp, a0 but restores it after sub sp, sp, a0. We may need to implement
15 # the target hook saveScavengerRegister to solve it.
18 ; ModuleID = 'reduced.ll'
19 source_filename = "frame_layout-1253b1.cpp"
20 target datalayout = "e-m:e-p:64:64-i64:64-i128:128-n64-S128"
21 target triple = "riscv64"
23 ; Function Attrs: nounwind
24 define weak_odr dso_local void @foo(ptr %ay) nounwind {
26 ; CHECK: # %bb.0: # %entry
27 ; CHECK-NEXT: addi sp, sp, -2032
28 ; CHECK-NEXT: sd ra, 2024(sp) # 8-byte Folded Spill
29 ; CHECK-NEXT: sd s0, 2016(sp) # 8-byte Folded Spill
30 ; CHECK-NEXT: addi s0, sp, 2032
31 ; CHECK-NEXT: sd a0, 0(sp)
32 ; CHECK-NEXT: lui a0, 2
33 ; CHECK-NEXT: addiw a0, a0, -2032
34 ; CHECK-NEXT: sub sp, sp, a0
35 ; CHECK-NEXT: srli a0, sp, 12
36 ; CHECK-NEXT: slli sp, a0, 12
37 ; CHECK-NEXT: ld a0, 0(sp)
38 ; CHECK-NEXT: sd a1, 0(sp)
39 ; CHECK-NEXT: lui a1, 1
40 ; CHECK-NEXT: add a1, sp, a1
41 ; CHECK-NEXT: sd a0, -8(a1)
42 ; CHECK-NEXT: ld a1, 0(sp)
43 ; CHECK-NEXT: call foo
44 ; CHECK-NEXT: lui a0, 2
45 ; CHECK-NEXT: sub sp, s0, a0
46 ; CHECK-NEXT: addiw a0, a0, -2032
47 ; CHECK-NEXT: add sp, sp, a0
48 ; CHECK-NEXT: ld ra, 2024(sp) # 8-byte Folded Reload
49 ; CHECK-NEXT: ld s0, 2016(sp) # 8-byte Folded Reload
50 ; CHECK-NEXT: addi sp, sp, 2032
61 tracksRegLiveness: false
65 - { id: 0, size: 8, alignment: 4096 }
66 - { id: 1, type: spill-slot, size: 8, alignment: 8 }
67 machineFunctionInfo: {}
70 liveins: $x1, $x5, $x6, $x7, $x10, $x11, $x12, $x13, $x14, $x15, $x16, $x17, $x28, $x29, $x30, $x31
72 ; This is to store something to the (non-emergency) spill slot %stack.1.
74 ; This is here just to make all the eligible registers live at this point.
75 ; This way when we replace the frame index %stack.1 with its actual address
76 ; we have to allocate a virtual register to compute it.
77 ; A later run of the the register scavenger won't find an available register
78 ; either so it will have to spill one to the emergency spill slot.
79 PseudoCALL target-flags(riscv-call) @foo, csr_ilp32_lp64, implicit-def $x1, implicit-def $x2, implicit $x1, implicit $x5, implicit $x6, implicit $x7, implicit $x10, implicit $x11, implicit $x12, implicit $x13, implicit $x14, implicit $x15, implicit $x16, implicit $x17, implicit $x28, implicit $x29, implicit $x30, implicit $x31
83 ## NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: