1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=csky -verify-machineinstrs -csky-no-aliases -mattr=+2e3 < %s \
5 declare void @notdead(ptr)
6 declare ptr @llvm.frameaddress(i32)
7 declare ptr @llvm.returnaddress(i32)
9 define ptr @test_frameaddress_0() nounwind {
10 ; CHECK-LABEL: test_frameaddress_0:
12 ; CHECK-NEXT: subi16 sp, sp, 4
13 ; CHECK-NEXT: st32.w l4, (sp, 0) # 4-byte Folded Spill
14 ; CHECK-NEXT: mov16 l4, sp
15 ; CHECK-NEXT: mov16 a0, l4
16 ; CHECK-NEXT: mov16 sp, l4
17 ; CHECK-NEXT: ld32.w l4, (sp, 0) # 4-byte Folded Reload
18 ; CHECK-NEXT: addi16 sp, sp, 4
20 %1 = call ptr @llvm.frameaddress(i32 0)
24 define ptr @test_frameaddress_2() nounwind {
25 ; CHECK-LABEL: test_frameaddress_2:
27 ; CHECK-NEXT: subi16 sp, sp, 4
28 ; CHECK-NEXT: st32.w l4, (sp, 0) # 4-byte Folded Spill
29 ; CHECK-NEXT: mov16 l4, sp
30 ; CHECK-NEXT: ld32.w a0, (l4, 0)
31 ; CHECK-NEXT: ld16.w a0, (a0, 0)
32 ; CHECK-NEXT: mov16 sp, l4
33 ; CHECK-NEXT: ld32.w l4, (sp, 0) # 4-byte Folded Reload
34 ; CHECK-NEXT: addi16 sp, sp, 4
36 %1 = call ptr @llvm.frameaddress(i32 2)
40 define ptr @test_frameaddress_3_alloca() nounwind {
41 ; CHECK-LABEL: test_frameaddress_3_alloca:
43 ; CHECK-NEXT: subi16 sp, sp, 8
44 ; CHECK-NEXT: st32.w lr, (sp, 4) # 4-byte Folded Spill
45 ; CHECK-NEXT: st32.w l4, (sp, 0) # 4-byte Folded Spill
46 ; CHECK-NEXT: mov16 l4, sp
47 ; CHECK-NEXT: subi16 sp, sp, 100
48 ; CHECK-NEXT: movi16 a0, 0
49 ; CHECK-NEXT: addu16 a0, sp
50 ; CHECK-NEXT: jsri32 [.LCPI2_0]
51 ; CHECK-NEXT: ld32.w a0, (l4, 0)
52 ; CHECK-NEXT: ld16.w a0, (a0, 0)
53 ; CHECK-NEXT: ld16.w a0, (a0, 0)
54 ; CHECK-NEXT: mov16 sp, l4
55 ; CHECK-NEXT: ld32.w l4, (sp, 0) # 4-byte Folded Reload
56 ; CHECK-NEXT: ld32.w lr, (sp, 4) # 4-byte Folded Reload
57 ; CHECK-NEXT: addi16 sp, sp, 8
59 %1 = alloca [100 x i8]
60 %2 = bitcast ptr %1 to ptr
61 call void @notdead(ptr %2)
62 %3 = call ptr @llvm.frameaddress(i32 3)
66 define ptr @test_returnaddress_0() nounwind {
67 ; CHECK-LABEL: test_returnaddress_0:
69 ; CHECK-NEXT: mov16 a0, lr
71 %1 = call ptr @llvm.returnaddress(i32 0)
75 define ptr @test_returnaddress_2() nounwind {
76 ; CHECK-LABEL: test_returnaddress_2:
78 ; CHECK-NEXT: subi16 sp, sp, 4
79 ; CHECK-NEXT: st32.w l4, (sp, 0) # 4-byte Folded Spill
80 ; CHECK-NEXT: mov16 l4, sp
81 ; CHECK-NEXT: ld32.w a0, (l4, 0)
82 ; CHECK-NEXT: ld16.w a0, (a0, 0)
83 ; CHECK-NEXT: ld16.w a0, (a0, 4)
84 ; CHECK-NEXT: mov16 sp, l4
85 ; CHECK-NEXT: ld32.w l4, (sp, 0) # 4-byte Folded Reload
86 ; CHECK-NEXT: addi16 sp, sp, 4
88 %1 = call ptr @llvm.returnaddress(i32 2)