1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc --mtriple=loongarch64 -O0 < %s | FileCheck %s
4 @var = external global i32
9 ; CHECK-NEXT: addi.d $sp, $sp, -2048
10 ; CHECK-NEXT: addi.d $sp, $sp, -2048
11 ; CHECK-NEXT: addi.d $sp, $sp, -16
12 ; CHECK-NEXT: .cfi_def_cfa_offset 4112
13 ; CHECK-NEXT: pcalau12i $a0, %got_pc_hi20(var)
14 ; CHECK-NEXT: ld.d $a1, $a0, %got_pc_lo12(var)
15 ; CHECK-NEXT: ld.w $t8, $a1, 0
16 ; CHECK-NEXT: ld.w $t7, $a1, 0
17 ; CHECK-NEXT: ld.w $t6, $a1, 0
18 ; CHECK-NEXT: ld.w $t5, $a1, 0
19 ; CHECK-NEXT: ld.w $t4, $a1, 0
20 ; CHECK-NEXT: ld.w $t3, $a1, 0
21 ; CHECK-NEXT: ld.w $t2, $a1, 0
22 ; CHECK-NEXT: ld.w $t1, $a1, 0
23 ; CHECK-NEXT: ld.w $t0, $a1, 0
24 ; CHECK-NEXT: ld.w $a7, $a1, 0
25 ; CHECK-NEXT: ld.w $a6, $a1, 0
26 ; CHECK-NEXT: ld.w $a5, $a1, 0
27 ; CHECK-NEXT: ld.w $a4, $a1, 0
28 ; CHECK-NEXT: ld.w $a3, $a1, 0
29 ; CHECK-NEXT: ld.w $a2, $a1, 0
30 ; CHECK-NEXT: ld.w $a0, $a1, 0
31 ; CHECK-NEXT: st.d $fp, $sp, 0
32 ; CHECK-NEXT: lu12i.w $fp, 1
33 ; CHECK-NEXT: ori $fp, $fp, 12
34 ; CHECK-NEXT: add.d $fp, $sp, $fp
35 ; CHECK-NEXT: st.w $t8, $fp, 0
36 ; CHECK-NEXT: ld.d $fp, $sp, 0
37 ; CHECK-NEXT: st.w $t8, $a1, 0
38 ; CHECK-NEXT: st.w $t7, $a1, 0
39 ; CHECK-NEXT: st.w $t6, $a1, 0
40 ; CHECK-NEXT: st.w $t5, $a1, 0
41 ; CHECK-NEXT: st.w $t4, $a1, 0
42 ; CHECK-NEXT: st.w $t3, $a1, 0
43 ; CHECK-NEXT: st.w $t2, $a1, 0
44 ; CHECK-NEXT: st.w $t1, $a1, 0
45 ; CHECK-NEXT: st.w $t0, $a1, 0
46 ; CHECK-NEXT: st.w $a7, $a1, 0
47 ; CHECK-NEXT: st.w $a6, $a1, 0
48 ; CHECK-NEXT: st.w $a5, $a1, 0
49 ; CHECK-NEXT: st.w $a4, $a1, 0
50 ; CHECK-NEXT: st.w $a3, $a1, 0
51 ; CHECK-NEXT: st.w $a2, $a1, 0
52 ; CHECK-NEXT: st.w $a0, $a1, 0
53 ; CHECK-NEXT: lu12i.w $a0, 1
54 ; CHECK-NEXT: ori $a0, $a0, 16
55 ; CHECK-NEXT: add.d $sp, $sp, $a0
57 %space = alloca i32, align 4
58 %stackspace = alloca[1024 x i32], align 4
60 ;; Load values to increase register pressure.
61 %v0 = load volatile i32, ptr @var
62 %v1 = load volatile i32, ptr @var
63 %v2 = load volatile i32, ptr @var
64 %v3 = load volatile i32, ptr @var
65 %v4 = load volatile i32, ptr @var
66 %v5 = load volatile i32, ptr @var
67 %v6 = load volatile i32, ptr @var
68 %v7 = load volatile i32, ptr @var
69 %v8 = load volatile i32, ptr @var
70 %v9 = load volatile i32, ptr @var
71 %v10 = load volatile i32, ptr @var
72 %v11 = load volatile i32, ptr @var
73 %v12 = load volatile i32, ptr @var
74 %v13 = load volatile i32, ptr @var
75 %v14 = load volatile i32, ptr @var
76 %v15 = load volatile i32, ptr @var
78 ;; Computing a stack-relative values needs an additional register.
79 ;; We should get an emergency spill/reload for this.
80 store volatile i32 %v0, ptr %space
82 ;; store values so they are used.
83 store volatile i32 %v0, ptr @var
84 store volatile i32 %v1, ptr @var
85 store volatile i32 %v2, ptr @var
86 store volatile i32 %v3, ptr @var
87 store volatile i32 %v4, ptr @var
88 store volatile i32 %v5, ptr @var
89 store volatile i32 %v6, ptr @var
90 store volatile i32 %v7, ptr @var
91 store volatile i32 %v8, ptr @var
92 store volatile i32 %v9, ptr @var
93 store volatile i32 %v10, ptr @var
94 store volatile i32 %v11, ptr @var
95 store volatile i32 %v12, ptr @var
96 store volatile i32 %v13, ptr @var
97 store volatile i32 %v14, ptr @var
98 store volatile i32 %v15, ptr @var