1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc --mtriple=loongarch64 --mattr=+f,+d < %s | FileCheck %s --check-prefix=LA64
4 ; Check the GHC call convention works (la64)
6 @base = external dso_local global i64 ; assigned to register: s0
7 @sp = external dso_local global i64 ; assigned to register: s1
8 @hp = external dso_local global i64 ; assigned to register: s2
9 @r1 = external dso_local global i64 ; assigned to register: s3
10 @r2 = external dso_local global i64 ; assigned to register: s4
11 @r3 = external dso_local global i64 ; assigned to register: s5
12 @r4 = external dso_local global i64 ; assigned to register: s6
13 @r5 = external dso_local global i64 ; assigned to register: s7
14 @splim = external dso_local global i64 ; assigned to register: s8
16 @f1 = external dso_local global float ; assigned to register: fs0
17 @f2 = external dso_local global float ; assigned to register: fs1
18 @f3 = external dso_local global float ; assigned to register: fs2
19 @f4 = external dso_local global float ; assigned to register: fs3
21 @d1 = external dso_local global double ; assigned to register: fs4
22 @d2 = external dso_local global double ; assigned to register: fs5
23 @d3 = external dso_local global double ; assigned to register: fs6
24 @d4 = external dso_local global double ; assigned to register: fs7
26 define ghccc void @foo() nounwind {
28 ; LA64: # %bb.0: # %entry
29 ; LA64-NEXT: pcalau12i $a0, %pc_hi20(d4)
30 ; LA64-NEXT: addi.d $a0, $a0, %pc_lo12(d4)
31 ; LA64-NEXT: fld.d $fs7, $a0, 0
32 ; LA64-NEXT: pcalau12i $a0, %pc_hi20(d3)
33 ; LA64-NEXT: addi.d $a0, $a0, %pc_lo12(d3)
34 ; LA64-NEXT: fld.d $fs6, $a0, 0
35 ; LA64-NEXT: pcalau12i $a0, %pc_hi20(d2)
36 ; LA64-NEXT: addi.d $a0, $a0, %pc_lo12(d2)
37 ; LA64-NEXT: fld.d $fs5, $a0, 0
38 ; LA64-NEXT: pcalau12i $a0, %pc_hi20(d1)
39 ; LA64-NEXT: addi.d $a0, $a0, %pc_lo12(d1)
40 ; LA64-NEXT: fld.d $fs4, $a0, 0
41 ; LA64-NEXT: pcalau12i $a0, %pc_hi20(f4)
42 ; LA64-NEXT: addi.d $a0, $a0, %pc_lo12(f4)
43 ; LA64-NEXT: fld.s $fs3, $a0, 0
44 ; LA64-NEXT: pcalau12i $a0, %pc_hi20(f3)
45 ; LA64-NEXT: addi.d $a0, $a0, %pc_lo12(f3)
46 ; LA64-NEXT: fld.s $fs2, $a0, 0
47 ; LA64-NEXT: pcalau12i $a0, %pc_hi20(f2)
48 ; LA64-NEXT: addi.d $a0, $a0, %pc_lo12(f2)
49 ; LA64-NEXT: fld.s $fs1, $a0, 0
50 ; LA64-NEXT: pcalau12i $a0, %pc_hi20(f1)
51 ; LA64-NEXT: addi.d $a0, $a0, %pc_lo12(f1)
52 ; LA64-NEXT: fld.s $fs0, $a0, 0
53 ; LA64-NEXT: pcalau12i $a0, %pc_hi20(splim)
54 ; LA64-NEXT: addi.d $a0, $a0, %pc_lo12(splim)
55 ; LA64-NEXT: ld.d $s8, $a0, 0
56 ; LA64-NEXT: pcalau12i $a0, %pc_hi20(r5)
57 ; LA64-NEXT: addi.d $a0, $a0, %pc_lo12(r5)
58 ; LA64-NEXT: ld.d $s7, $a0, 0
59 ; LA64-NEXT: pcalau12i $a0, %pc_hi20(r4)
60 ; LA64-NEXT: addi.d $a0, $a0, %pc_lo12(r4)
61 ; LA64-NEXT: ld.d $s6, $a0, 0
62 ; LA64-NEXT: pcalau12i $a0, %pc_hi20(r3)
63 ; LA64-NEXT: addi.d $a0, $a0, %pc_lo12(r3)
64 ; LA64-NEXT: ld.d $s5, $a0, 0
65 ; LA64-NEXT: pcalau12i $a0, %pc_hi20(r2)
66 ; LA64-NEXT: addi.d $a0, $a0, %pc_lo12(r2)
67 ; LA64-NEXT: ld.d $s4, $a0, 0
68 ; LA64-NEXT: pcalau12i $a0, %pc_hi20(r1)
69 ; LA64-NEXT: addi.d $a0, $a0, %pc_lo12(r1)
70 ; LA64-NEXT: ld.d $s3, $a0, 0
71 ; LA64-NEXT: pcalau12i $a0, %pc_hi20(hp)
72 ; LA64-NEXT: addi.d $a0, $a0, %pc_lo12(hp)
73 ; LA64-NEXT: ld.d $s2, $a0, 0
74 ; LA64-NEXT: pcalau12i $a0, %pc_hi20(sp)
75 ; LA64-NEXT: addi.d $a0, $a0, %pc_lo12(sp)
76 ; LA64-NEXT: ld.d $s1, $a0, 0
77 ; LA64-NEXT: pcalau12i $a0, %pc_hi20(base)
78 ; LA64-NEXT: addi.d $a0, $a0, %pc_lo12(base)
79 ; LA64-NEXT: ld.d $s0, $a0, 0
80 ; LA64-NEXT: b %plt(bar)
83 %0 = load double, ptr @d4
84 %1 = load double, ptr @d3
85 %2 = load double, ptr @d2
86 %3 = load double, ptr @d1
87 %4 = load float, ptr @f4
88 %5 = load float, ptr @f3
89 %6 = load float, ptr @f2
90 %7 = load float, ptr @f1
91 %8 = load i64, ptr @splim
92 %9 = load i64, ptr @r5
93 %10 = load i64, ptr @r4
94 %11 = load i64, ptr @r3
95 %12 = load i64, ptr @r2
96 %13 = load i64, ptr @r1
97 %14 = load i64, ptr @hp
98 %15 = load i64, ptr @sp
99 %16 = load i64, ptr @base
100 tail call ghccc void @bar(i64 %16, i64 %15, i64 %14, i64 %13, i64 %12,
101 i64 %11, i64 %10, i64 %9, i64 %8, float %7, float %6,
102 float %5, float %4, double %3, double %2, double %1, double %0) nounwind
105 declare ghccc void @bar(i64, i64, i64, i64, i64, i64, i64, i64, i64,
106 float, float, float, float,
107 double, double, double, double)