1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
2 ; RUN: llc -mtriple=riscv64 -mattr=+zfinx,+zdinx < %s | FileCheck %s
4 ; Check the GHC call convention works for zfinx, zdinx (rv64)
6 @f1 = external global float
7 @f2 = external global float
8 @f3 = external global float
9 @f4 = external global float
10 @f5 = external global float
11 @f6 = external global float
13 define ghccc void @caller_float() nounwind {
14 ; CHECK-LABEL: caller_float:
15 ; CHECK: # %bb.0: # %entry
16 ; CHECK-NEXT: lui a0, %hi(f6)
17 ; CHECK-NEXT: lw s6, %lo(f6)(a0)
18 ; CHECK-NEXT: lui a0, %hi(f5)
19 ; CHECK-NEXT: lw s5, %lo(f5)(a0)
20 ; CHECK-NEXT: lui a0, %hi(f4)
21 ; CHECK-NEXT: lw s4, %lo(f4)(a0)
22 ; CHECK-NEXT: lui a0, %hi(f3)
23 ; CHECK-NEXT: lw s3, %lo(f3)(a0)
24 ; CHECK-NEXT: lui a0, %hi(f2)
25 ; CHECK-NEXT: lw s2, %lo(f2)(a0)
26 ; CHECK-NEXT: lui a0, %hi(f1)
27 ; CHECK-NEXT: lw s1, %lo(f1)(a0)
28 ; CHECK-NEXT: tail callee_float
30 %0 = load float, ptr @f6
31 %1 = load float, ptr @f5
32 %2 = load float, ptr @f4
33 %3 = load float, ptr @f3
34 %4 = load float, ptr @f2
35 %5 = load float, ptr @f1
36 tail call ghccc void @callee_float(float %5, float %4, float %3, float %2, float %1, float %0) nounwind
40 declare ghccc void @callee_float(float, float, float, float, float, float)
42 @d1 = external global double
43 @d2 = external global double
44 @d3 = external global double
45 @d4 = external global double
46 @d5 = external global double
47 @d6 = external global double
49 define ghccc void @caller_double() nounwind {
50 ; CHECK-LABEL: caller_double:
51 ; CHECK: # %bb.0: # %entry
52 ; CHECK-NEXT: lui a0, %hi(d6)
53 ; CHECK-NEXT: ld s6, %lo(d6)(a0)
54 ; CHECK-NEXT: lui a0, %hi(d5)
55 ; CHECK-NEXT: ld s5, %lo(d5)(a0)
56 ; CHECK-NEXT: lui a0, %hi(d4)
57 ; CHECK-NEXT: ld s4, %lo(d4)(a0)
58 ; CHECK-NEXT: lui a0, %hi(d3)
59 ; CHECK-NEXT: ld s3, %lo(d3)(a0)
60 ; CHECK-NEXT: lui a0, %hi(d2)
61 ; CHECK-NEXT: ld s2, %lo(d2)(a0)
62 ; CHECK-NEXT: lui a0, %hi(d1)
63 ; CHECK-NEXT: ld s1, %lo(d1)(a0)
64 ; CHECK-NEXT: tail callee_double
66 %0 = load double, ptr @d6
67 %1 = load double, ptr @d5
68 %2 = load double, ptr @d4
69 %3 = load double, ptr @d3
70 %4 = load double, ptr @d2
71 %5 = load double, ptr @d1
72 tail call ghccc void @callee_double(double %5, double %4, double %3, double %2, double %1, double %0) nounwind
76 declare ghccc void @callee_double(double, double, double, double, double, double)