1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc --mtriple=loongarch64 -mattr=+d --verify-machineinstrs < %s \
5 ;; The stack size is 2048 and the SP adjustment will be split.
6 define i32 @SplitSP() nounwind {
7 ; CHECK-LABEL: SplitSP:
8 ; CHECK: # %bb.0: # %entry
9 ; CHECK-NEXT: addi.d $sp, $sp, -2032
10 ; CHECK-NEXT: st.d $ra, $sp, 2024 # 8-byte Folded Spill
11 ; CHECK-NEXT: addi.d $sp, $sp, -16
12 ; CHECK-NEXT: addi.d $a0, $sp, 12
13 ; CHECK-NEXT: bl %plt(foo)
14 ; CHECK-NEXT: move $a0, $zero
15 ; CHECK-NEXT: addi.d $sp, $sp, 16
16 ; CHECK-NEXT: ld.d $ra, $sp, 2024 # 8-byte Folded Reload
17 ; CHECK-NEXT: addi.d $sp, $sp, 2032
20 %xx = alloca [2028 x i8], align 1
21 %0 = getelementptr inbounds [2028 x i8], ptr %xx, i32 0, i32 0
22 %call = call i32 @foo(ptr nonnull %0)
26 ;; The stack size is 2032 and the SP adjustment will not be split.
27 ;; 2016 + 8(RA) + 8(emergency spill slot) = 2032
28 define i32 @NoSplitSP() nounwind {
29 ; CHECK-LABEL: NoSplitSP:
30 ; CHECK: # %bb.0: # %entry
31 ; CHECK-NEXT: addi.d $sp, $sp, -2032
32 ; CHECK-NEXT: st.d $ra, $sp, 2024 # 8-byte Folded Spill
33 ; CHECK-NEXT: addi.d $a0, $sp, 8
34 ; CHECK-NEXT: bl %plt(foo)
35 ; CHECK-NEXT: move $a0, $zero
36 ; CHECK-NEXT: ld.d $ra, $sp, 2024 # 8-byte Folded Reload
37 ; CHECK-NEXT: addi.d $sp, $sp, 2032
40 %xx = alloca [2016 x i8], align 1
41 %0 = getelementptr inbounds [2024 x i8], ptr %xx, i32 0, i32 0
42 %call = call i32 @foo(ptr nonnull %0)