diff --git a/llvm/test/CodeGen/RISCV/double-arith.ll b/llvm/test/CodeGen/RISCV/double-arith.ll --- a/llvm/test/CodeGen/RISCV/double-arith.ll +++ b/llvm/test/CodeGen/RISCV/double-arith.ll @@ -196,50 +196,6 @@ ret double %1 } -declare double @llvm.sqrt.f64(double) - -define double @fsqrt_d(double %a) nounwind { -; RV32IFD-LABEL: fsqrt_d: -; RV32IFD: # %bb.0: -; RV32IFD-NEXT: addi sp, sp, -16 -; RV32IFD-NEXT: sw a0, 8(sp) -; RV32IFD-NEXT: sw a1, 12(sp) -; RV32IFD-NEXT: fld ft0, 8(sp) -; RV32IFD-NEXT: fsqrt.d ft0, ft0 -; RV32IFD-NEXT: fsd ft0, 8(sp) -; RV32IFD-NEXT: lw a0, 8(sp) -; RV32IFD-NEXT: lw a1, 12(sp) -; RV32IFD-NEXT: addi sp, sp, 16 -; RV32IFD-NEXT: ret -; -; RV64IFD-LABEL: fsqrt_d: -; RV64IFD: # %bb.0: -; RV64IFD-NEXT: fmv.d.x ft0, a0 -; RV64IFD-NEXT: fsqrt.d ft0, ft0 -; RV64IFD-NEXT: fmv.x.d a0, ft0 -; RV64IFD-NEXT: ret -; -; RV32I-LABEL: fsqrt_d: -; RV32I: # %bb.0: -; RV32I-NEXT: addi sp, sp, -16 -; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill -; RV32I-NEXT: call sqrt@plt -; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload -; RV32I-NEXT: addi sp, sp, 16 -; RV32I-NEXT: ret -; -; RV64I-LABEL: fsqrt_d: -; RV64I: # %bb.0: -; RV64I-NEXT: addi sp, sp, -16 -; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill -; RV64I-NEXT: call sqrt@plt -; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload -; RV64I-NEXT: addi sp, sp, 16 -; RV64I-NEXT: ret - %1 = call double @llvm.sqrt.f64(double %a) - ret double %1 -} - declare double @llvm.copysign.f64(double, double) define double @fsgnj_d(double %a, double %b) nounwind { @@ -472,237 +428,6 @@ ret double %3 } -declare double @llvm.minnum.f64(double, double) - -define double @fmin_d(double %a, double %b) nounwind { -; RV32IFD-LABEL: fmin_d: -; RV32IFD: # %bb.0: -; RV32IFD-NEXT: addi sp, sp, -16 -; RV32IFD-NEXT: sw a2, 8(sp) -; RV32IFD-NEXT: sw a3, 12(sp) -; RV32IFD-NEXT: fld ft0, 8(sp) -; RV32IFD-NEXT: sw a0, 8(sp) -; RV32IFD-NEXT: sw a1, 12(sp) -; RV32IFD-NEXT: fld ft1, 8(sp) -; RV32IFD-NEXT: fmin.d ft0, ft1, ft0 -; RV32IFD-NEXT: fsd ft0, 8(sp) -; RV32IFD-NEXT: lw a0, 8(sp) -; RV32IFD-NEXT: lw a1, 12(sp) -; RV32IFD-NEXT: addi sp, sp, 16 -; RV32IFD-NEXT: ret -; -; RV64IFD-LABEL: fmin_d: -; RV64IFD: # %bb.0: -; RV64IFD-NEXT: fmv.d.x ft0, a1 -; RV64IFD-NEXT: fmv.d.x ft1, a0 -; RV64IFD-NEXT: fmin.d ft0, ft1, ft0 -; RV64IFD-NEXT: fmv.x.d a0, ft0 -; RV64IFD-NEXT: ret -; -; RV32I-LABEL: fmin_d: -; RV32I: # %bb.0: -; RV32I-NEXT: addi sp, sp, -16 -; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill -; RV32I-NEXT: call fmin@plt -; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload -; RV32I-NEXT: addi sp, sp, 16 -; RV32I-NEXT: ret -; -; RV64I-LABEL: fmin_d: -; RV64I: # %bb.0: -; RV64I-NEXT: addi sp, sp, -16 -; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill -; RV64I-NEXT: call fmin@plt -; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload -; RV64I-NEXT: addi sp, sp, 16 -; RV64I-NEXT: ret - %1 = call double @llvm.minnum.f64(double %a, double %b) - ret double %1 -} - -declare double @llvm.maxnum.f64(double, double) - -define double @fmax_d(double %a, double %b) nounwind { -; RV32IFD-LABEL: fmax_d: -; RV32IFD: # %bb.0: -; RV32IFD-NEXT: addi sp, sp, -16 -; RV32IFD-NEXT: sw a2, 8(sp) -; RV32IFD-NEXT: sw a3, 12(sp) -; RV32IFD-NEXT: fld ft0, 8(sp) -; RV32IFD-NEXT: sw a0, 8(sp) -; RV32IFD-NEXT: sw a1, 12(sp) -; RV32IFD-NEXT: fld ft1, 8(sp) -; RV32IFD-NEXT: fmax.d ft0, ft1, ft0 -; RV32IFD-NEXT: fsd ft0, 8(sp) -; RV32IFD-NEXT: lw a0, 8(sp) -; RV32IFD-NEXT: lw a1, 12(sp) -; RV32IFD-NEXT: addi sp, sp, 16 -; RV32IFD-NEXT: ret -; -; RV64IFD-LABEL: fmax_d: -; RV64IFD: # %bb.0: -; RV64IFD-NEXT: fmv.d.x ft0, a1 -; RV64IFD-NEXT: fmv.d.x ft1, a0 -; RV64IFD-NEXT: fmax.d ft0, ft1, ft0 -; RV64IFD-NEXT: fmv.x.d a0, ft0 -; RV64IFD-NEXT: ret -; -; RV32I-LABEL: fmax_d: -; RV32I: # %bb.0: -; RV32I-NEXT: addi sp, sp, -16 -; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill -; RV32I-NEXT: call fmax@plt -; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload -; RV32I-NEXT: addi sp, sp, 16 -; RV32I-NEXT: ret -; -; RV64I-LABEL: fmax_d: -; RV64I: # %bb.0: -; RV64I-NEXT: addi sp, sp, -16 -; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill -; RV64I-NEXT: call fmax@plt -; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload -; RV64I-NEXT: addi sp, sp, 16 -; RV64I-NEXT: ret - %1 = call double @llvm.maxnum.f64(double %a, double %b) - ret double %1 -} - -define i32 @feq_d(double %a, double %b) nounwind { -; RV32IFD-LABEL: feq_d: -; RV32IFD: # %bb.0: -; RV32IFD-NEXT: addi sp, sp, -16 -; RV32IFD-NEXT: sw a2, 8(sp) -; RV32IFD-NEXT: sw a3, 12(sp) -; RV32IFD-NEXT: fld ft0, 8(sp) -; RV32IFD-NEXT: sw a0, 8(sp) -; RV32IFD-NEXT: sw a1, 12(sp) -; RV32IFD-NEXT: fld ft1, 8(sp) -; RV32IFD-NEXT: feq.d a0, ft1, ft0 -; RV32IFD-NEXT: addi sp, sp, 16 -; RV32IFD-NEXT: ret -; -; RV64IFD-LABEL: feq_d: -; RV64IFD: # %bb.0: -; RV64IFD-NEXT: fmv.d.x ft0, a1 -; RV64IFD-NEXT: fmv.d.x ft1, a0 -; RV64IFD-NEXT: feq.d a0, ft1, ft0 -; RV64IFD-NEXT: ret -; -; RV32I-LABEL: feq_d: -; RV32I: # %bb.0: -; RV32I-NEXT: addi sp, sp, -16 -; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill -; RV32I-NEXT: call __eqdf2@plt -; RV32I-NEXT: seqz a0, a0 -; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload -; RV32I-NEXT: addi sp, sp, 16 -; RV32I-NEXT: ret -; -; RV64I-LABEL: feq_d: -; RV64I: # %bb.0: -; RV64I-NEXT: addi sp, sp, -16 -; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill -; RV64I-NEXT: call __eqdf2@plt -; RV64I-NEXT: seqz a0, a0 -; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload -; RV64I-NEXT: addi sp, sp, 16 -; RV64I-NEXT: ret - %1 = fcmp oeq double %a, %b - %2 = zext i1 %1 to i32 - ret i32 %2 -} - -define i32 @flt_d(double %a, double %b) nounwind { -; RV32IFD-LABEL: flt_d: -; RV32IFD: # %bb.0: -; RV32IFD-NEXT: addi sp, sp, -16 -; RV32IFD-NEXT: sw a2, 8(sp) -; RV32IFD-NEXT: sw a3, 12(sp) -; RV32IFD-NEXT: fld ft0, 8(sp) -; RV32IFD-NEXT: sw a0, 8(sp) -; RV32IFD-NEXT: sw a1, 12(sp) -; RV32IFD-NEXT: fld ft1, 8(sp) -; RV32IFD-NEXT: flt.d a0, ft1, ft0 -; RV32IFD-NEXT: addi sp, sp, 16 -; RV32IFD-NEXT: ret -; -; RV64IFD-LABEL: flt_d: -; RV64IFD: # %bb.0: -; RV64IFD-NEXT: fmv.d.x ft0, a1 -; RV64IFD-NEXT: fmv.d.x ft1, a0 -; RV64IFD-NEXT: flt.d a0, ft1, ft0 -; RV64IFD-NEXT: ret -; -; RV32I-LABEL: flt_d: -; RV32I: # %bb.0: -; RV32I-NEXT: addi sp, sp, -16 -; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill -; RV32I-NEXT: call __ltdf2@plt -; RV32I-NEXT: slti a0, a0, 0 -; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload -; RV32I-NEXT: addi sp, sp, 16 -; RV32I-NEXT: ret -; -; RV64I-LABEL: flt_d: -; RV64I: # %bb.0: -; RV64I-NEXT: addi sp, sp, -16 -; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill -; RV64I-NEXT: call __ltdf2@plt -; RV64I-NEXT: slti a0, a0, 0 -; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload -; RV64I-NEXT: addi sp, sp, 16 -; RV64I-NEXT: ret - %1 = fcmp olt double %a, %b - %2 = zext i1 %1 to i32 - ret i32 %2 -} - -define i32 @fle_d(double %a, double %b) nounwind { -; RV32IFD-LABEL: fle_d: -; RV32IFD: # %bb.0: -; RV32IFD-NEXT: addi sp, sp, -16 -; RV32IFD-NEXT: sw a2, 8(sp) -; RV32IFD-NEXT: sw a3, 12(sp) -; RV32IFD-NEXT: fld ft0, 8(sp) -; RV32IFD-NEXT: sw a0, 8(sp) -; RV32IFD-NEXT: sw a1, 12(sp) -; RV32IFD-NEXT: fld ft1, 8(sp) -; RV32IFD-NEXT: fle.d a0, ft1, ft0 -; RV32IFD-NEXT: addi sp, sp, 16 -; RV32IFD-NEXT: ret -; -; RV64IFD-LABEL: fle_d: -; RV64IFD: # %bb.0: -; RV64IFD-NEXT: fmv.d.x ft0, a1 -; RV64IFD-NEXT: fmv.d.x ft1, a0 -; RV64IFD-NEXT: fle.d a0, ft1, ft0 -; RV64IFD-NEXT: ret -; -; RV32I-LABEL: fle_d: -; RV32I: # %bb.0: -; RV32I-NEXT: addi sp, sp, -16 -; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill -; RV32I-NEXT: call __ledf2@plt -; RV32I-NEXT: slti a0, a0, 1 -; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload -; RV32I-NEXT: addi sp, sp, 16 -; RV32I-NEXT: ret -; -; RV64I-LABEL: fle_d: -; RV64I: # %bb.0: -; RV64I-NEXT: addi sp, sp, -16 -; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill -; RV64I-NEXT: call __ledf2@plt -; RV64I-NEXT: slti a0, a0, 1 -; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload -; RV64I-NEXT: addi sp, sp, 16 -; RV64I-NEXT: ret - %1 = fcmp ole double %a, %b - %2 = zext i1 %1 to i32 - ret i32 %2 -} - declare double @llvm.fma.f64(double, double, double) define double @fmadd_d(double %a, double %b, double %c) nounwind { diff --git a/llvm/test/CodeGen/RISCV/double-intrinsics.ll b/llvm/test/CodeGen/RISCV/double-intrinsics.ll --- a/llvm/test/CodeGen/RISCV/double-intrinsics.ll +++ b/llvm/test/CodeGen/RISCV/double-intrinsics.ll @@ -538,58 +538,6 @@ ret double %1 } -declare double @llvm.fma.f64(double, double, double) - -define double @fma_f64(double %a, double %b, double %c) nounwind { -; RV32IFD-LABEL: fma_f64: -; RV32IFD: # %bb.0: -; RV32IFD-NEXT: addi sp, sp, -16 -; RV32IFD-NEXT: sw a4, 8(sp) -; RV32IFD-NEXT: sw a5, 12(sp) -; RV32IFD-NEXT: fld ft0, 8(sp) -; RV32IFD-NEXT: sw a2, 8(sp) -; RV32IFD-NEXT: sw a3, 12(sp) -; RV32IFD-NEXT: fld ft1, 8(sp) -; RV32IFD-NEXT: sw a0, 8(sp) -; RV32IFD-NEXT: sw a1, 12(sp) -; RV32IFD-NEXT: fld ft2, 8(sp) -; RV32IFD-NEXT: fmadd.d ft0, ft2, ft1, ft0 -; RV32IFD-NEXT: fsd ft0, 8(sp) -; RV32IFD-NEXT: lw a0, 8(sp) -; RV32IFD-NEXT: lw a1, 12(sp) -; RV32IFD-NEXT: addi sp, sp, 16 -; RV32IFD-NEXT: ret -; -; RV64IFD-LABEL: fma_f64: -; RV64IFD: # %bb.0: -; RV64IFD-NEXT: fmv.d.x ft0, a2 -; RV64IFD-NEXT: fmv.d.x ft1, a1 -; RV64IFD-NEXT: fmv.d.x ft2, a0 -; RV64IFD-NEXT: fmadd.d ft0, ft2, ft1, ft0 -; RV64IFD-NEXT: fmv.x.d a0, ft0 -; RV64IFD-NEXT: ret -; -; RV32I-LABEL: fma_f64: -; RV32I: # %bb.0: -; RV32I-NEXT: addi sp, sp, -16 -; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill -; RV32I-NEXT: call fma@plt -; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload -; RV32I-NEXT: addi sp, sp, 16 -; RV32I-NEXT: ret -; -; RV64I-LABEL: fma_f64: -; RV64I: # %bb.0: -; RV64I-NEXT: addi sp, sp, -16 -; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill -; RV64I-NEXT: call fma@plt -; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload -; RV64I-NEXT: addi sp, sp, 16 -; RV64I-NEXT: ret - %1 = call double @llvm.fma.f64(double %a, double %b, double %c) - ret double %1 -} - declare double @llvm.fmuladd.f64(double, double, double) define double @fmuladd_f64(double %a, double %b, double %c) nounwind { @@ -656,40 +604,6 @@ ret double %1 } -declare double @llvm.fabs.f64(double) - -define double @fabs_f64(double %a) nounwind { -; RV32IFD-LABEL: fabs_f64: -; RV32IFD: # %bb.0: -; RV32IFD-NEXT: lui a2, 524288 -; RV32IFD-NEXT: addi a2, a2, -1 -; RV32IFD-NEXT: and a1, a1, a2 -; RV32IFD-NEXT: ret -; -; RV64IFD-LABEL: fabs_f64: -; RV64IFD: # %bb.0: -; RV64IFD-NEXT: addi a1, zero, -1 -; RV64IFD-NEXT: srli a1, a1, 1 -; RV64IFD-NEXT: and a0, a0, a1 -; RV64IFD-NEXT: ret -; -; RV32I-LABEL: fabs_f64: -; RV32I: # %bb.0: -; RV32I-NEXT: lui a2, 524288 -; RV32I-NEXT: addi a2, a2, -1 -; RV32I-NEXT: and a1, a1, a2 -; RV32I-NEXT: ret -; -; RV64I-LABEL: fabs_f64: -; RV64I: # %bb.0: -; RV64I-NEXT: addi a1, zero, -1 -; RV64I-NEXT: srli a1, a1, 1 -; RV64I-NEXT: and a0, a0, a1 -; RV64I-NEXT: ret - %1 = call double @llvm.fabs.f64(double %a) - ret double %1 -} - declare double @llvm.minnum.f64(double, double) define double @minnum_f64(double %a, double %b) nounwind { @@ -803,55 +717,6 @@ ; ret double %1 ; } -declare double @llvm.copysign.f64(double, double) - -define double @copysign_f64(double %a, double %b) nounwind { -; RV32IFD-LABEL: copysign_f64: -; RV32IFD: # %bb.0: -; RV32IFD-NEXT: addi sp, sp, -16 -; RV32IFD-NEXT: sw a2, 8(sp) -; RV32IFD-NEXT: sw a3, 12(sp) -; RV32IFD-NEXT: fld ft0, 8(sp) -; RV32IFD-NEXT: sw a0, 8(sp) -; RV32IFD-NEXT: sw a1, 12(sp) -; RV32IFD-NEXT: fld ft1, 8(sp) -; RV32IFD-NEXT: fsgnj.d ft0, ft1, ft0 -; RV32IFD-NEXT: fsd ft0, 8(sp) -; RV32IFD-NEXT: lw a0, 8(sp) -; RV32IFD-NEXT: lw a1, 12(sp) -; RV32IFD-NEXT: addi sp, sp, 16 -; RV32IFD-NEXT: ret -; -; RV64IFD-LABEL: copysign_f64: -; RV64IFD: # %bb.0: -; RV64IFD-NEXT: fmv.d.x ft0, a1 -; RV64IFD-NEXT: fmv.d.x ft1, a0 -; RV64IFD-NEXT: fsgnj.d ft0, ft1, ft0 -; RV64IFD-NEXT: fmv.x.d a0, ft0 -; RV64IFD-NEXT: ret -; -; RV32I-LABEL: copysign_f64: -; RV32I: # %bb.0: -; RV32I-NEXT: lui a2, 524288 -; RV32I-NEXT: and a3, a3, a2 -; RV32I-NEXT: addi a2, a2, -1 -; RV32I-NEXT: and a1, a1, a2 -; RV32I-NEXT: or a1, a1, a3 -; RV32I-NEXT: ret -; -; RV64I-LABEL: copysign_f64: -; RV64I: # %bb.0: -; RV64I-NEXT: addi a2, zero, -1 -; RV64I-NEXT: slli a3, a2, 63 -; RV64I-NEXT: and a1, a1, a3 -; RV64I-NEXT: srli a2, a2, 1 -; RV64I-NEXT: and a0, a0, a2 -; RV64I-NEXT: or a0, a0, a1 -; RV64I-NEXT: ret - %1 = call double @llvm.copysign.f64(double %a, double %b) - ret double %1 -} - declare double @llvm.floor.f64(double) define double @floor_f64(double %a) nounwind { diff --git a/llvm/test/CodeGen/RISCV/float-arith.ll b/llvm/test/CodeGen/RISCV/float-arith.ll --- a/llvm/test/CodeGen/RISCV/float-arith.ll +++ b/llvm/test/CodeGen/RISCV/float-arith.ll @@ -164,44 +164,6 @@ ret float %1 } -declare float @llvm.sqrt.f32(float) - -define float @fsqrt_s(float %a) nounwind { -; RV32IF-LABEL: fsqrt_s: -; RV32IF: # %bb.0: -; RV32IF-NEXT: fmv.w.x ft0, a0 -; RV32IF-NEXT: fsqrt.s ft0, ft0 -; RV32IF-NEXT: fmv.x.w a0, ft0 -; RV32IF-NEXT: ret -; -; RV64IF-LABEL: fsqrt_s: -; RV64IF: # %bb.0: -; RV64IF-NEXT: fmv.w.x ft0, a0 -; RV64IF-NEXT: fsqrt.s ft0, ft0 -; RV64IF-NEXT: fmv.x.w a0, ft0 -; RV64IF-NEXT: ret -; -; RV32I-LABEL: fsqrt_s: -; RV32I: # %bb.0: -; RV32I-NEXT: addi sp, sp, -16 -; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill -; RV32I-NEXT: call sqrtf@plt -; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload -; RV32I-NEXT: addi sp, sp, 16 -; RV32I-NEXT: ret -; -; RV64I-LABEL: fsqrt_s: -; RV64I: # %bb.0: -; RV64I-NEXT: addi sp, sp, -16 -; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill -; RV64I-NEXT: call sqrtf@plt -; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload -; RV64I-NEXT: addi sp, sp, 16 -; RV64I-NEXT: ret - %1 = call float @llvm.sqrt.f32(float %a) - ret float %1 -} - declare float @llvm.copysign.f32(float, float) define float @fsgnj_s(float %a, float %b) nounwind { @@ -415,203 +377,6 @@ ret float %3 } -declare float @llvm.minnum.f32(float, float) - -define float @fmin_s(float %a, float %b) nounwind { -; RV32IF-LABEL: fmin_s: -; RV32IF: # %bb.0: -; RV32IF-NEXT: fmv.w.x ft0, a1 -; RV32IF-NEXT: fmv.w.x ft1, a0 -; RV32IF-NEXT: fmin.s ft0, ft1, ft0 -; RV32IF-NEXT: fmv.x.w a0, ft0 -; RV32IF-NEXT: ret -; -; RV64IF-LABEL: fmin_s: -; RV64IF: # %bb.0: -; RV64IF-NEXT: fmv.w.x ft0, a1 -; RV64IF-NEXT: fmv.w.x ft1, a0 -; RV64IF-NEXT: fmin.s ft0, ft1, ft0 -; RV64IF-NEXT: fmv.x.w a0, ft0 -; RV64IF-NEXT: ret -; -; RV32I-LABEL: fmin_s: -; RV32I: # %bb.0: -; RV32I-NEXT: addi sp, sp, -16 -; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill -; RV32I-NEXT: call fminf@plt -; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload -; RV32I-NEXT: addi sp, sp, 16 -; RV32I-NEXT: ret -; -; RV64I-LABEL: fmin_s: -; RV64I: # %bb.0: -; RV64I-NEXT: addi sp, sp, -16 -; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill -; RV64I-NEXT: call fminf@plt -; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload -; RV64I-NEXT: addi sp, sp, 16 -; RV64I-NEXT: ret - %1 = call float @llvm.minnum.f32(float %a, float %b) - ret float %1 -} - -declare float @llvm.maxnum.f32(float, float) - -define float @fmax_s(float %a, float %b) nounwind { -; RV32IF-LABEL: fmax_s: -; RV32IF: # %bb.0: -; RV32IF-NEXT: fmv.w.x ft0, a1 -; RV32IF-NEXT: fmv.w.x ft1, a0 -; RV32IF-NEXT: fmax.s ft0, ft1, ft0 -; RV32IF-NEXT: fmv.x.w a0, ft0 -; RV32IF-NEXT: ret -; -; RV64IF-LABEL: fmax_s: -; RV64IF: # %bb.0: -; RV64IF-NEXT: fmv.w.x ft0, a1 -; RV64IF-NEXT: fmv.w.x ft1, a0 -; RV64IF-NEXT: fmax.s ft0, ft1, ft0 -; RV64IF-NEXT: fmv.x.w a0, ft0 -; RV64IF-NEXT: ret -; -; RV32I-LABEL: fmax_s: -; RV32I: # %bb.0: -; RV32I-NEXT: addi sp, sp, -16 -; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill -; RV32I-NEXT: call fmaxf@plt -; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload -; RV32I-NEXT: addi sp, sp, 16 -; RV32I-NEXT: ret -; -; RV64I-LABEL: fmax_s: -; RV64I: # %bb.0: -; RV64I-NEXT: addi sp, sp, -16 -; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill -; RV64I-NEXT: call fmaxf@plt -; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload -; RV64I-NEXT: addi sp, sp, 16 -; RV64I-NEXT: ret - %1 = call float @llvm.maxnum.f32(float %a, float %b) - ret float %1 -} - -define i32 @feq_s(float %a, float %b) nounwind { -; RV32IF-LABEL: feq_s: -; RV32IF: # %bb.0: -; RV32IF-NEXT: fmv.w.x ft0, a1 -; RV32IF-NEXT: fmv.w.x ft1, a0 -; RV32IF-NEXT: feq.s a0, ft1, ft0 -; RV32IF-NEXT: ret -; -; RV64IF-LABEL: feq_s: -; RV64IF: # %bb.0: -; RV64IF-NEXT: fmv.w.x ft0, a1 -; RV64IF-NEXT: fmv.w.x ft1, a0 -; RV64IF-NEXT: feq.s a0, ft1, ft0 -; RV64IF-NEXT: ret -; -; RV32I-LABEL: feq_s: -; RV32I: # %bb.0: -; RV32I-NEXT: addi sp, sp, -16 -; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill -; RV32I-NEXT: call __eqsf2@plt -; RV32I-NEXT: seqz a0, a0 -; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload -; RV32I-NEXT: addi sp, sp, 16 -; RV32I-NEXT: ret -; -; RV64I-LABEL: feq_s: -; RV64I: # %bb.0: -; RV64I-NEXT: addi sp, sp, -16 -; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill -; RV64I-NEXT: call __eqsf2@plt -; RV64I-NEXT: seqz a0, a0 -; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload -; RV64I-NEXT: addi sp, sp, 16 -; RV64I-NEXT: ret - %1 = fcmp oeq float %a, %b - %2 = zext i1 %1 to i32 - ret i32 %2 -} - -define i32 @flt_s(float %a, float %b) nounwind { -; RV32IF-LABEL: flt_s: -; RV32IF: # %bb.0: -; RV32IF-NEXT: fmv.w.x ft0, a1 -; RV32IF-NEXT: fmv.w.x ft1, a0 -; RV32IF-NEXT: flt.s a0, ft1, ft0 -; RV32IF-NEXT: ret -; -; RV64IF-LABEL: flt_s: -; RV64IF: # %bb.0: -; RV64IF-NEXT: fmv.w.x ft0, a1 -; RV64IF-NEXT: fmv.w.x ft1, a0 -; RV64IF-NEXT: flt.s a0, ft1, ft0 -; RV64IF-NEXT: ret -; -; RV32I-LABEL: flt_s: -; RV32I: # %bb.0: -; RV32I-NEXT: addi sp, sp, -16 -; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill -; RV32I-NEXT: call __ltsf2@plt -; RV32I-NEXT: slti a0, a0, 0 -; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload -; RV32I-NEXT: addi sp, sp, 16 -; RV32I-NEXT: ret -; -; RV64I-LABEL: flt_s: -; RV64I: # %bb.0: -; RV64I-NEXT: addi sp, sp, -16 -; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill -; RV64I-NEXT: call __ltsf2@plt -; RV64I-NEXT: slti a0, a0, 0 -; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload -; RV64I-NEXT: addi sp, sp, 16 -; RV64I-NEXT: ret - %1 = fcmp olt float %a, %b - %2 = zext i1 %1 to i32 - ret i32 %2 -} - -define i32 @fle_s(float %a, float %b) nounwind { -; RV32IF-LABEL: fle_s: -; RV32IF: # %bb.0: -; RV32IF-NEXT: fmv.w.x ft0, a1 -; RV32IF-NEXT: fmv.w.x ft1, a0 -; RV32IF-NEXT: fle.s a0, ft1, ft0 -; RV32IF-NEXT: ret -; -; RV64IF-LABEL: fle_s: -; RV64IF: # %bb.0: -; RV64IF-NEXT: fmv.w.x ft0, a1 -; RV64IF-NEXT: fmv.w.x ft1, a0 -; RV64IF-NEXT: fle.s a0, ft1, ft0 -; RV64IF-NEXT: ret -; -; RV32I-LABEL: fle_s: -; RV32I: # %bb.0: -; RV32I-NEXT: addi sp, sp, -16 -; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill -; RV32I-NEXT: call __lesf2@plt -; RV32I-NEXT: slti a0, a0, 1 -; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload -; RV32I-NEXT: addi sp, sp, 16 -; RV32I-NEXT: ret -; -; RV64I-LABEL: fle_s: -; RV64I: # %bb.0: -; RV64I-NEXT: addi sp, sp, -16 -; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill -; RV64I-NEXT: call __lesf2@plt -; RV64I-NEXT: slti a0, a0, 1 -; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload -; RV64I-NEXT: addi sp, sp, 16 -; RV64I-NEXT: ret - %1 = fcmp ole float %a, %b - %2 = zext i1 %1 to i32 - ret i32 %2 -} - declare float @llvm.fma.f32(float, float, float) define float @fmadd_s(float %a, float %b, float %c) nounwind { diff --git a/llvm/test/CodeGen/RISCV/float-intrinsics.ll b/llvm/test/CodeGen/RISCV/float-intrinsics.ll --- a/llvm/test/CodeGen/RISCV/float-intrinsics.ll +++ b/llvm/test/CodeGen/RISCV/float-intrinsics.ll @@ -407,39 +407,6 @@ ret float %1 } -declare float @llvm.fma.f32(float, float, float) - -define float @fma_f32(float %a, float %b, float %c) nounwind { -; RV32IF-LABEL: fma_f32: -; RV32IF: # %bb.0: -; RV32IF-NEXT: fmv.w.x ft0, a2 -; RV32IF-NEXT: fmv.w.x ft1, a1 -; RV32IF-NEXT: fmv.w.x ft2, a0 -; RV32IF-NEXT: fmadd.s ft0, ft2, ft1, ft0 -; RV32IF-NEXT: fmv.x.w a0, ft0 -; RV32IF-NEXT: ret -; -; RV64IF-LABEL: fma_f32: -; RV64IF: # %bb.0: -; RV64IF-NEXT: fmv.w.x ft0, a2 -; RV64IF-NEXT: fmv.w.x ft1, a1 -; RV64IF-NEXT: fmv.w.x ft2, a0 -; RV64IF-NEXT: fmadd.s ft0, ft2, ft1, ft0 -; RV64IF-NEXT: fmv.x.w a0, ft0 -; RV64IF-NEXT: ret -; -; RV64I-LABEL: fma_f32: -; RV64I: # %bb.0: -; RV64I-NEXT: addi sp, sp, -16 -; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill -; RV64I-NEXT: call fmaf@plt -; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload -; RV64I-NEXT: addi sp, sp, 16 -; RV64I-NEXT: ret - %1 = call float @llvm.fma.f32(float %a, float %b, float %c) - ret float %1 -} - declare float @llvm.fmuladd.f32(float, float, float) define float @fmuladd_f32(float %a, float %b, float %c) nounwind { @@ -478,33 +445,6 @@ ret float %1 } -declare float @llvm.fabs.f32(float) - -define float @fabs_f32(float %a) nounwind { -; RV32IF-LABEL: fabs_f32: -; RV32IF: # %bb.0: -; RV32IF-NEXT: lui a1, 524288 -; RV32IF-NEXT: addi a1, a1, -1 -; RV32IF-NEXT: and a0, a0, a1 -; RV32IF-NEXT: ret -; -; RV64IF-LABEL: fabs_f32: -; RV64IF: # %bb.0: -; RV64IF-NEXT: lui a1, 524288 -; RV64IF-NEXT: addiw a1, a1, -1 -; RV64IF-NEXT: and a0, a0, a1 -; RV64IF-NEXT: ret -; -; RV64I-LABEL: fabs_f32: -; RV64I: # %bb.0: -; RV64I-NEXT: lui a1, 524288 -; RV64I-NEXT: addiw a1, a1, -1 -; RV64I-NEXT: and a0, a0, a1 -; RV64I-NEXT: ret - %1 = call float @llvm.fabs.f32(float %a) - ret float %1 -} - declare float @llvm.minnum.f32(float, float) define float @minnum_f32(float %a, float %b) nounwind { @@ -584,37 +524,6 @@ ; ret float %1 ; } -declare float @llvm.copysign.f32(float, float) - -define float @copysign_f32(float %a, float %b) nounwind { -; RV32IF-LABEL: copysign_f32: -; RV32IF: # %bb.0: -; RV32IF-NEXT: fmv.w.x ft0, a1 -; RV32IF-NEXT: fmv.w.x ft1, a0 -; RV32IF-NEXT: fsgnj.s ft0, ft1, ft0 -; RV32IF-NEXT: fmv.x.w a0, ft0 -; RV32IF-NEXT: ret -; -; RV64IF-LABEL: copysign_f32: -; RV64IF: # %bb.0: -; RV64IF-NEXT: fmv.w.x ft0, a1 -; RV64IF-NEXT: fmv.w.x ft1, a0 -; RV64IF-NEXT: fsgnj.s ft0, ft1, ft0 -; RV64IF-NEXT: fmv.x.w a0, ft0 -; RV64IF-NEXT: ret -; -; RV64I-LABEL: copysign_f32: -; RV64I: # %bb.0: -; RV64I-NEXT: lui a2, 524288 -; RV64I-NEXT: and a1, a1, a2 -; RV64I-NEXT: addiw a2, a2, -1 -; RV64I-NEXT: and a0, a0, a2 -; RV64I-NEXT: or a0, a0, a1 -; RV64I-NEXT: ret - %1 = call float @llvm.copysign.f32(float %a, float %b) - ret float %1 -} - declare float @llvm.floor.f32(float) define float @floor_f32(float %a) nounwind { diff --git a/llvm/test/CodeGen/RISCV/half-arith.ll b/llvm/test/CodeGen/RISCV/half-arith.ll --- a/llvm/test/CodeGen/RISCV/half-arith.ll +++ b/llvm/test/CodeGen/RISCV/half-arith.ll @@ -276,50 +276,6 @@ ret half %1 } -declare half @llvm.sqrt.f16(half) - -define half @fsqrt_s(half %a) nounwind { -; RV32IZFH-LABEL: fsqrt_s: -; RV32IZFH: # %bb.0: -; RV32IZFH-NEXT: fsqrt.h fa0, fa0 -; RV32IZFH-NEXT: ret -; -; RV64IZFH-LABEL: fsqrt_s: -; RV64IZFH: # %bb.0: -; RV64IZFH-NEXT: fsqrt.h fa0, fa0 -; RV64IZFH-NEXT: ret -; -; RV32I-LABEL: fsqrt_s: -; RV32I: # %bb.0: -; RV32I-NEXT: addi sp, sp, -16 -; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill -; RV32I-NEXT: lui a1, 16 -; RV32I-NEXT: addi a1, a1, -1 -; RV32I-NEXT: and a0, a0, a1 -; RV32I-NEXT: call __gnu_h2f_ieee@plt -; RV32I-NEXT: call sqrtf@plt -; RV32I-NEXT: call __gnu_f2h_ieee@plt -; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload -; RV32I-NEXT: addi sp, sp, 16 -; RV32I-NEXT: ret -; -; RV64I-LABEL: fsqrt_s: -; RV64I: # %bb.0: -; RV64I-NEXT: addi sp, sp, -16 -; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill -; RV64I-NEXT: lui a1, 16 -; RV64I-NEXT: addiw a1, a1, -1 -; RV64I-NEXT: and a0, a0, a1 -; RV64I-NEXT: call __gnu_h2f_ieee@plt -; RV64I-NEXT: call sqrtf@plt -; RV64I-NEXT: call __gnu_f2h_ieee@plt -; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload -; RV64I-NEXT: addi sp, sp, 16 -; RV64I-NEXT: ret - %1 = call half @llvm.sqrt.f16(half %a) - ret half %1 -} - declare half @llvm.copysign.f16(half, half) define half @fsgnj_s(half %a, half %b) nounwind { @@ -641,343 +597,6 @@ ret half %3 } -declare half @llvm.minnum.f16(half, half) - -define half @fmin_s(half %a, half %b) nounwind { -; RV32IZFH-LABEL: fmin_s: -; RV32IZFH: # %bb.0: -; RV32IZFH-NEXT: fmin.h fa0, fa0, fa1 -; RV32IZFH-NEXT: ret -; -; RV64IZFH-LABEL: fmin_s: -; RV64IZFH: # %bb.0: -; RV64IZFH-NEXT: fmin.h fa0, fa0, fa1 -; RV64IZFH-NEXT: ret -; -; RV32I-LABEL: fmin_s: -; RV32I: # %bb.0: -; RV32I-NEXT: addi sp, sp, -16 -; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill -; RV32I-NEXT: sw s0, 8(sp) # 4-byte Folded Spill -; RV32I-NEXT: sw s1, 4(sp) # 4-byte Folded Spill -; RV32I-NEXT: sw s2, 0(sp) # 4-byte Folded Spill -; RV32I-NEXT: mv s2, a1 -; RV32I-NEXT: lui a1, 16 -; RV32I-NEXT: addi s0, a1, -1 -; RV32I-NEXT: and a0, a0, s0 -; RV32I-NEXT: call __gnu_h2f_ieee@plt -; RV32I-NEXT: mv s1, a0 -; RV32I-NEXT: and a0, s2, s0 -; RV32I-NEXT: call __gnu_h2f_ieee@plt -; RV32I-NEXT: mv a1, a0 -; RV32I-NEXT: mv a0, s1 -; RV32I-NEXT: call fminf@plt -; RV32I-NEXT: call __gnu_f2h_ieee@plt -; RV32I-NEXT: lw s2, 0(sp) # 4-byte Folded Reload -; RV32I-NEXT: lw s1, 4(sp) # 4-byte Folded Reload -; RV32I-NEXT: lw s0, 8(sp) # 4-byte Folded Reload -; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload -; RV32I-NEXT: addi sp, sp, 16 -; RV32I-NEXT: ret -; -; RV64I-LABEL: fmin_s: -; RV64I: # %bb.0: -; RV64I-NEXT: addi sp, sp, -32 -; RV64I-NEXT: sd ra, 24(sp) # 8-byte Folded Spill -; RV64I-NEXT: sd s0, 16(sp) # 8-byte Folded Spill -; RV64I-NEXT: sd s1, 8(sp) # 8-byte Folded Spill -; RV64I-NEXT: sd s2, 0(sp) # 8-byte Folded Spill -; RV64I-NEXT: mv s2, a1 -; RV64I-NEXT: lui a1, 16 -; RV64I-NEXT: addiw s0, a1, -1 -; RV64I-NEXT: and a0, a0, s0 -; RV64I-NEXT: call __gnu_h2f_ieee@plt -; RV64I-NEXT: mv s1, a0 -; RV64I-NEXT: and a0, s2, s0 -; RV64I-NEXT: call __gnu_h2f_ieee@plt -; RV64I-NEXT: mv a1, a0 -; RV64I-NEXT: mv a0, s1 -; RV64I-NEXT: call fminf@plt -; RV64I-NEXT: call __gnu_f2h_ieee@plt -; RV64I-NEXT: ld s2, 0(sp) # 8-byte Folded Reload -; RV64I-NEXT: ld s1, 8(sp) # 8-byte Folded Reload -; RV64I-NEXT: ld s0, 16(sp) # 8-byte Folded Reload -; RV64I-NEXT: ld ra, 24(sp) # 8-byte Folded Reload -; RV64I-NEXT: addi sp, sp, 32 -; RV64I-NEXT: ret - %1 = call half @llvm.minnum.f16(half %a, half %b) - ret half %1 -} - -declare half @llvm.maxnum.f16(half, half) - -define half @fmax_s(half %a, half %b) nounwind { -; RV32IZFH-LABEL: fmax_s: -; RV32IZFH: # %bb.0: -; RV32IZFH-NEXT: fmax.h fa0, fa0, fa1 -; RV32IZFH-NEXT: ret -; -; RV64IZFH-LABEL: fmax_s: -; RV64IZFH: # %bb.0: -; RV64IZFH-NEXT: fmax.h fa0, fa0, fa1 -; RV64IZFH-NEXT: ret -; -; RV32I-LABEL: fmax_s: -; RV32I: # %bb.0: -; RV32I-NEXT: addi sp, sp, -16 -; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill -; RV32I-NEXT: sw s0, 8(sp) # 4-byte Folded Spill -; RV32I-NEXT: sw s1, 4(sp) # 4-byte Folded Spill -; RV32I-NEXT: sw s2, 0(sp) # 4-byte Folded Spill -; RV32I-NEXT: mv s2, a1 -; RV32I-NEXT: lui a1, 16 -; RV32I-NEXT: addi s0, a1, -1 -; RV32I-NEXT: and a0, a0, s0 -; RV32I-NEXT: call __gnu_h2f_ieee@plt -; RV32I-NEXT: mv s1, a0 -; RV32I-NEXT: and a0, s2, s0 -; RV32I-NEXT: call __gnu_h2f_ieee@plt -; RV32I-NEXT: mv a1, a0 -; RV32I-NEXT: mv a0, s1 -; RV32I-NEXT: call fmaxf@plt -; RV32I-NEXT: call __gnu_f2h_ieee@plt -; RV32I-NEXT: lw s2, 0(sp) # 4-byte Folded Reload -; RV32I-NEXT: lw s1, 4(sp) # 4-byte Folded Reload -; RV32I-NEXT: lw s0, 8(sp) # 4-byte Folded Reload -; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload -; RV32I-NEXT: addi sp, sp, 16 -; RV32I-NEXT: ret -; -; RV64I-LABEL: fmax_s: -; RV64I: # %bb.0: -; RV64I-NEXT: addi sp, sp, -32 -; RV64I-NEXT: sd ra, 24(sp) # 8-byte Folded Spill -; RV64I-NEXT: sd s0, 16(sp) # 8-byte Folded Spill -; RV64I-NEXT: sd s1, 8(sp) # 8-byte Folded Spill -; RV64I-NEXT: sd s2, 0(sp) # 8-byte Folded Spill -; RV64I-NEXT: mv s2, a1 -; RV64I-NEXT: lui a1, 16 -; RV64I-NEXT: addiw s0, a1, -1 -; RV64I-NEXT: and a0, a0, s0 -; RV64I-NEXT: call __gnu_h2f_ieee@plt -; RV64I-NEXT: mv s1, a0 -; RV64I-NEXT: and a0, s2, s0 -; RV64I-NEXT: call __gnu_h2f_ieee@plt -; RV64I-NEXT: mv a1, a0 -; RV64I-NEXT: mv a0, s1 -; RV64I-NEXT: call fmaxf@plt -; RV64I-NEXT: call __gnu_f2h_ieee@plt -; RV64I-NEXT: ld s2, 0(sp) # 8-byte Folded Reload -; RV64I-NEXT: ld s1, 8(sp) # 8-byte Folded Reload -; RV64I-NEXT: ld s0, 16(sp) # 8-byte Folded Reload -; RV64I-NEXT: ld ra, 24(sp) # 8-byte Folded Reload -; RV64I-NEXT: addi sp, sp, 32 -; RV64I-NEXT: ret - %1 = call half @llvm.maxnum.f16(half %a, half %b) - ret half %1 -} - -define i32 @feq_s(half %a, half %b) nounwind { -; RV32IZFH-LABEL: feq_s: -; RV32IZFH: # %bb.0: -; RV32IZFH-NEXT: feq.h a0, fa0, fa1 -; RV32IZFH-NEXT: ret -; -; RV64IZFH-LABEL: feq_s: -; RV64IZFH: # %bb.0: -; RV64IZFH-NEXT: feq.h a0, fa0, fa1 -; RV64IZFH-NEXT: ret -; -; RV32I-LABEL: feq_s: -; RV32I: # %bb.0: -; RV32I-NEXT: addi sp, sp, -16 -; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill -; RV32I-NEXT: sw s0, 8(sp) # 4-byte Folded Spill -; RV32I-NEXT: sw s1, 4(sp) # 4-byte Folded Spill -; RV32I-NEXT: sw s2, 0(sp) # 4-byte Folded Spill -; RV32I-NEXT: mv s2, a1 -; RV32I-NEXT: lui a1, 16 -; RV32I-NEXT: addi s0, a1, -1 -; RV32I-NEXT: and a0, a0, s0 -; RV32I-NEXT: call __gnu_h2f_ieee@plt -; RV32I-NEXT: mv s1, a0 -; RV32I-NEXT: and a0, s2, s0 -; RV32I-NEXT: call __gnu_h2f_ieee@plt -; RV32I-NEXT: mv a1, a0 -; RV32I-NEXT: mv a0, s1 -; RV32I-NEXT: call __eqsf2@plt -; RV32I-NEXT: seqz a0, a0 -; RV32I-NEXT: lw s2, 0(sp) # 4-byte Folded Reload -; RV32I-NEXT: lw s1, 4(sp) # 4-byte Folded Reload -; RV32I-NEXT: lw s0, 8(sp) # 4-byte Folded Reload -; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload -; RV32I-NEXT: addi sp, sp, 16 -; RV32I-NEXT: ret -; -; RV64I-LABEL: feq_s: -; RV64I: # %bb.0: -; RV64I-NEXT: addi sp, sp, -32 -; RV64I-NEXT: sd ra, 24(sp) # 8-byte Folded Spill -; RV64I-NEXT: sd s0, 16(sp) # 8-byte Folded Spill -; RV64I-NEXT: sd s1, 8(sp) # 8-byte Folded Spill -; RV64I-NEXT: sd s2, 0(sp) # 8-byte Folded Spill -; RV64I-NEXT: mv s2, a1 -; RV64I-NEXT: lui a1, 16 -; RV64I-NEXT: addiw s0, a1, -1 -; RV64I-NEXT: and a0, a0, s0 -; RV64I-NEXT: call __gnu_h2f_ieee@plt -; RV64I-NEXT: mv s1, a0 -; RV64I-NEXT: and a0, s2, s0 -; RV64I-NEXT: call __gnu_h2f_ieee@plt -; RV64I-NEXT: mv a1, a0 -; RV64I-NEXT: mv a0, s1 -; RV64I-NEXT: call __eqsf2@plt -; RV64I-NEXT: seqz a0, a0 -; RV64I-NEXT: ld s2, 0(sp) # 8-byte Folded Reload -; RV64I-NEXT: ld s1, 8(sp) # 8-byte Folded Reload -; RV64I-NEXT: ld s0, 16(sp) # 8-byte Folded Reload -; RV64I-NEXT: ld ra, 24(sp) # 8-byte Folded Reload -; RV64I-NEXT: addi sp, sp, 32 -; RV64I-NEXT: ret - %1 = fcmp oeq half %a, %b - %2 = zext i1 %1 to i32 - ret i32 %2 -} - -define i32 @flt_s(half %a, half %b) nounwind { -; RV32IZFH-LABEL: flt_s: -; RV32IZFH: # %bb.0: -; RV32IZFH-NEXT: flt.h a0, fa0, fa1 -; RV32IZFH-NEXT: ret -; -; RV64IZFH-LABEL: flt_s: -; RV64IZFH: # %bb.0: -; RV64IZFH-NEXT: flt.h a0, fa0, fa1 -; RV64IZFH-NEXT: ret -; -; RV32I-LABEL: flt_s: -; RV32I: # %bb.0: -; RV32I-NEXT: addi sp, sp, -16 -; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill -; RV32I-NEXT: sw s0, 8(sp) # 4-byte Folded Spill -; RV32I-NEXT: sw s1, 4(sp) # 4-byte Folded Spill -; RV32I-NEXT: sw s2, 0(sp) # 4-byte Folded Spill -; RV32I-NEXT: mv s2, a1 -; RV32I-NEXT: lui a1, 16 -; RV32I-NEXT: addi s0, a1, -1 -; RV32I-NEXT: and a0, a0, s0 -; RV32I-NEXT: call __gnu_h2f_ieee@plt -; RV32I-NEXT: mv s1, a0 -; RV32I-NEXT: and a0, s2, s0 -; RV32I-NEXT: call __gnu_h2f_ieee@plt -; RV32I-NEXT: mv a1, a0 -; RV32I-NEXT: mv a0, s1 -; RV32I-NEXT: call __ltsf2@plt -; RV32I-NEXT: slti a0, a0, 0 -; RV32I-NEXT: lw s2, 0(sp) # 4-byte Folded Reload -; RV32I-NEXT: lw s1, 4(sp) # 4-byte Folded Reload -; RV32I-NEXT: lw s0, 8(sp) # 4-byte Folded Reload -; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload -; RV32I-NEXT: addi sp, sp, 16 -; RV32I-NEXT: ret -; -; RV64I-LABEL: flt_s: -; RV64I: # %bb.0: -; RV64I-NEXT: addi sp, sp, -32 -; RV64I-NEXT: sd ra, 24(sp) # 8-byte Folded Spill -; RV64I-NEXT: sd s0, 16(sp) # 8-byte Folded Spill -; RV64I-NEXT: sd s1, 8(sp) # 8-byte Folded Spill -; RV64I-NEXT: sd s2, 0(sp) # 8-byte Folded Spill -; RV64I-NEXT: mv s2, a1 -; RV64I-NEXT: lui a1, 16 -; RV64I-NEXT: addiw s0, a1, -1 -; RV64I-NEXT: and a0, a0, s0 -; RV64I-NEXT: call __gnu_h2f_ieee@plt -; RV64I-NEXT: mv s1, a0 -; RV64I-NEXT: and a0, s2, s0 -; RV64I-NEXT: call __gnu_h2f_ieee@plt -; RV64I-NEXT: mv a1, a0 -; RV64I-NEXT: mv a0, s1 -; RV64I-NEXT: call __ltsf2@plt -; RV64I-NEXT: slti a0, a0, 0 -; RV64I-NEXT: ld s2, 0(sp) # 8-byte Folded Reload -; RV64I-NEXT: ld s1, 8(sp) # 8-byte Folded Reload -; RV64I-NEXT: ld s0, 16(sp) # 8-byte Folded Reload -; RV64I-NEXT: ld ra, 24(sp) # 8-byte Folded Reload -; RV64I-NEXT: addi sp, sp, 32 -; RV64I-NEXT: ret - %1 = fcmp olt half %a, %b - %2 = zext i1 %1 to i32 - ret i32 %2 -} - -define i32 @fle_s(half %a, half %b) nounwind { -; RV32IZFH-LABEL: fle_s: -; RV32IZFH: # %bb.0: -; RV32IZFH-NEXT: fle.h a0, fa0, fa1 -; RV32IZFH-NEXT: ret -; -; RV64IZFH-LABEL: fle_s: -; RV64IZFH: # %bb.0: -; RV64IZFH-NEXT: fle.h a0, fa0, fa1 -; RV64IZFH-NEXT: ret -; -; RV32I-LABEL: fle_s: -; RV32I: # %bb.0: -; RV32I-NEXT: addi sp, sp, -16 -; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill -; RV32I-NEXT: sw s0, 8(sp) # 4-byte Folded Spill -; RV32I-NEXT: sw s1, 4(sp) # 4-byte Folded Spill -; RV32I-NEXT: sw s2, 0(sp) # 4-byte Folded Spill -; RV32I-NEXT: mv s2, a1 -; RV32I-NEXT: lui a1, 16 -; RV32I-NEXT: addi s0, a1, -1 -; RV32I-NEXT: and a0, a0, s0 -; RV32I-NEXT: call __gnu_h2f_ieee@plt -; RV32I-NEXT: mv s1, a0 -; RV32I-NEXT: and a0, s2, s0 -; RV32I-NEXT: call __gnu_h2f_ieee@plt -; RV32I-NEXT: mv a1, a0 -; RV32I-NEXT: mv a0, s1 -; RV32I-NEXT: call __lesf2@plt -; RV32I-NEXT: slti a0, a0, 1 -; RV32I-NEXT: lw s2, 0(sp) # 4-byte Folded Reload -; RV32I-NEXT: lw s1, 4(sp) # 4-byte Folded Reload -; RV32I-NEXT: lw s0, 8(sp) # 4-byte Folded Reload -; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload -; RV32I-NEXT: addi sp, sp, 16 -; RV32I-NEXT: ret -; -; RV64I-LABEL: fle_s: -; RV64I: # %bb.0: -; RV64I-NEXT: addi sp, sp, -32 -; RV64I-NEXT: sd ra, 24(sp) # 8-byte Folded Spill -; RV64I-NEXT: sd s0, 16(sp) # 8-byte Folded Spill -; RV64I-NEXT: sd s1, 8(sp) # 8-byte Folded Spill -; RV64I-NEXT: sd s2, 0(sp) # 8-byte Folded Spill -; RV64I-NEXT: mv s2, a1 -; RV64I-NEXT: lui a1, 16 -; RV64I-NEXT: addiw s0, a1, -1 -; RV64I-NEXT: and a0, a0, s0 -; RV64I-NEXT: call __gnu_h2f_ieee@plt -; RV64I-NEXT: mv s1, a0 -; RV64I-NEXT: and a0, s2, s0 -; RV64I-NEXT: call __gnu_h2f_ieee@plt -; RV64I-NEXT: mv a1, a0 -; RV64I-NEXT: mv a0, s1 -; RV64I-NEXT: call __lesf2@plt -; RV64I-NEXT: slti a0, a0, 1 -; RV64I-NEXT: ld s2, 0(sp) # 8-byte Folded Reload -; RV64I-NEXT: ld s1, 8(sp) # 8-byte Folded Reload -; RV64I-NEXT: ld s0, 16(sp) # 8-byte Folded Reload -; RV64I-NEXT: ld ra, 24(sp) # 8-byte Folded Reload -; RV64I-NEXT: addi sp, sp, 32 -; RV64I-NEXT: ret - %1 = fcmp ole half %a, %b - %2 = zext i1 %1 to i32 - ret i32 %2 -} - declare half @llvm.fma.f16(half, half, half) define half @fmadd_s(half %a, half %b, half %c) nounwind { diff --git a/llvm/test/CodeGen/RISCV/half-intrinsics.ll b/llvm/test/CodeGen/RISCV/half-intrinsics.ll --- a/llvm/test/CodeGen/RISCV/half-intrinsics.ll +++ b/llvm/test/CodeGen/RISCV/half-intrinsics.ll @@ -72,98 +72,6 @@ ret half %1 } -declare half @llvm.fma.f16(half, half, half) - -define half @fma_f16(half %a, half %b, half %c) nounwind { -; RV32IZFH-LABEL: fma_f16: -; RV32IZFH: # %bb.0: -; RV32IZFH-NEXT: fmadd.h fa0, fa0, fa1, fa2 -; RV32IZFH-NEXT: ret -; -; RV64IZFH-LABEL: fma_f16: -; RV64IZFH: # %bb.0: -; RV64IZFH-NEXT: fmadd.h fa0, fa0, fa1, fa2 -; RV64IZFH-NEXT: ret -; -; RV32IDZFH-LABEL: fma_f16: -; RV32IDZFH: # %bb.0: -; RV32IDZFH-NEXT: fmadd.h fa0, fa0, fa1, fa2 -; RV32IDZFH-NEXT: ret -; -; RV64IDZFH-LABEL: fma_f16: -; RV64IDZFH: # %bb.0: -; RV64IDZFH-NEXT: fmadd.h fa0, fa0, fa1, fa2 -; RV64IDZFH-NEXT: ret -; -; RV32I-LABEL: fma_f16: -; RV32I: # %bb.0: -; RV32I-NEXT: addi sp, sp, -32 -; RV32I-NEXT: sw ra, 28(sp) # 4-byte Folded Spill -; RV32I-NEXT: sw s0, 24(sp) # 4-byte Folded Spill -; RV32I-NEXT: sw s1, 20(sp) # 4-byte Folded Spill -; RV32I-NEXT: sw s2, 16(sp) # 4-byte Folded Spill -; RV32I-NEXT: sw s3, 12(sp) # 4-byte Folded Spill -; RV32I-NEXT: mv s2, a2 -; RV32I-NEXT: mv s1, a1 -; RV32I-NEXT: lui a1, 16 -; RV32I-NEXT: addi s0, a1, -1 -; RV32I-NEXT: and a0, a0, s0 -; RV32I-NEXT: call __gnu_h2f_ieee@plt -; RV32I-NEXT: mv s3, a0 -; RV32I-NEXT: and a0, s1, s0 -; RV32I-NEXT: call __gnu_h2f_ieee@plt -; RV32I-NEXT: mv s1, a0 -; RV32I-NEXT: and a0, s2, s0 -; RV32I-NEXT: call __gnu_h2f_ieee@plt -; RV32I-NEXT: mv a2, a0 -; RV32I-NEXT: mv a0, s3 -; RV32I-NEXT: mv a1, s1 -; RV32I-NEXT: call fmaf@plt -; RV32I-NEXT: call __gnu_f2h_ieee@plt -; RV32I-NEXT: lw s3, 12(sp) # 4-byte Folded Reload -; RV32I-NEXT: lw s2, 16(sp) # 4-byte Folded Reload -; RV32I-NEXT: lw s1, 20(sp) # 4-byte Folded Reload -; RV32I-NEXT: lw s0, 24(sp) # 4-byte Folded Reload -; RV32I-NEXT: lw ra, 28(sp) # 4-byte Folded Reload -; RV32I-NEXT: addi sp, sp, 32 -; RV32I-NEXT: ret -; -; RV64I-LABEL: fma_f16: -; RV64I: # %bb.0: -; RV64I-NEXT: addi sp, sp, -48 -; RV64I-NEXT: sd ra, 40(sp) # 8-byte Folded Spill -; RV64I-NEXT: sd s0, 32(sp) # 8-byte Folded Spill -; RV64I-NEXT: sd s1, 24(sp) # 8-byte Folded Spill -; RV64I-NEXT: sd s2, 16(sp) # 8-byte Folded Spill -; RV64I-NEXT: sd s3, 8(sp) # 8-byte Folded Spill -; RV64I-NEXT: mv s2, a2 -; RV64I-NEXT: mv s1, a1 -; RV64I-NEXT: lui a1, 16 -; RV64I-NEXT: addiw s0, a1, -1 -; RV64I-NEXT: and a0, a0, s0 -; RV64I-NEXT: call __gnu_h2f_ieee@plt -; RV64I-NEXT: mv s3, a0 -; RV64I-NEXT: and a0, s1, s0 -; RV64I-NEXT: call __gnu_h2f_ieee@plt -; RV64I-NEXT: mv s1, a0 -; RV64I-NEXT: and a0, s2, s0 -; RV64I-NEXT: call __gnu_h2f_ieee@plt -; RV64I-NEXT: mv a2, a0 -; RV64I-NEXT: mv a0, s3 -; RV64I-NEXT: mv a1, s1 -; RV64I-NEXT: call fmaf@plt -; RV64I-NEXT: call __gnu_f2h_ieee@plt -; RV64I-NEXT: ld s3, 8(sp) # 8-byte Folded Reload -; RV64I-NEXT: ld s2, 16(sp) # 8-byte Folded Reload -; RV64I-NEXT: ld s1, 24(sp) # 8-byte Folded Reload -; RV64I-NEXT: ld s0, 32(sp) # 8-byte Folded Reload -; RV64I-NEXT: ld ra, 40(sp) # 8-byte Folded Reload -; RV64I-NEXT: addi sp, sp, 48 -; RV64I-NEXT: ret - %1 = call half @llvm.fma.f16(half %a, half %b, half %c) - ret half %1 -} - declare half @llvm.fmuladd.f16(half, half, half) define half @fmuladd_f16(half %a, half %b, half %c) nounwind { @@ -266,46 +174,6 @@ ret half %1 } -declare half @llvm.fabs.f16(half) - -define half @fabs_f16(half %a) nounwind { -; RV32IZFH-LABEL: fabs_f16: -; RV32IZFH: # %bb.0: -; RV32IZFH-NEXT: fabs.h fa0, fa0 -; RV32IZFH-NEXT: ret -; -; RV64IZFH-LABEL: fabs_f16: -; RV64IZFH: # %bb.0: -; RV64IZFH-NEXT: fabs.h fa0, fa0 -; RV64IZFH-NEXT: ret -; -; RV32IDZFH-LABEL: fabs_f16: -; RV32IDZFH: # %bb.0: -; RV32IDZFH-NEXT: fabs.h fa0, fa0 -; RV32IDZFH-NEXT: ret -; -; RV64IDZFH-LABEL: fabs_f16: -; RV64IDZFH: # %bb.0: -; RV64IDZFH-NEXT: fabs.h fa0, fa0 -; RV64IDZFH-NEXT: ret -; -; RV32I-LABEL: fabs_f16: -; RV32I: # %bb.0: -; RV32I-NEXT: lui a1, 8 -; RV32I-NEXT: addi a1, a1, -1 -; RV32I-NEXT: and a0, a0, a1 -; RV32I-NEXT: ret -; -; RV64I-LABEL: fabs_f16: -; RV64I: # %bb.0: -; RV64I-NEXT: lui a1, 8 -; RV64I-NEXT: addiw a1, a1, -1 -; RV64I-NEXT: and a0, a0, a1 -; RV64I-NEXT: ret - %1 = call half @llvm.fabs.f16(half %a) - ret half %1 -} - declare half @llvm.minnum.f16(half, half) define half @minnum_f16(half %a, half %b) nounwind { @@ -462,52 +330,6 @@ ret half %1 } -declare half @llvm.copysign.f16(half, half) - -define half @copysign_f16(half %a, half %b) nounwind { -; RV32IZFH-LABEL: copysign_f16: -; RV32IZFH: # %bb.0: -; RV32IZFH-NEXT: fsgnj.h fa0, fa0, fa1 -; RV32IZFH-NEXT: ret -; -; RV64IZFH-LABEL: copysign_f16: -; RV64IZFH: # %bb.0: -; RV64IZFH-NEXT: fsgnj.h fa0, fa0, fa1 -; RV64IZFH-NEXT: ret -; -; RV32IDZFH-LABEL: copysign_f16: -; RV32IDZFH: # %bb.0: -; RV32IDZFH-NEXT: fsgnj.h fa0, fa0, fa1 -; RV32IDZFH-NEXT: ret -; -; RV64IDZFH-LABEL: copysign_f16: -; RV64IDZFH: # %bb.0: -; RV64IDZFH-NEXT: fsgnj.h fa0, fa0, fa1 -; RV64IDZFH-NEXT: ret -; -; RV32I-LABEL: copysign_f16: -; RV32I: # %bb.0: -; RV32I-NEXT: lui a2, 1048568 -; RV32I-NEXT: and a1, a1, a2 -; RV32I-NEXT: lui a2, 8 -; RV32I-NEXT: addi a2, a2, -1 -; RV32I-NEXT: and a0, a0, a2 -; RV32I-NEXT: or a0, a0, a1 -; RV32I-NEXT: ret -; -; RV64I-LABEL: copysign_f16: -; RV64I: # %bb.0: -; RV64I-NEXT: lui a2, 1048568 -; RV64I-NEXT: and a1, a1, a2 -; RV64I-NEXT: lui a2, 8 -; RV64I-NEXT: addiw a2, a2, -1 -; RV64I-NEXT: and a0, a0, a2 -; RV64I-NEXT: or a0, a0, a1 -; RV64I-NEXT: ret - %1 = call half @llvm.copysign.f16(half %a, half %b) - ret half %1 -} - declare half @llvm.floor.f16(half) define half @floor_f16(half %a) nounwind {