1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -mattr=+f,+d < %s | FileCheck %s
4 ; Check the GHC call convention works (rv32)
6 @base = external global i32 ; assigned to register: s1
7 @sp = external global i32 ; assigned to register: s2
8 @hp = external global i32 ; assigned to register: s3
9 @r1 = external global i32 ; assigned to register: s4
10 @r2 = external global i32 ; assigned to register: s5
11 @r3 = external global i32 ; assigned to register: s6
12 @r4 = external global i32 ; assigned to register: s7
13 @r5 = external global i32 ; assigned to register: s8
14 @r6 = external global i32 ; assigned to register: s9
15 @r7 = external global i32 ; assigned to register: s10
16 @splim = external global i32 ; assigned to register: s11
18 @f1 = external global float ; assigned to register: fs0
19 @f2 = external global float ; assigned to register: fs1
20 @f3 = external global float ; assigned to register: fs2
21 @f4 = external global float ; assigned to register: fs3
22 @f5 = external global float ; assigned to register: fs4
23 @f6 = external global float ; assigned to register: fs5
25 @d1 = external global double ; assigned to register: fs6
26 @d2 = external global double ; assigned to register: fs7
27 @d3 = external global double ; assigned to register: fs8
28 @d4 = external global double ; assigned to register: fs9
29 @d5 = external global double ; assigned to register: fs10
30 @d6 = external global double ; assigned to register: fs11
32 define ghccc void @foo() nounwind {
34 ; CHECK: # %bb.0: # %entry
35 ; CHECK-NEXT: lui a0, %hi(d6)
36 ; CHECK-NEXT: lui a1, %hi(d5)
37 ; CHECK-NEXT: lui a2, %hi(d4)
38 ; CHECK-NEXT: lui a3, %hi(d3)
39 ; CHECK-NEXT: lui a4, %hi(d2)
40 ; CHECK-NEXT: lui a5, %hi(d1)
41 ; CHECK-NEXT: lui a6, %hi(f6)
42 ; CHECK-NEXT: lui a7, %hi(f5)
43 ; CHECK-NEXT: lui t0, %hi(f4)
44 ; CHECK-NEXT: lui t1, %hi(f3)
45 ; CHECK-NEXT: lui t2, %hi(f2)
46 ; CHECK-NEXT: fld fs11, %lo(d6)(a0)
47 ; CHECK-NEXT: lui a0, %hi(f1)
48 ; CHECK-NEXT: fld fs10, %lo(d5)(a1)
49 ; CHECK-NEXT: lui a1, %hi(splim)
50 ; CHECK-NEXT: fld fs9, %lo(d4)(a2)
51 ; CHECK-NEXT: lui a2, %hi(r7)
52 ; CHECK-NEXT: fld fs8, %lo(d3)(a3)
53 ; CHECK-NEXT: lui a3, %hi(r6)
54 ; CHECK-NEXT: fld fs7, %lo(d2)(a4)
55 ; CHECK-NEXT: lui a4, %hi(r5)
56 ; CHECK-NEXT: fld fs6, %lo(d1)(a5)
57 ; CHECK-NEXT: lui a5, %hi(r4)
58 ; CHECK-NEXT: flw fs5, %lo(f6)(a6)
59 ; CHECK-NEXT: lui a6, %hi(r3)
60 ; CHECK-NEXT: flw fs4, %lo(f5)(a7)
61 ; CHECK-NEXT: lui a7, %hi(r2)
62 ; CHECK-NEXT: flw fs3, %lo(f4)(t0)
63 ; CHECK-NEXT: lui t0, %hi(r1)
64 ; CHECK-NEXT: flw fs2, %lo(f3)(t1)
65 ; CHECK-NEXT: lui t1, %hi(hp)
66 ; CHECK-NEXT: flw fs1, %lo(f2)(t2)
67 ; CHECK-NEXT: lui t2, %hi(sp)
68 ; CHECK-NEXT: flw fs0, %lo(f1)(a0)
69 ; CHECK-NEXT: lui a0, %hi(base)
70 ; CHECK-NEXT: lw s11, %lo(splim)(a1)
71 ; CHECK-NEXT: lw s10, %lo(r7)(a2)
72 ; CHECK-NEXT: lw s9, %lo(r6)(a3)
73 ; CHECK-NEXT: lw s8, %lo(r5)(a4)
74 ; CHECK-NEXT: lw s7, %lo(r4)(a5)
75 ; CHECK-NEXT: lw s6, %lo(r3)(a6)
76 ; CHECK-NEXT: lw s5, %lo(r2)(a7)
77 ; CHECK-NEXT: lw s4, %lo(r1)(t0)
78 ; CHECK-NEXT: lw s3, %lo(hp)(t1)
79 ; CHECK-NEXT: lw s2, %lo(sp)(t2)
80 ; CHECK-NEXT: lw s1, %lo(base)(a0)
81 ; CHECK-NEXT: tail bar
83 %0 = load double, ptr @d6
84 %1 = load double, ptr @d5
85 %2 = load double, ptr @d4
86 %3 = load double, ptr @d3
87 %4 = load double, ptr @d2
88 %5 = load double, ptr @d1
89 %6 = load float, ptr @f6
90 %7 = load float, ptr @f5
91 %8 = load float, ptr @f4
92 %9 = load float, ptr @f3
93 %10 = load float, ptr @f2
94 %11 = load float, ptr @f1
95 %12 = load i32, ptr @splim
96 %13 = load i32, ptr @r7
97 %14 = load i32, ptr @r6
98 %15 = load i32, ptr @r5
99 %16 = load i32, ptr @r4
100 %17 = load i32, ptr @r3
101 %18 = load i32, ptr @r2
102 %19 = load i32, ptr @r1
103 %20 = load i32, ptr @hp
104 %21 = load i32, ptr @sp
105 %22 = load i32, ptr @base
106 tail call ghccc void @bar(i32 %22, i32 %21, i32 %20, i32 %19, i32 %18, i32 %17, i32 %16, i32 %15, i32 %14, i32 %13, i32 %12,
107 float %11, float %10, float %9, float %8, float %7, float %6,
108 double %5, double %4, double %3, double %2, double %1, double %0) nounwind
112 declare ghccc void @bar(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32,
113 float, float, float, float, float, float,
114 double, double, double, double, double, double)