1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
|
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
; RUN: llc -mtriple=riscv32 -mattr=+zfinx -target-abi=ilp32 -verify-machineinstrs < %s \
; RUN: | FileCheck -check-prefix=RV32FINX %s
; RUN: llc -mtriple=riscv64 -mattr=+zfinx -target-abi=lp64 -verify-machineinstrs < %s \
; RUN: | FileCheck -check-prefix=RV64FINX %s
@gf = external global float
define float @constraint_r_float(float %a) nounwind {
; RV32FINX-LABEL: constraint_r_float:
; RV32FINX: # %bb.0:
; RV32FINX-NEXT: lui a1, %hi(gf)
; RV32FINX-NEXT: lw a1, %lo(gf)(a1)
; RV32FINX-NEXT: #APP
; RV32FINX-NEXT: fadd.s a0, a0, a1
; RV32FINX-NEXT: #NO_APP
; RV32FINX-NEXT: ret
;
; RV64FINX-LABEL: constraint_r_float:
; RV64FINX: # %bb.0:
; RV64FINX-NEXT: lui a1, %hi(gf)
; RV64FINX-NEXT: lw a1, %lo(gf)(a1)
; RV64FINX-NEXT: #APP
; RV64FINX-NEXT: fadd.s a0, a0, a1
; RV64FINX-NEXT: #NO_APP
; RV64FINX-NEXT: ret
%1 = load float, ptr @gf
%2 = tail call float asm "fadd.s $0, $1, $2", "=r,r,r"(float %a, float %1)
ret float %2
}
define float @constraint_cr_float(float %a) nounwind {
; RV32FINX-LABEL: constraint_cr_float:
; RV32FINX: # %bb.0:
; RV32FINX-NEXT: lui a1, %hi(gf)
; RV32FINX-NEXT: lw a1, %lo(gf)(a1)
; RV32FINX-NEXT: #APP
; RV32FINX-NEXT: fadd.s a0, a0, a1
; RV32FINX-NEXT: #NO_APP
; RV32FINX-NEXT: ret
;
; RV64FINX-LABEL: constraint_cr_float:
; RV64FINX: # %bb.0:
; RV64FINX-NEXT: lui a1, %hi(gf)
; RV64FINX-NEXT: lw a1, %lo(gf)(a1)
; RV64FINX-NEXT: #APP
; RV64FINX-NEXT: fadd.s a0, a0, a1
; RV64FINX-NEXT: #NO_APP
; RV64FINX-NEXT: ret
%1 = load float, ptr @gf
%2 = tail call float asm "fadd.s $0, $1, $2", "=^cr,cr,cr"(float %a, float %1)
ret float %2
}
define float @constraint_float_abi_name(float %a) nounwind {
; RV32FINX-LABEL: constraint_float_abi_name:
; RV32FINX: # %bb.0:
; RV32FINX-NEXT: addi sp, sp, -16
; RV32FINX-NEXT: sw s0, 12(sp) # 4-byte Folded Spill
; RV32FINX-NEXT: lui a1, %hi(gf)
; RV32FINX-NEXT: lw s0, %lo(gf)(a1)
; RV32FINX-NEXT: # kill: def $x10_w killed $x10_w def $x10
; RV32FINX-NEXT: #APP
; RV32FINX-NEXT: fadd.s t0, a0, s0
; RV32FINX-NEXT: #NO_APP
; RV32FINX-NEXT: mv a0, t0
; RV32FINX-NEXT: lw s0, 12(sp) # 4-byte Folded Reload
; RV32FINX-NEXT: addi sp, sp, 16
; RV32FINX-NEXT: ret
;
; RV64FINX-LABEL: constraint_float_abi_name:
; RV64FINX: # %bb.0:
; RV64FINX-NEXT: addi sp, sp, -16
; RV64FINX-NEXT: sd s0, 8(sp) # 8-byte Folded Spill
; RV64FINX-NEXT: lui a1, %hi(gf)
; RV64FINX-NEXT: lw s0, %lo(gf)(a1)
; RV64FINX-NEXT: # kill: def $x10_w killed $x10_w def $x10
; RV64FINX-NEXT: #APP
; RV64FINX-NEXT: fadd.s t0, a0, s0
; RV64FINX-NEXT: #NO_APP
; RV64FINX-NEXT: mv a0, t0
; RV64FINX-NEXT: ld s0, 8(sp) # 8-byte Folded Reload
; RV64FINX-NEXT: addi sp, sp, 16
; RV64FINX-NEXT: ret
%1 = load float, ptr @gf
%2 = tail call float asm "fadd.s $0, $1, $2", "={t0},{a0},{s0}"(float %a, float %1)
ret float %2
}
define float @constraint_f_float(float %a) nounwind {
; RV32FINX-LABEL: constraint_f_float:
; RV32FINX: # %bb.0:
; RV32FINX-NEXT: lui a1, %hi(gf)
; RV32FINX-NEXT: lw a1, %lo(gf)(a1)
; RV32FINX-NEXT: #APP
; RV32FINX-NEXT: fadd.s a0, a0, a1
; RV32FINX-NEXT: #NO_APP
; RV32FINX-NEXT: ret
;
; RV64FINX-LABEL: constraint_f_float:
; RV64FINX: # %bb.0:
; RV64FINX-NEXT: lui a1, %hi(gf)
; RV64FINX-NEXT: lw a1, %lo(gf)(a1)
; RV64FINX-NEXT: #APP
; RV64FINX-NEXT: fadd.s a0, a0, a1
; RV64FINX-NEXT: #NO_APP
; RV64FINX-NEXT: ret
%1 = load float, ptr @gf
%2 = tail call float asm "fadd.s $0, $1, $2", "=f,f,f"(float %a, float %1)
ret float %2
}
define float @constraint_cf_float(float %a) nounwind {
; RV32FINX-LABEL: constraint_cf_float:
; RV32FINX: # %bb.0:
; RV32FINX-NEXT: lui a1, %hi(gf)
; RV32FINX-NEXT: lw a1, %lo(gf)(a1)
; RV32FINX-NEXT: #APP
; RV32FINX-NEXT: fadd.s a0, a0, a1
; RV32FINX-NEXT: #NO_APP
; RV32FINX-NEXT: ret
;
; RV64FINX-LABEL: constraint_cf_float:
; RV64FINX: # %bb.0:
; RV64FINX-NEXT: lui a1, %hi(gf)
; RV64FINX-NEXT: lw a1, %lo(gf)(a1)
; RV64FINX-NEXT: #APP
; RV64FINX-NEXT: fadd.s a0, a0, a1
; RV64FINX-NEXT: #NO_APP
; RV64FINX-NEXT: ret
%1 = load float, ptr @gf
%2 = tail call float asm "fadd.s $0, $1, $2", "=^cf,cf,cf"(float %a, float %1)
ret float %2
}
|