1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -mattr=+f -verify-machineinstrs < %s \
3 ; RUN: | FileCheck -check-prefix=RV32F %s
4 ; RUN: llc -mtriple=riscv64 -mattr=+f -verify-machineinstrs < %s \
5 ; RUN: | FileCheck -check-prefix=RV64F %s
7 @gf = external global float
9 define float @constraint_f_float(float %a) nounwind {
10 ; RV32F-LABEL: constraint_f_float:
12 ; RV32F-NEXT: lui a1, %hi(gf)
13 ; RV32F-NEXT: flw ft0, %lo(gf)(a1)
14 ; RV32F-NEXT: fmv.w.x ft1, a0
16 ; RV32F-NEXT: fadd.s ft0, ft1, ft0
18 ; RV32F-NEXT: fmv.x.w a0, ft0
21 ; RV64F-LABEL: constraint_f_float:
23 ; RV64F-NEXT: lui a1, %hi(gf)
24 ; RV64F-NEXT: flw ft0, %lo(gf)(a1)
25 ; RV64F-NEXT: fmv.w.x ft1, a0
27 ; RV64F-NEXT: fadd.s ft0, ft1, ft0
29 ; RV64F-NEXT: fmv.x.w a0, ft0
31 %1 = load float, float* @gf
32 %2 = tail call float asm "fadd.s $0, $1, $2", "=f,f,f"(float %a, float %1)
36 define float @constraint_f_float_abi_name(float %a) nounwind {
37 ; RV32F-LABEL: constraint_f_float_abi_name:
39 ; RV32F-NEXT: lui a1, %hi(gf)
40 ; RV32F-NEXT: flw fs0, %lo(gf)(a1)
41 ; RV32F-NEXT: fmv.w.x fa0, a0
43 ; RV32F-NEXT: fadd.s ft0, fa0, fs0
45 ; RV32F-NEXT: fmv.x.w a0, ft0
48 ; RV64F-LABEL: constraint_f_float_abi_name:
50 ; RV64F-NEXT: lui a1, %hi(gf)
51 ; RV64F-NEXT: flw fs0, %lo(gf)(a1)
52 ; RV64F-NEXT: fmv.w.x fa0, a0
54 ; RV64F-NEXT: fadd.s ft0, fa0, fs0
56 ; RV64F-NEXT: fmv.x.w a0, ft0
58 %1 = load float, float* @gf
59 %2 = tail call float asm "fadd.s $0, $1, $2", "={ft0},{fa0},{fs0}"(float %a, float %1)