1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; NOTE: Assertions gave been autogenerated by utils/update_llc_test_checks.py
3 ; RUN: llc -mtriple=riscv32 -mattr=+f -target-abi=ilp32 -verify-machineinstrs < %s \
4 ; RUN: | FileCheck -check-prefix=RV32F %s
5 ; RUN: llc -mtriple=riscv64 -mattr=+f -target-abi=lp64 -verify-machineinstrs < %s \
6 ; RUN: | FileCheck -check-prefix=RV64F %s
7 ; RUN: llc -mtriple=riscv32 -mattr=+d -target-abi=ilp32 -verify-machineinstrs < %s \
8 ; RUN: | FileCheck -check-prefix=RV32F %s
9 ; RUN: llc -mtriple=riscv64 -mattr=+d -target-abi=lp64 -verify-machineinstrs < %s \
10 ; RUN: | FileCheck -check-prefix=RV64F %s
12 @gf = external global float
14 define float @constraint_f_float(float %a) nounwind {
15 ; RV32F-LABEL: constraint_f_float:
17 ; RV32F-NEXT: lui a1, %hi(gf)
18 ; RV32F-NEXT: flw fa5, %lo(gf)(a1)
19 ; RV32F-NEXT: fmv.w.x fa4, a0
21 ; RV32F-NEXT: fadd.s fa5, fa4, fa5
23 ; RV32F-NEXT: fmv.x.w a0, fa5
26 ; RV64F-LABEL: constraint_f_float:
28 ; RV64F-NEXT: lui a1, %hi(gf)
29 ; RV64F-NEXT: flw fa5, %lo(gf)(a1)
30 ; RV64F-NEXT: fmv.w.x fa4, a0
32 ; RV64F-NEXT: fadd.s fa5, fa4, fa5
34 ; RV64F-NEXT: fmv.x.w a0, fa5
36 %1 = load float, ptr @gf
37 %2 = tail call float asm "fadd.s $0, $1, $2", "=f,f,f"(float %a, float %1)
41 define float @constraint_f_float_abi_name(float %a) nounwind {
42 ; RV32F-LABEL: constraint_f_float_abi_name:
44 ; RV32F-NEXT: lui a1, %hi(gf)
45 ; RV32F-NEXT: flw fs0, %lo(gf)(a1)
46 ; RV32F-NEXT: fmv.w.x fa0, a0
48 ; RV32F-NEXT: fadd.s ft0, fa0, fs0
50 ; RV32F-NEXT: fmv.x.w a0, ft0
53 ; RV64F-LABEL: constraint_f_float_abi_name:
55 ; RV64F-NEXT: lui a1, %hi(gf)
56 ; RV64F-NEXT: flw fs0, %lo(gf)(a1)
57 ; RV64F-NEXT: fmv.w.x fa0, a0
59 ; RV64F-NEXT: fadd.s ft0, fa0, fs0
61 ; RV64F-NEXT: fmv.x.w a0, ft0
63 %1 = load float, ptr @gf
64 %2 = tail call float asm "fadd.s $0, $1, $2", "={ft0},{fa0},{fs0}"(float %a, float %1)
68 define float @constraint_gpr(float %x) {
69 ; RV32F-LABEL: constraint_gpr:
71 ; RV32F-NEXT: .cfi_def_cfa_offset 0
73 ; RV32F-NEXT: mv a0, a0
77 ; RV64F-LABEL: constraint_gpr:
79 ; RV64F-NEXT: .cfi_def_cfa_offset 0
81 ; RV64F-NEXT: mv a0, a0
84 %1 = tail call float asm sideeffect alignstack "mv $0, $1", "={x10},{x10}"(float %x)