diff --git a/llvm/lib/Target/RISCV/RISCVExpandPseudoInsts.cpp b/llvm/lib/Target/RISCV/RISCVExpandPseudoInsts.cpp --- a/llvm/lib/Target/RISCV/RISCVExpandPseudoInsts.cpp +++ b/llvm/lib/Target/RISCV/RISCVExpandPseudoInsts.cpp @@ -50,6 +50,10 @@ MachineBasicBlock::iterator MBBI, unsigned Opcode); bool expandVSPILL(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI); bool expandVRELOAD(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI); + bool expandRV32ZdinxStore(MachineBasicBlock &MBB, + MachineBasicBlock::iterator MBBI); + bool expandRV32ZdinxLoad(MachineBasicBlock &MBB, + MachineBasicBlock::iterator MBBI); }; char RISCVExpandPseudo::ID = 0; @@ -75,6 +79,57 @@ return Modified; } +bool RISCVExpandPseudo::expandRV32ZdinxStore(MachineBasicBlock &MBB, + MachineBasicBlock::iterator MBBI) { + MachineFunction *MF = MBB.getParent(); + DebugLoc DL = MBBI->getDebugLoc(); + const TargetRegisterInfo *TRI = MF->getSubtarget().getRegisterInfo(); + Register Lo = TRI->getSubReg(MBBI->getOperand(0).getReg(), RISCV::sub_32); + Register Hi = TRI->getSubReg(MBBI->getOperand(0).getReg(), RISCV::sub_32_hi); + BuildMI(MBB, MBBI, DL, TII->get(RISCV::SW)) + .addReg(Lo, getKillRegState(MBBI->getOperand(0).isKill())) + .addReg(MBBI->getOperand(1).getReg(), getKillRegState(0)) + .add(MBBI->getOperand(2)); + if (MBBI->getOperand(2).isGlobal()) { + MBBI->getOperand(2).setOffset(4); + BuildMI(MBB, MBBI, DL, TII->get(RISCV::SW)) + .addReg(Hi, getKillRegState(MBBI->getOperand(0).isKill())) + .add(MBBI->getOperand(1)) + .add(MBBI->getOperand(2)); + } else { + BuildMI(MBB, MBBI, DL, TII->get(RISCV::SW)) + .addReg(Hi, getKillRegState(MBBI->getOperand(0).isKill())) + .add(MBBI->getOperand(1)) + .addImm(MBBI->getOperand(2).getImm() + 4); + } + MBBI->eraseFromParent(); + return true; +} + +bool RISCVExpandPseudo::expandRV32ZdinxLoad(MachineBasicBlock &MBB, + MachineBasicBlock::iterator MBBI) { + MachineFunction *MF = MBB.getParent(); + DebugLoc DL = MBBI->getDebugLoc(); + const TargetRegisterInfo *TRI = MF->getSubtarget().getRegisterInfo(); + Register Lo = TRI->getSubReg(MBBI->getOperand(0).getReg(), RISCV::sub_32); + Register Hi = TRI->getSubReg(MBBI->getOperand(0).getReg(), RISCV::sub_32_hi); + BuildMI(MBB, MBBI, DL, TII->get(RISCV::LW), Lo) + .addReg(MBBI->getOperand(1).getReg(), getKillRegState(0)) + .add(MBBI->getOperand(2)); + if (MBBI->getOperand(2).isGlobal() || MBBI->getOperand(2).isCPI()) { + MBBI->getOperand(2).setOffset(4); + BuildMI(MBB, MBBI, DL, TII->get(RISCV::LW), Hi) + .add(MBBI->getOperand(1)) + .add(MBBI->getOperand(2)); + } else { + BuildMI(MBB, MBBI, DL, TII->get(RISCV::LW), Hi) + .add(MBBI->getOperand(1)) + .addImm(MBBI->getOperand(2).getImm() + 4); + } + MBBI->eraseFromParent(); + return true; +} + bool RISCVExpandPseudo::expandMI(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, MachineBasicBlock::iterator &NextMBBI) { @@ -82,6 +137,10 @@ // expanded instructions for each pseudo is correct in the Size field of the // tablegen definition for the pseudo. switch (MBBI->getOpcode()) { + case RISCV::PseudoRV32ZdinxSD: + return expandRV32ZdinxStore(MBB, MBBI); + case RISCV::PseudoRV32ZdinxLD: + return expandRV32ZdinxLoad(MBB, MBBI); case RISCV::PseudoVSETVLI: case RISCV::PseudoVSETVLIX0: case RISCV::PseudoVSETIVLI: diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp --- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp +++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp @@ -12,6 +12,7 @@ //===----------------------------------------------------------------------===// #include "RISCVISelLowering.h" +#include "MCTargetDesc/RISCVMCTargetDesc.h" #include "MCTargetDesc/RISCVMatInt.h" #include "RISCV.h" #include "RISCVMachineFunctionInfo.h" @@ -105,6 +106,16 @@ addRegisterClass(MVT::f32, &RISCV::FPR32RegClass); if (Subtarget.hasStdExtD()) addRegisterClass(MVT::f64, &RISCV::FPR64RegClass); + if (Subtarget.hasStdExtZhinx()) + addRegisterClass(MVT::f16, &RISCV::GPRF16RegClass); + if (Subtarget.hasStdExtZfinx()) + addRegisterClass(MVT::f32, &RISCV::GPRF32RegClass); + if (Subtarget.hasStdExtZdinx()) { + if (Subtarget.is64Bit()) + addRegisterClass(MVT::f64, &RISCV::GPRF64RegClass); + else + addRegisterClass(MVT::f64, &RISCV::GPRPF64RegClass); + } static const MVT::SimpleValueType BoolVecVTs[] = { MVT::nxv1i1, MVT::nxv2i1, MVT::nxv4i1, MVT::nxv8i1, @@ -318,10 +329,10 @@ ISD::FSIN, ISD::FCOS, ISD::FSINCOS, ISD::FPOW, ISD::FREM, ISD::FP16_TO_FP, ISD::FP_TO_FP16}; - if (Subtarget.hasStdExtZfh()) + if (Subtarget.hasStdExtZfhOrZhinx()) setOperationAction(ISD::BITCAST, MVT::i16, Custom); - if (Subtarget.hasStdExtZfh()) { + if (Subtarget.hasStdExtZfhOrZhinx() || Subtarget.hasStdExtZhinxmin()) { setOperationAction(FPLegalNodeTypes, MVT::f16, Legal); setOperationAction(ISD::STRICT_FP_ROUND, MVT::f16, Legal); setOperationAction(ISD::STRICT_FP_EXTEND, MVT::f32, Legal); @@ -350,7 +361,7 @@ setOperationAction(ISD::FPOWI, MVT::i32, Custom); } - if (Subtarget.hasStdExtF()) { + if (Subtarget.hasStdExtFOrZfinx()) { setOperationAction(FPLegalNodeTypes, MVT::f32, Legal); setCondCodeAction(FPCCToExpand, MVT::f32, Expand); setOperationAction(ISD::SELECT_CC, MVT::f32, Expand); @@ -361,10 +372,10 @@ setTruncStoreAction(MVT::f32, MVT::f16, Expand); } - if (Subtarget.hasStdExtF() && Subtarget.is64Bit()) + if (Subtarget.hasStdExtFOrZfinx() && Subtarget.is64Bit()) setOperationAction(ISD::BITCAST, MVT::i32, Custom); - if (Subtarget.hasStdExtD()) { + if (Subtarget.hasStdExtDOrZdinx()) { setOperationAction(FPLegalNodeTypes, MVT::f64, Legal); setOperationAction(ISD::STRICT_FP_ROUND, MVT::f32, Legal); setOperationAction(ISD::STRICT_FP_EXTEND, MVT::f64, Legal); @@ -384,7 +395,7 @@ ISD::STRICT_FP_TO_UINT, ISD::STRICT_FP_TO_SINT}, MVT::i32, Custom); - if (Subtarget.hasStdExtF()) { + if (Subtarget.hasStdExtFOrZfinx()) { setOperationAction({ISD::FP_TO_UINT_SAT, ISD::FP_TO_SINT_SAT}, XLenVT, Custom); @@ -938,11 +949,11 @@ // Custom-legalize bitcasts from fixed-length vectors to scalar types. setOperationAction(ISD::BITCAST, {MVT::i8, MVT::i16, MVT::i32, MVT::i64}, Custom); - if (Subtarget.hasStdExtZfh()) + if (Subtarget.hasStdExtZfhOrZhinx()) setOperationAction(ISD::BITCAST, MVT::f16, Custom); - if (Subtarget.hasStdExtF()) + if (Subtarget.hasStdExtFOrZfinx()) setOperationAction(ISD::BITCAST, MVT::f32, Custom); - if (Subtarget.hasStdExtD()) + if (Subtarget.hasStdExtDOrZdinx()) setOperationAction(ISD::BITCAST, MVT::f64, Custom); } } @@ -972,7 +983,7 @@ if (Subtarget.is64Bit()) setTargetDAGCombine(ISD::SRA); - if (Subtarget.hasStdExtF()) + if (Subtarget.hasStdExtFOrZfinx()) setTargetDAGCombine({ISD::FADD, ISD::FMAXNUM, ISD::FMINNUM}); if (Subtarget.hasStdExtZbb()) @@ -980,9 +991,9 @@ if (Subtarget.hasStdExtZbkb()) setTargetDAGCombine(ISD::BITREVERSE); - if (Subtarget.hasStdExtZfh() || Subtarget.hasStdExtZbb()) + if (Subtarget.hasStdExtZfhOrZhinx() || Subtarget.hasStdExtZbb()) setTargetDAGCombine(ISD::SIGN_EXTEND_INREG); - if (Subtarget.hasStdExtF()) + if (Subtarget.hasStdExtFOrZfinx()) setTargetDAGCombine({ISD::ZERO_EXTEND, ISD::FP_TO_SINT, ISD::FP_TO_UINT, ISD::FP_TO_SINT_SAT, ISD::FP_TO_UINT_SAT}); if (Subtarget.hasVInstructions()) @@ -1392,11 +1403,11 @@ bool RISCVTargetLowering::isFPImmLegal(const APFloat &Imm, EVT VT, bool ForCodeSize) const { // FIXME: Change to Zfhmin once f16 becomes a legal type with Zfhmin. - if (VT == MVT::f16 && !Subtarget.hasStdExtZfh()) + if (VT == MVT::f16 && !Subtarget.hasStdExtZfhOrZhinx()) return false; - if (VT == MVT::f32 && !Subtarget.hasStdExtF()) + if (VT == MVT::f32 && !Subtarget.hasStdExtFOrZfinx()) return false; - if (VT == MVT::f64 && !Subtarget.hasStdExtD()) + if (VT == MVT::f64 && !Subtarget.hasStdExtDOrZdinx()) return false; return Imm.isZero(); } @@ -1435,18 +1446,19 @@ } bool RISCVTargetLowering::hasBitPreservingFPLogic(EVT VT) const { - return (VT == MVT::f16 && Subtarget.hasStdExtZfh()) || - (VT == MVT::f32 && Subtarget.hasStdExtF()) || - (VT == MVT::f64 && Subtarget.hasStdExtD()); + return (VT == MVT::f16 && Subtarget.hasStdExtZfhOrZhinx()) || + (VT == MVT::f32 && Subtarget.hasStdExtFOrZfinx()) || + (VT == MVT::f64 && Subtarget.hasStdExtDOrZdinx()); } MVT RISCVTargetLowering::getRegisterTypeForCallingConv(LLVMContext &Context, - CallingConv::ID CC, - EVT VT) const { + CallingConv::ID CC, + EVT VT) const { // Use f32 to pass f16 if it is legal and Zfh is not enabled. // We might still end up using a GPR but that will be decided based on ABI. // FIXME: Change to Zfhmin once f16 becomes a legal type with Zfhmin. - if (VT == MVT::f16 && Subtarget.hasStdExtF() && !Subtarget.hasStdExtZfh()) + if (VT == MVT::f16 && Subtarget.hasStdExtFOrZfinx() && + !Subtarget.hasStdExtZfhOrZhinx()) return MVT::f32; return TargetLowering::getRegisterTypeForCallingConv(Context, CC, VT); @@ -1458,7 +1470,8 @@ // Use f32 to pass f16 if it is legal and Zfh is not enabled. // We might still end up using a GPR but that will be decided based on ABI. // FIXME: Change to Zfhmin once f16 becomes a legal type with Zfhmin. - if (VT == MVT::f16 && Subtarget.hasStdExtF() && !Subtarget.hasStdExtZfh()) + if (VT == MVT::f16 && Subtarget.hasStdExtFOrZfinx() && + !Subtarget.hasStdExtZfhOrZhinx()) return 1; return TargetLowering::getNumRegistersForCallingConv(Context, CC, VT); @@ -3412,13 +3425,14 @@ SDValue Op0 = Op.getOperand(0); EVT Op0VT = Op0.getValueType(); MVT XLenVT = Subtarget.getXLenVT(); - if (VT == MVT::f16 && Op0VT == MVT::i16 && Subtarget.hasStdExtZfh()) { + if (VT == MVT::f16 && Op0VT == MVT::i16 && + Subtarget.hasStdExtZfhOrZhinx()) { SDValue NewOp0 = DAG.getNode(ISD::ANY_EXTEND, DL, XLenVT, Op0); SDValue FPConv = DAG.getNode(RISCVISD::FMV_H_X, DL, MVT::f16, NewOp0); return FPConv; } if (VT == MVT::f32 && Op0VT == MVT::i32 && Subtarget.is64Bit() && - Subtarget.hasStdExtF()) { + Subtarget.hasStdExtFOrZfinx()) { SDValue NewOp0 = DAG.getNode(ISD::ANY_EXTEND, DL, MVT::i64, Op0); SDValue FPConv = DAG.getNode(RISCVISD::FMV_W_X_RV64, DL, MVT::f32, NewOp0); @@ -7493,7 +7507,8 @@ SDValue Op0 = N->getOperand(0); EVT Op0VT = Op0.getValueType(); MVT XLenVT = Subtarget.getXLenVT(); - if (VT == MVT::i16 && Op0VT == MVT::f16 && Subtarget.hasStdExtZfh()) { + if (VT == MVT::i16 && Op0VT == MVT::f16 && + Subtarget.hasStdExtZfhOrZhinx()) { SDValue FPConv = DAG.getNode(RISCVISD::FMV_X_ANYEXTH, DL, XLenVT, Op0); Results.push_back(DAG.getNode(ISD::TRUNCATE, DL, MVT::i16, FPConv)); } else if (VT == MVT::i32 && Op0VT == MVT::f32 && Subtarget.is64Bit() && @@ -8854,7 +8869,7 @@ return SDValue(); // Don't do this for f16 with Zfhmin and not Zfh. - if (Src.getValueType() == MVT::f16 && !Subtarget.hasStdExtZfh()) + if (Src.getValueType() == MVT::f16 && !Subtarget.hasStdExtZfhOrZhinx()) return SDValue(); RISCVFPRndMode::RoundingMode FRM = matchRoundingOp(Src.getOpcode()); @@ -8901,7 +8916,7 @@ return SDValue(); // Don't do this for f16 with Zfhmin and not Zfh. - if (Src.getValueType() == MVT::f16 && !Subtarget.hasStdExtZfh()) + if (Src.getValueType() == MVT::f16 && !Subtarget.hasStdExtZfhOrZhinx()) return SDValue(); EVT SatVT = cast(N->getOperand(1))->getVT(); @@ -10229,7 +10244,9 @@ static MachineBasicBlock *emitSplitF64Pseudo(MachineInstr &MI, MachineBasicBlock *BB) { - assert(MI.getOpcode() == RISCV::SplitF64Pseudo && "Unexpected instruction"); + assert((MI.getOpcode() == RISCV::SplitF64Pseudo || + MI.getOpcode() == RISCV::SplitF64Pseudo_INX) && + "Unexpected instruction"); MachineFunction &MF = *BB->getParent(); DebugLoc DL = MI.getDebugLoc(); @@ -10262,7 +10279,8 @@ static MachineBasicBlock *emitBuildPairF64Pseudo(MachineInstr &MI, MachineBasicBlock *BB) { - assert(MI.getOpcode() == RISCV::BuildPairF64Pseudo && + assert((MI.getOpcode() == RISCV::BuildPairF64Pseudo || + MI.getOpcode() == RISCV::BuildPairF64Pseudo_INX) && "Unexpected instruction"); MachineFunction &MF = *BB->getParent(); @@ -10303,6 +10321,10 @@ case RISCV::Select_FPR16_Using_CC_GPR: case RISCV::Select_FPR32_Using_CC_GPR: case RISCV::Select_FPR64_Using_CC_GPR: + case RISCV::Select_FPR16INX_Using_CC_GPR: + case RISCV::Select_FPR32INX_Using_CC_GPR: + case RISCV::Select_FPR64INX_Using_CC_GPR: + case RISCV::Select_FPR64IN32X_Using_CC_GPR: return true; } } @@ -10628,10 +10650,16 @@ case RISCV::Select_FPR16_Using_CC_GPR: case RISCV::Select_FPR32_Using_CC_GPR: case RISCV::Select_FPR64_Using_CC_GPR: + case RISCV::Select_FPR16INX_Using_CC_GPR: + case RISCV::Select_FPR32INX_Using_CC_GPR: + case RISCV::Select_FPR64INX_Using_CC_GPR: + case RISCV::Select_FPR64IN32X_Using_CC_GPR: return emitSelectPseudo(MI, BB, Subtarget); case RISCV::BuildPairF64Pseudo: + case RISCV::BuildPairF64Pseudo_INX: return emitBuildPairF64Pseudo(MI, BB); case RISCV::SplitF64Pseudo: + case RISCV::SplitF64Pseudo_INX: return emitSplitF64Pseudo(MI, BB); case RISCV::PseudoQuietFLE_H: return emitQuietFCMP(MI, BB, RISCV::FLE_H, RISCV::FEQ_H, Subtarget); @@ -10645,6 +10673,24 @@ return emitQuietFCMP(MI, BB, RISCV::FLE_D, RISCV::FEQ_D, Subtarget); case RISCV::PseudoQuietFLT_D: return emitQuietFCMP(MI, BB, RISCV::FLT_D, RISCV::FEQ_D, Subtarget); + case RISCV::PseudoQuietFLE_H_INX: + return emitQuietFCMP(MI, BB, RISCV::FLE_H_INX, RISCV::FEQ_H_INX, Subtarget); + case RISCV::PseudoQuietFLT_H_INX: + return emitQuietFCMP(MI, BB, RISCV::FLT_H_INX, RISCV::FEQ_H_INX, Subtarget); + case RISCV::PseudoQuietFLE_S_INX: + return emitQuietFCMP(MI, BB, RISCV::FLE_S_INX, RISCV::FEQ_S_INX, Subtarget); + case RISCV::PseudoQuietFLT_S_INX: + return emitQuietFCMP(MI, BB, RISCV::FLT_S_INX, RISCV::FEQ_S_INX, Subtarget); + case RISCV::PseudoQuietFLE_D_INX: + return emitQuietFCMP(MI, BB, RISCV::FLE_D_INX, RISCV::FEQ_D_INX, Subtarget); + case RISCV::PseudoQuietFLT_D_INX: + return emitQuietFCMP(MI, BB, RISCV::FLT_D_INX, RISCV::FEQ_D_INX, Subtarget); + case RISCV::PseudoQuietFLE_D_IN32X: + return emitQuietFCMP(MI, BB, RISCV::FLE_D_IN32X, RISCV::FEQ_D_IN32X, + Subtarget); + case RISCV::PseudoQuietFLT_D_IN32X: + return emitQuietFCMP(MI, BB, RISCV::FLT_D_IN32X, RISCV::FEQ_D_IN32X, + Subtarget); case RISCV::PseudoVFCVT_RM_X_F_V_M1_MASK: return emitVFCVT_RM_MASK(MI, BB, RISCV::PseudoVFCVT_X_F_V_M1_MASK); case RISCV::PseudoVFCVT_RM_X_F_V_M2_MASK: @@ -12461,7 +12507,8 @@ // Subtarget into account. if (Res.second == &RISCV::GPRF16RegClass || Res.second == &RISCV::GPRF32RegClass || - Res.second == &RISCV::GPRF64RegClass) + Res.second == &RISCV::GPRF64RegClass || + Res.second == &RISCV::GPRPF64RegClass) return std::make_pair(Res.first, &RISCV::GPRRegClass); return Res; @@ -12706,11 +12753,11 @@ switch (FPVT.getSimpleVT().SimpleTy) { case MVT::f16: - return Subtarget.hasStdExtZfh(); + return Subtarget.hasStdExtZfhOrZhinx(); case MVT::f32: - return Subtarget.hasStdExtF(); + return Subtarget.hasStdExtFOrZfinx(); case MVT::f64: - return Subtarget.hasStdExtD(); + return Subtarget.hasStdExtDOrZdinx(); default: return false; } @@ -12755,11 +12802,11 @@ switch (VT.getSimpleVT().SimpleTy) { case MVT::f16: - return Subtarget.hasStdExtZfh(); + return Subtarget.hasStdExtZfhOrZhinx(); case MVT::f32: - return Subtarget.hasStdExtF(); + return Subtarget.hasStdExtFOrZfinx(); case MVT::f64: - return Subtarget.hasStdExtD(); + return Subtarget.hasStdExtDOrZdinx(); default: break; } diff --git a/llvm/lib/Target/RISCV/RISCVInstrFormats.td b/llvm/lib/Target/RISCV/RISCVInstrFormats.td --- a/llvm/lib/Target/RISCV/RISCVInstrFormats.td +++ b/llvm/lib/Target/RISCV/RISCVInstrFormats.td @@ -209,7 +209,7 @@ let isCodeGenOnly = 1; } -class PseudoQuietFCMP +class PseudoQuietFCMP : Pseudo<(outs GPR:$rd), (ins Ty:$rs1, Ty:$rs2), []> { let hasSideEffects = 1; let mayLoad = 0; diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfo.h b/llvm/lib/Target/RISCV/RISCVInstrInfo.h --- a/llvm/lib/Target/RISCV/RISCVInstrInfo.h +++ b/llvm/lib/Target/RISCV/RISCVInstrInfo.h @@ -182,6 +182,8 @@ MachineBasicBlock::iterator II, const DebugLoc &DL, Register DestReg, int64_t Amount, MachineInstr::MIFlag Flag = MachineInstr::NoFlags) const; + MCRegister convertGPRPF64ToGPR(MCRegister &Reg) const; + protected: const RISCVSubtarget &STI; }; diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp b/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp --- a/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp +++ b/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp @@ -26,6 +26,7 @@ #include "llvm/CodeGen/MachineRegisterInfo.h" #include "llvm/CodeGen/RegisterScavenging.h" #include "llvm/MC/MCInstBuilder.h" +#include "llvm/MC/MCRegister.h" #include "llvm/MC/TargetRegistry.h" #include "llvm/Support/ErrorHandling.h" @@ -256,6 +257,14 @@ MachineBasicBlock::iterator MBBI, const DebugLoc &DL, MCRegister DstReg, MCRegister SrcReg, bool KillSrc) const { + + const TargetRegisterInfo *TRI = STI.getRegisterInfo(); + + if (RISCV::GPRPF64RegClass.contains(DstReg)) + DstReg = TRI->getSubReg(DstReg, RISCV::sub_32); + if (RISCV::GPRPF64RegClass.contains(SrcReg)) + SrcReg = TRI->getSubReg(SrcReg, RISCV::sub_32); + if (RISCV::GPRRegClass.contains(DstReg, SrcReg)) { BuildMI(MBB, MBBI, DL, get(RISCV::ADDI), DstReg) .addReg(SrcReg, getKillRegState(KillSrc)) @@ -409,8 +418,6 @@ MIB.addReg(RISCV::VTYPE, RegState::Implicit); } } else { - const TargetRegisterInfo *TRI = STI.getRegisterInfo(); - int I = 0, End = NF, Incr = 1; unsigned SrcEncoding = TRI->getEncodingValue(SrcReg); unsigned DstEncoding = TRI->getEncodingValue(DstReg); @@ -459,6 +466,7 @@ MachineFunction *MF = MBB.getParent(); MachineFrameInfo &MFI = MF->getFrameInfo(); + bool IsINX = MF->getSubtarget().getFeatureBits()[RISCV::FeatureStdExtZdinx]; unsigned Opcode; bool IsScalableVector = true; @@ -467,6 +475,9 @@ Opcode = TRI->getRegSizeInBits(RISCV::GPRRegClass) == 32 ? RISCV::SW : RISCV::SD; IsScalableVector = false; + } else if (RISCV::GPRPF64RegClass.hasSubClassEq(RC)) { + Opcode = RISCV::PseudoRV32ZdinxSD; + IsScalableVector = false; } else if (RISCV::FPR16RegClass.hasSubClassEq(RC)) { Opcode = RISCV::FSH; IsScalableVector = false; @@ -474,7 +485,7 @@ Opcode = RISCV::FSW; IsScalableVector = false; } else if (RISCV::FPR64RegClass.hasSubClassEq(RC)) { - Opcode = RISCV::FSD; + Opcode = IsINX ? RISCV::PseudoRV32ZdinxSD : RISCV::FSD; IsScalableVector = false; } else if (RISCV::VRRegClass.hasSubClassEq(RC)) { Opcode = RISCV::PseudoVSPILL_M1; @@ -553,6 +564,7 @@ MachineFunction *MF = MBB.getParent(); MachineFrameInfo &MFI = MF->getFrameInfo(); + bool IsINX = MF->getSubtarget().getFeatureBits()[RISCV::FeatureStdExtZdinx]; unsigned Opcode; bool IsScalableVector = true; @@ -561,6 +573,9 @@ Opcode = TRI->getRegSizeInBits(RISCV::GPRRegClass) == 32 ? RISCV::LW : RISCV::LD; IsScalableVector = false; + } else if (RISCV::GPRPF64RegClass.hasSubClassEq(RC)) { + Opcode = RISCV::PseudoRV32ZdinxLD; + IsScalableVector = false; } else if (RISCV::FPR16RegClass.hasSubClassEq(RC)) { Opcode = RISCV::FLH; IsScalableVector = false; @@ -568,7 +583,7 @@ Opcode = RISCV::FLW; IsScalableVector = false; } else if (RISCV::FPR64RegClass.hasSubClassEq(RC)) { - Opcode = RISCV::FLD; + Opcode = IsINX ? RISCV::PseudoRV32ZdinxLD : RISCV::FLD; IsScalableVector = false; } else if (RISCV::VRRegClass.hasSubClassEq(RC)) { Opcode = RISCV::PseudoVRELOAD_M1; @@ -1087,6 +1102,10 @@ case RISCV::FSGNJ_D: case RISCV::FSGNJ_S: case RISCV::FSGNJ_H: + case RISCV::FSGNJ_D_INX: + case RISCV::FSGNJ_D_IN32X: + case RISCV::FSGNJ_S_INX: + case RISCV::FSGNJ_H_INX: // The canonical floating-point move is fsgnj rd, rs, rs. return MI.getOperand(1).isReg() && MI.getOperand(2).isReg() && MI.getOperand(1).getReg() == MI.getOperand(2).getReg(); @@ -1116,6 +1135,10 @@ case RISCV::FSGNJ_D: case RISCV::FSGNJ_S: case RISCV::FSGNJ_H: + case RISCV::FSGNJ_D_INX: + case RISCV::FSGNJ_D_IN32X: + case RISCV::FSGNJ_S_INX: + case RISCV::FSGNJ_H_INX: // The canonical floating-point move is fsgnj rd, rs, rs. if (MI.getOperand(1).isReg() && MI.getOperand(2).isReg() && MI.getOperand(1).getReg() == MI.getOperand(2).getReg()) diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfo.td b/llvm/lib/Target/RISCV/RISCVInstrInfo.td --- a/llvm/lib/Target/RISCV/RISCVInstrInfo.td +++ b/llvm/lib/Target/RISCV/RISCVInstrInfo.td @@ -1313,7 +1313,7 @@ node:$falsev), [{}], IntCCtoRISCVCC>; -multiclass SelectCC_GPR_rrirr { +multiclass SelectCC_GPR_rrirr { let usesCustomInserter = 1 in def _Using_CC_GPR : Pseudo<(outs valty:$dst), (ins GPR:$lhs, GPR:$rhs, ixlenimm:$cc, diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoD.td b/llvm/lib/Target/RISCV/RISCVInstrInfoD.td --- a/llvm/lib/Target/RISCV/RISCVInstrInfoD.td +++ b/llvm/lib/Target/RISCV/RISCVInstrInfoD.td @@ -233,6 +233,11 @@ (FLT_D_INX GPR:$rd, FPR64INX:$rt, FPR64INX:$rs), 0>; def : InstAlias<"fge.d $rd, $rs, $rt", (FLE_D_INX GPR:$rd, FPR64INX:$rt, FPR64INX:$rs), 0>; + +let usesCustomInserter = 1 in { +def PseudoQuietFLE_D_INX : PseudoQuietFCMP; +def PseudoQuietFLT_D_INX : PseudoQuietFCMP; +} } // Predicates = [HasStdExtZdinx, IsRV64] let Predicates = [HasStdExtZdinx, IsRV32] in { @@ -243,6 +248,11 @@ (FLT_D_IN32X GPR:$rd, FPR64IN32X:$rt, FPR64IN32X:$rs), 0>; def : InstAlias<"fge.d $rd, $rs, $rt", (FLE_D_IN32X GPR:$rd, FPR64IN32X:$rt, FPR64IN32X:$rs), 0>; + +let usesCustomInserter = 1 in { +def PseudoQuietFLE_D_IN32X : PseudoQuietFCMP; +def PseudoQuietFLT_D_IN32X : PseudoQuietFCMP; +} } // Predicates = [HasStdExtZdinx, IsRV32] //===----------------------------------------------------------------------===// @@ -256,17 +266,35 @@ // f64 -> f32, f32 -> f64 def : Pat<(any_fpround FPR64:$rs1), (FCVT_S_D FPR64:$rs1, 0b111)>; def : Pat<(any_fpextend FPR32:$rs1), (FCVT_D_S FPR32:$rs1)>; +} // Predicates = [HasStdExtD] + +let Predicates = [HasStdExtZdinx, IsRV64] in { +/// Float conversion operations + +// f64 -> f32, f32 -> f64 +def : Pat<(any_fpround FPR64INX:$rs1), (FCVT_S_D_INX FPR64INX:$rs1, 0b111)>; +def : Pat<(any_fpextend FPR32INX:$rs1), (FCVT_D_S_INX FPR32INX:$rs1)>; +} // Predicates = [HasStdExtZdinx, IsRV64] + +let Predicates = [HasStdExtZdinx, IsRV32] in { +/// Float conversion operations + +// f64 -> f32, f32 -> f64 +def : Pat<(any_fpround FPR64IN32X:$rs1), (FCVT_S_D_IN32X FPR64IN32X:$rs1, 0b111)>; +def : Pat<(any_fpextend FPR32INX:$rs1), (FCVT_D_S_IN32X FPR32INX:$rs1)>; +} // Predicates = [HasStdExtZdinx, IsRV32] // [u]int<->double conversion patterns must be gated on IsRV32 or IsRV64, so // are defined later. /// Float arithmetic operations -def : PatFprFprDynFrm; -def : PatFprFprDynFrm; -def : PatFprFprDynFrm; -def : PatFprFprDynFrm; +defm : PatFprFprDynFrm_m; +defm : PatFprFprDynFrm_m; +defm : PatFprFprDynFrm_m; +defm : PatFprFprDynFrm_m; +let Predicates = [HasStdExtD] in { def : Pat<(any_fsqrt FPR64:$rs1), (FSQRT_D FPR64:$rs1, 0b111)>; def : Pat<(fneg FPR64:$rs1), (FSGNJN_D $rs1, $rs1)>; @@ -274,8 +302,8 @@ def : PatFprFpr; def : Pat<(fcopysign FPR64:$rs1, (fneg FPR64:$rs2)), (FSGNJN_D $rs1, $rs2)>; -def : Pat<(fcopysign FPR64:$rs1, FPR32:$rs2), (FSGNJ_D $rs1, (FCVT_D_S $rs2))>; -def : Pat<(fcopysign FPR32:$rs1, FPR64:$rs2), (FSGNJ_S $rs1, (FCVT_S_D $rs2, +def : Pat<(fcopysign FPR64:$rs1, FPR32INX:$rs2), (FSGNJ_D $rs1, (FCVT_D_S $rs2))>; +def : Pat<(fcopysign FPR32INX:$rs1, FPR64:$rs2), (FSGNJ_S $rs1, (FCVT_S_D $rs2, 0b111))>; // fmadd: rs1 * rs2 + rs3 @@ -297,25 +325,93 @@ // fnmadd: -(rs1 * rs2 + rs3) (the nsz flag on the FMA) def : Pat<(fneg (any_fma_nsz FPR64:$rs1, FPR64:$rs2, FPR64:$rs3)), (FNMADD_D FPR64:$rs1, FPR64:$rs2, FPR64:$rs3, 0b111)>; +} // Predicates = [HasStdExtD] + +let Predicates = [HasStdExtZdinx, IsRV64] in { +def : Pat<(any_fsqrt FPR64INX:$rs1), (FSQRT_D_INX FPR64INX:$rs1, 0b111)>; + +def : Pat<(fneg FPR64INX:$rs1), (FSGNJN_D_INX $rs1, $rs1)>; +def : Pat<(fabs FPR64INX:$rs1), (FSGNJX_D_INX $rs1, $rs1)>; + +def : PatFprFpr; +def : Pat<(fcopysign FPR64INX:$rs1, (fneg FPR64INX:$rs2)), (FSGNJN_D_INX $rs1, $rs2)>; +def : Pat<(fcopysign FPR64INX:$rs1, FPR32:$rs2), (FSGNJ_D_INX $rs1, (FCVT_D_S_INX $rs2))>; +def : Pat<(fcopysign FPR32:$rs1, FPR64INX:$rs2), (FSGNJ_S_INX $rs1, (FCVT_S_D_INX $rs2, + 0b111))>; + +// fmadd: rs1 * rs2 + rs3 +def : Pat<(any_fma FPR64INX:$rs1, FPR64INX:$rs2, FPR64INX:$rs3), + (FMADD_D_INX $rs1, $rs2, $rs3, 0b111)>; + +// fmsub: rs1 * rs2 - rs3 +def : Pat<(any_fma FPR64INX:$rs1, FPR64INX:$rs2, (fneg FPR64INX:$rs3)), + (FMSUB_D_INX FPR64INX:$rs1, FPR64INX:$rs2, FPR64INX:$rs3, 0b111)>; + +// fnmsub: -rs1 * rs2 + rs3 +def : Pat<(any_fma (fneg FPR64INX:$rs1), FPR64INX:$rs2, FPR64INX:$rs3), + (FNMSUB_D_INX FPR64INX:$rs1, FPR64INX:$rs2, FPR64INX:$rs3, 0b111)>; + +// fnmadd: -rs1 * rs2 - rs3 +def : Pat<(any_fma (fneg FPR64INX:$rs1), FPR64INX:$rs2, (fneg FPR64INX:$rs3)), + (FNMADD_D_INX FPR64INX:$rs1, FPR64INX:$rs2, FPR64INX:$rs3, 0b111)>; + +// fnmadd: -(rs1 * rs2 + rs3) (the nsz flag on the FMA) +def : Pat<(fneg (any_fma_nsz FPR64INX:$rs1, FPR64INX:$rs2, FPR64INX:$rs3)), + (FNMADD_D_INX FPR64INX:$rs1, FPR64INX:$rs2, FPR64INX:$rs3, 0b111)>; +} // Predicates = [HasStdExtZdinx, IsRV64] + +let Predicates = [HasStdExtZdinx, IsRV32] in { +def : Pat<(any_fsqrt FPR64IN32X:$rs1), (FSQRT_D_IN32X FPR64IN32X:$rs1, 0b111)>; + +def : Pat<(fneg FPR64IN32X:$rs1), (FSGNJN_D_IN32X $rs1, $rs1)>; +def : Pat<(fabs FPR64IN32X:$rs1), (FSGNJX_D_IN32X $rs1, $rs1)>; + +def : PatFprFpr; +def : Pat<(fcopysign FPR64IN32X:$rs1, (fneg FPR64IN32X:$rs2)), (FSGNJN_D_IN32X $rs1, $rs2)>; +def : Pat<(fcopysign FPR64IN32X:$rs1, FPR32INX:$rs2), (FSGNJ_D_IN32X $rs1, (FCVT_D_S_INX $rs2))>; +def : Pat<(fcopysign FPR32INX:$rs1, FPR64IN32X:$rs2), (FSGNJ_S_INX $rs1, (FCVT_S_D_IN32X $rs2, + 0b111))>; + +// fmadd: rs1 * rs2 + rs3 +def : Pat<(any_fma FPR64IN32X:$rs1, FPR64IN32X:$rs2, FPR64IN32X:$rs3), + (FMADD_D_IN32X $rs1, $rs2, $rs3, 0b111)>; + +// fmsub: rs1 * rs2 - rs3 +def : Pat<(any_fma FPR64IN32X:$rs1, FPR64IN32X:$rs2, (fneg FPR64IN32X:$rs3)), + (FMSUB_D_IN32X FPR64IN32X:$rs1, FPR64IN32X:$rs2, FPR64IN32X:$rs3, 0b111)>; + +// fnmsub: -rs1 * rs2 + rs3 +def : Pat<(any_fma (fneg FPR64IN32X:$rs1), FPR64IN32X:$rs2, FPR64IN32X:$rs3), + (FNMSUB_D_IN32X FPR64IN32X:$rs1, FPR64IN32X:$rs2, FPR64IN32X:$rs3, 0b111)>; + +// fnmadd: -rs1 * rs2 - rs3 +def : Pat<(any_fma (fneg FPR64IN32X:$rs1), FPR64IN32X:$rs2, (fneg FPR64IN32X:$rs3)), + (FNMADD_D_IN32X FPR64IN32X:$rs1, FPR64IN32X:$rs2, FPR64IN32X:$rs3, 0b111)>; + +// fnmadd: -(rs1 * rs2 + rs3) (the nsz flag on the FMA) +def : Pat<(fneg (any_fma_nsz FPR64IN32X:$rs1, FPR64IN32X:$rs2, FPR64IN32X:$rs3)), + (FNMADD_D_IN32X FPR64IN32X:$rs1, FPR64IN32X:$rs2, FPR64IN32X:$rs3, 0b111)>; +} // Predicates = [HasStdExtZdinx, IsRV32] // The ratified 20191213 ISA spec defines fmin and fmax in a way that matches // LLVM's fminnum and fmaxnum. // . -def : PatFprFpr; -def : PatFprFpr; +defm : PatFprFpr_m; +defm : PatFprFpr_m; /// Setcc // FIXME: SETEQ/SETLT/SETLE imply nonans, can we pick better instructions for // strict versions of those. // Match non-signaling FEQ_D -def : PatSetCC; -def : PatSetCC; -def : PatSetCC; -def : PatSetCC; -def : PatSetCC; -def : PatSetCC; +defm : PatSetCC_m; +defm : PatSetCC_m; +defm : PatSetCC_m; +defm : PatSetCC_m; +defm : PatSetCC_m; +defm : PatSetCC_m; +let Predicates = [HasStdExtD] in { // Match signaling FEQ_D def : Pat<(strict_fsetccs FPR64:$rs1, FPR64:$rs2, SETEQ), (AND (FLE_D $rs1, $rs2), @@ -333,7 +429,49 @@ def : PatSetCC; def : PatSetCC; def : PatSetCC; +} // Predicates = [HasStdExtD] + +let Predicates = [HasStdExtZdinx, IsRV64] in { +// Match signaling FEQ_D +def : Pat<(strict_fsetccs FPR64INX:$rs1, FPR64INX:$rs2, SETEQ), + (AND (FLE_D_INX $rs1, $rs2), + (FLE_D_INX $rs2, $rs1))>; +def : Pat<(strict_fsetccs FPR64INX:$rs1, FPR64INX:$rs2, SETOEQ), + (AND (FLE_D_INX $rs1, $rs2), + (FLE_D_INX $rs2, $rs1))>; +// If both operands are the same, use a single FLE. +def : Pat<(strict_fsetccs FPR64INX:$rs1, FPR64INX:$rs1, SETEQ), + (FLE_D_INX $rs1, $rs1)>; +def : Pat<(strict_fsetccs FPR64INX:$rs1, FPR64INX:$rs1, SETOEQ), + (FLE_D_INX $rs1, $rs1)>; + +def : PatSetCC; +def : PatSetCC; +def : PatSetCC; +def : PatSetCC; +} // Predicates = [HasStdExtZdinx, IsRV64] + +let Predicates = [HasStdExtZdinx, IsRV32] in { +// Match signaling FEQ_D +def : Pat<(strict_fsetccs FPR64IN32X:$rs1, FPR64IN32X:$rs2, SETEQ), + (AND (FLE_D_IN32X $rs1, $rs2), + (FLE_D_IN32X $rs2, $rs1))>; +def : Pat<(strict_fsetccs FPR64IN32X:$rs1, FPR64IN32X:$rs2, SETOEQ), + (AND (FLE_D_IN32X $rs1, $rs2), + (FLE_D_IN32X $rs2, $rs1))>; +// If both operands are the same, use a single FLE. +def : Pat<(strict_fsetccs FPR64IN32X:$rs1, FPR64IN32X:$rs1, SETEQ), + (FLE_D_IN32X $rs1, $rs1)>; +def : Pat<(strict_fsetccs FPR64IN32X:$rs1, FPR64IN32X:$rs1, SETOEQ), + (FLE_D_IN32X $rs1, $rs1)>; + +def : PatSetCC; +def : PatSetCC; +def : PatSetCC; +def : PatSetCC; +} // Predicates = [HasStdExtZdinx, IsRV32] +let Predicates = [HasStdExtD] in { defm Select_FPR64 : SelectCC_GPR_rrirr; /// Loads @@ -360,6 +498,45 @@ } // Predicates = [HasStdExtD] +let Predicates = [HasStdExtZdinx, IsRV64] in { +defm Select_FPR64INX : SelectCC_GPR_rrirr; + +/// Loads +def : Pat<(f64 (load GPR:$rs1)), (COPY (LD GPR:$rs1, 0))>; + +/// Stores +def : Pat<(store (f64 FPR64INX:$rs2), GPR:$rs1), + (SD (COPY FPR64INX:$rs2), GPR:$rs1, 0)>; +} // Predicates = [HasStdExtZdinx, IsRV64] + +let Predicates = [HasStdExtZdinx, IsRV32] in { +defm Select_FPR64IN32X : SelectCC_GPR_rrirr; + +/// Loads +let isCall = 0, mayLoad = 1, mayStore = 0, Size = 8, isCodeGenOnly = 1 in +def PseudoRV32ZdinxLD : Pseudo<(outs GPRPF64:$dst), (ins GPR:$rs1, simm12:$imm12), []>; +defm : LdPat; + +/// Stores +let isCall = 0, mayLoad = 0, mayStore = 1, Size = 8, isCodeGenOnly = 1 in +def PseudoRV32ZdinxSD : Pseudo<(outs), (ins GPRPF64:$rs2, GPR:$rs1, simm12:$imm12), []>; +defm : StPat; + +/// Pseudo-instructions needed for the soft-float ABI with RV32D + +// Moves two GPRs to an FPR. +let usesCustomInserter = 1 in +def BuildPairF64Pseudo_INX + : Pseudo<(outs FPR64IN32X:$dst), (ins GPR:$src1, GPR:$src2), + [(set FPR64IN32X:$dst, (RISCVBuildPairF64 GPR:$src1, GPR:$src2))]>; + +// Moves an FPR to two GPRs. +let usesCustomInserter = 1 in +def SplitF64Pseudo_INX + : Pseudo<(outs GPR:$dst1, GPR:$dst2), (ins FPR64IN32X:$src), + [(set GPR:$dst1, GPR:$dst2, (RISCVSplitF64 FPR64IN32X:$src))]>; +} // Predicates = [HasStdExtZdinx, IsRV32] + let Predicates = [HasStdExtD, IsRV32] in { /// Float constants @@ -386,6 +563,38 @@ def : Pat<(any_uint_to_fp (i32 GPR:$rs1)), (FCVT_D_WU GPR:$rs1)>; } // Predicates = [HasStdExtD, IsRV32] +let Predicates = [HasStdExtZdinx, IsRV32] in { + +/// Float constants +def : Pat<(f64 (fpimm0)), (FCVT_D_W_IN32X (i32 X0))>; +def : Pat<(f64 (fpimmneg0)), (FSGNJN_D_IN32X (FCVT_D_W_IN32X (i32 X0)), + (FCVT_D_W_IN32X (i32 X0)))>; + +// double->[u]int. Round-to-zero must be used. +def : Pat<(i32 (any_fp_to_sint FPR64IN32X:$rs1)), (FCVT_W_D_IN32X FPR64IN32X:$rs1, 0b001)>; +def : Pat<(i32 (any_fp_to_uint FPR64IN32X:$rs1)), (FCVT_WU_D_IN32X FPR64IN32X:$rs1, 0b001)>; + +// Saturating double->[u]int32. +def : Pat<(i32 (riscv_fcvt_x FPR64IN32X:$rs1, timm:$frm)), (FCVT_W_D_IN32X $rs1, timm:$frm)>; +def : Pat<(i32 (riscv_fcvt_xu FPR64IN32X:$rs1, timm:$frm)), (FCVT_WU_D_IN32X $rs1, timm:$frm)>; + +// float->int32 with current rounding mode. +def : Pat<(i32 (any_lrint FPR64IN32X:$rs1)), (FCVT_W_D_IN32X $rs1, 0b111)>; + +// float->int32 rounded to nearest with ties rounded away from zero. +def : Pat<(i32 (any_lround FPR64IN32X:$rs1)), (FCVT_W_D_IN32X $rs1, 0b100)>; + +// [u]int->double. +def : Pat<(any_sint_to_fp (i32 GPR:$rs1)), (FCVT_D_W_IN32X GPR:$rs1)>; +def : Pat<(any_uint_to_fp (i32 GPR:$rs1)), (FCVT_D_WU_IN32X GPR:$rs1)>; +} // Predicates = [HasStdExtZdinx, IsRV32] + +let Predicates = [HasStdExtZdinx, IsRV64] in { +// Moves (no conversion) +def : Pat<(f64 (bitconvert (i64 GPR:$rs1))), (COPY GPR:$rs1)>; +def : Pat<(i64 (bitconvert GPRF64:$rs1)), (COPY GPRF64:$rs1)>; +} // Predicates = [HasStdExtZdinx, IsRV64] + let Predicates = [HasStdExtD, IsRV64] in { /// Float constants @@ -427,3 +636,45 @@ def : Pat<(any_sint_to_fp (i64 GPR:$rs1)), (FCVT_D_L GPR:$rs1, 0b111)>; def : Pat<(any_uint_to_fp (i64 GPR:$rs1)), (FCVT_D_LU GPR:$rs1, 0b111)>; } // Predicates = [HasStdExtD, IsRV64] + +let Predicates = [HasStdExtZdinx, IsRV64] in { + +/// Float constants +def : Pat<(f64 (fpimm0)), (COPY (i64 X0))>; +def : Pat<(f64 (fpimmneg0)), (FSGNJN_D_INX (COPY (i64 X0)), + (COPY (i64 X0)))>; + +// Moves (no conversion) +def : Pat<(f64 (bitconvert (i64 GPR:$rs1))), (COPY GPR:$rs1)>; +def : Pat<(i64 (bitconvert FPR64INX:$rs1)), (COPY FPR64INX:$rs1)>; + +// Use target specific isd nodes to help us remember the result is sign +// extended. Matching sext_inreg+fptoui/fptosi may cause the conversion to be +// duplicated if it has another user that didn't need the sign_extend. +def : Pat<(riscv_any_fcvt_w_rv64 FPR64INX:$rs1, timm:$frm), (FCVT_W_D_INX $rs1, timm:$frm)>; +def : Pat<(riscv_any_fcvt_wu_rv64 FPR64INX:$rs1, timm:$frm), (FCVT_WU_D_INX $rs1, timm:$frm)>; + +// [u]int32->fp +def : Pat<(any_sint_to_fp (i64 (sexti32 (i64 GPR:$rs1)))), (FCVT_D_W_INX $rs1)>; +def : Pat<(any_uint_to_fp (i64 (zexti32 (i64 GPR:$rs1)))), (FCVT_D_WU_INX $rs1)>; + +// Saturating double->[u]int64. +def : Pat<(i64 (riscv_fcvt_x FPR64INX:$rs1, timm:$frm)), (FCVT_L_D_INX $rs1, timm:$frm)>; +def : Pat<(i64 (riscv_fcvt_xu FPR64INX:$rs1, timm:$frm)), (FCVT_LU_D_INX $rs1, timm:$frm)>; + +// double->[u]int64. Round-to-zero must be used. +def : Pat<(i64 (any_fp_to_sint FPR64INX:$rs1)), (FCVT_L_D_INX FPR64INX:$rs1, 0b001)>; +def : Pat<(i64 (any_fp_to_uint FPR64INX:$rs1)), (FCVT_LU_D_INX FPR64INX:$rs1, 0b001)>; + +// double->int64 with current rounding mode. +def : Pat<(i64 (any_lrint FPR64INX:$rs1)), (FCVT_L_D_INX $rs1, 0b111)>; +def : Pat<(i64 (any_llrint FPR64INX:$rs1)), (FCVT_L_D_INX $rs1, 0b111)>; + +// double->int64 rounded to nearest with ties rounded away from zero. +def : Pat<(i64 (any_lround FPR64INX:$rs1)), (FCVT_L_D_INX $rs1, 0b100)>; +def : Pat<(i64 (any_llround FPR64INX:$rs1)), (FCVT_L_D_INX $rs1, 0b100)>; + +// [u]int64->fp. Match GCC and default to using dynamic rounding mode. +def : Pat<(any_sint_to_fp (i64 GPR:$rs1)), (FCVT_D_L_INX GPR:$rs1, 0b111)>; +def : Pat<(any_uint_to_fp (i64 GPR:$rs1)), (FCVT_D_LU_INX GPR:$rs1, 0b111)>; +} // Predicates = [HasStdExtZdinx, IsRV64] diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoF.td b/llvm/lib/Target/RISCV/RISCVInstrInfoF.td --- a/llvm/lib/Target/RISCV/RISCVInstrInfoF.td +++ b/llvm/lib/Target/RISCV/RISCVInstrInfoF.td @@ -147,7 +147,7 @@ //===----------------------------------------------------------------------===// let hasSideEffects = 0, mayLoad = 1, mayStore = 0 in -class FPLoad_r funct3, string opcodestr, RegisterClass rty, +class FPLoad_r funct3, string opcodestr, DAGOperand rty, SchedWrite sw> : RVInstI; let hasSideEffects = 0, mayLoad = 0, mayStore = 1 in -class FPStore_r funct3, string opcodestr, RegisterClass rty, +class FPStore_r funct3, string opcodestr, DAGOperand rty, SchedWrite sw> : RVInstS; def : InstAlias<"fge.s $rd, $rs, $rt", (FLE_S_INX GPR:$rd, FPR32INX:$rt, FPR32INX:$rs), 0>; + +// frsr, fssr are obsolete aliases replaced by frcsr, fscsr, so give them +// zero weight. +def : InstAlias<"frsr $rd", (CSRRS GPR:$rd, SysRegFCSR.Encoding, X0), 0>; +def : InstAlias<"fssr $rd, $rs", (CSRRW GPR:$rd, SysRegFCSR.Encoding, GPR:$rs), 0>; +def : InstAlias<"fssr $rs", (CSRRW X0, SysRegFCSR.Encoding, GPR:$rs), 0>; + +def : InstAlias<"frrm $rd", (CSRRS GPR:$rd, SysRegFRM.Encoding, X0), 2>; +def : InstAlias<"fsrm $rd, $rs", (CSRRW GPR:$rd, SysRegFRM.Encoding, GPR:$rs)>; +def : InstAlias<"fsrm $rs", (CSRRW X0, SysRegFRM.Encoding, GPR:$rs), 2>; +def : InstAlias<"fsrmi $rd, $imm", (CSRRWI GPR:$rd, SysRegFRM.Encoding, uimm5:$imm)>; +def : InstAlias<"fsrmi $imm", (CSRRWI X0, SysRegFRM.Encoding, uimm5:$imm), 2>; + +def : InstAlias<"frflags $rd", (CSRRS GPR:$rd, SysRegFFLAGS.Encoding, X0), 2>; +def : InstAlias<"fsflags $rd, $rs", (CSRRW GPR:$rd, SysRegFFLAGS.Encoding, GPR:$rs)>; +def : InstAlias<"fsflags $rs", (CSRRW X0, SysRegFFLAGS.Encoding, GPR:$rs), 2>; +def : InstAlias<"fsflagsi $rd, $imm", (CSRRWI GPR:$rd, SysRegFFLAGS.Encoding, uimm5:$imm)>; +def : InstAlias<"fsflagsi $imm", (CSRRWI X0, SysRegFFLAGS.Encoding, uimm5:$imm), 2>; + +let usesCustomInserter = 1 in { +def PseudoQuietFLE_S_INX : PseudoQuietFCMP; +def PseudoQuietFLT_S_INX : PseudoQuietFCMP; +} } // Predicates = [HasStdExtZfinx] //===----------------------------------------------------------------------===// @@ -471,22 +494,50 @@ def fpimmneg0 : PatLeaf<(fpimm), [{ return N->isExactlyValue(-0.0); }]>; /// Generic pattern classes -class PatSetCC +class PatSetCC : Pat<(OpNode Ty:$rs1, Ty:$rs2, Cond), (Inst $rs1, $rs2)>; +multiclass PatSetCC_m Exts> { + foreach Ext = Exts in + let Predicates = Ext.Predicates in + def Ext.Suffix : PatSetCC(Inst#Ext.Suffix)>; +} class PatFprFpr + DAGOperand RegTy> : Pat<(OpNode RegTy:$rs1, RegTy:$rs2), (Inst $rs1, $rs2)>; +multiclass PatFprFpr_m Exts> { + foreach Ext = Exts in + let Predicates = Ext.Predicates in + def Ext.Suffix : PatFprFpr(Inst#Ext.Suffix), + Ext.Reg>; +} class PatFprFprDynFrm + DAGOperand RegTy> : Pat<(OpNode RegTy:$rs1, RegTy:$rs2), (Inst $rs1, $rs2, 0b111)>; +multiclass PatFprFprDynFrm_m Exts> { + foreach Ext = Exts in + let Predicates = Ext.Predicates in + def Ext.Suffix : PatFprFprDynFrm(Inst#Ext.Suffix), + Ext.Reg>; +} let Predicates = [HasStdExtF] in { - /// Float constants def : Pat<(f32 (fpimm0)), (FMV_W_X X0)>; def : Pat<(f32 (fpimmneg0)), (FSGNJN_S (FMV_W_X X0), (FMV_W_X X0))>; +} // Predicates = [HasStdExtF] + +let Predicates = [HasStdExtZfinx] in { +def : Pat<(f32 (fpimm0)), (COPY (f32 X0))>; +def : Pat<(f32 (fpimmneg0)), (FSGNJN_S_INX (COPY (f32 X0)), (COPY (f32 X0)))>; +} // Predicates = [HasStdExtZfinx] /// Float conversion operations @@ -494,18 +545,28 @@ // are defined later. /// Float arithmetic operations +defm : PatFprFprDynFrm_m; +defm : PatFprFprDynFrm_m; +defm : PatFprFprDynFrm_m; +defm : PatFprFprDynFrm_m; -def : PatFprFprDynFrm; -def : PatFprFprDynFrm; -def : PatFprFprDynFrm; -def : PatFprFprDynFrm; - +let Predicates = [HasStdExtF] in { def : Pat<(any_fsqrt FPR32:$rs1), (FSQRT_S FPR32:$rs1, 0b111)>; def : Pat<(fneg FPR32:$rs1), (FSGNJN_S $rs1, $rs1)>; def : Pat<(fabs FPR32:$rs1), (FSGNJX_S $rs1, $rs1)>; +} // Predicates = [HasStdExtF] -def : PatFprFpr; +let Predicates = [HasStdExtZfinx] in { +def : Pat<(any_fsqrt FPR32INX:$rs1), (FSQRT_S_INX FPR32INX:$rs1, 0b111)>; + +def : Pat<(fneg FPR32INX:$rs1), (FSGNJN_S_INX $rs1, $rs1)>; +def : Pat<(fabs FPR32INX:$rs1), (FSGNJX_S_INX $rs1, $rs1)>; +} // Predicates = [HasStdExtZfinx] + +defm : PatFprFpr_m; + +let Predicates = [HasStdExtF] in { def : Pat<(fcopysign FPR32:$rs1, (fneg FPR32:$rs2)), (FSGNJN_S $rs1, $rs2)>; // fmadd: rs1 * rs2 + rs3 @@ -527,25 +588,51 @@ // fnmadd: -(rs1 * rs2 + rs3) (the nsz flag on the FMA) def : Pat<(fneg (any_fma_nsz FPR32:$rs1, FPR32:$rs2, FPR32:$rs3)), (FNMADD_S FPR32:$rs1, FPR32:$rs2, FPR32:$rs3, 0b111)>; +} // Predicates = [HasStdExtF] + +let Predicates = [HasStdExtZfinx] in { +def : Pat<(fcopysign FPR32INX:$rs1, (fneg FPR32INX:$rs2)), (FSGNJN_S_INX $rs1, $rs2)>; + +// fmadd: rs1 * rs2 + rs3 +def : Pat<(any_fma FPR32INX:$rs1, FPR32INX:$rs2, FPR32INX:$rs3), + (FMADD_S_INX $rs1, $rs2, $rs3, 0b111)>; + +// fmsub: rs1 * rs2 - rs3 +def : Pat<(any_fma FPR32INX:$rs1, FPR32INX:$rs2, (fneg FPR32INX:$rs3)), + (FMSUB_S_INX FPR32INX:$rs1, FPR32INX:$rs2, FPR32INX:$rs3, 0b111)>; + +// fnmsub: -rs1 * rs2 + rs3 +def : Pat<(any_fma (fneg FPR32INX:$rs1), FPR32INX:$rs2, FPR32INX:$rs3), + (FNMSUB_S_INX FPR32INX:$rs1, FPR32INX:$rs2, FPR32INX:$rs3, 0b111)>; + +// fnmadd: -rs1 * rs2 - rs3 +def : Pat<(any_fma (fneg FPR32INX:$rs1), FPR32INX:$rs2, (fneg FPR32INX:$rs3)), + (FNMADD_S_INX FPR32INX:$rs1, FPR32INX:$rs2, FPR32INX:$rs3, 0b111)>; + +// fnmadd: -(rs1 * rs2 + rs3) (the nsz flag on the FMA) +def : Pat<(fneg (any_fma_nsz FPR32INX:$rs1, FPR32INX:$rs2, FPR32INX:$rs3)), + (FNMADD_S_INX FPR32INX:$rs1, FPR32INX:$rs2, FPR32INX:$rs3, 0b111)>; +} // Predicates = [HasStdExtZfinx] // The ratified 20191213 ISA spec defines fmin and fmax in a way that matches // LLVM's fminnum and fmaxnum // . -def : PatFprFpr; -def : PatFprFpr; +defm : PatFprFpr_m; +defm : PatFprFpr_m; /// Setcc // FIXME: SETEQ/SETLT/SETLE imply nonans, can we pick better instructions for // strict versions of those. // Match non-signaling FEQ_S -def : PatSetCC; -def : PatSetCC; -def : PatSetCC; -def : PatSetCC; -def : PatSetCC; -def : PatSetCC; +defm : PatSetCC_m; +defm : PatSetCC_m; +defm : PatSetCC_m; +defm : PatSetCC_m; +defm : PatSetCC_m; +defm : PatSetCC_m; +let Predicates = [HasStdExtF] in { // Match signaling FEQ_S def : Pat<(strict_fsetccs FPR32:$rs1, FPR32:$rs2, SETEQ), (AND (FLE_S $rs1, $rs2), @@ -558,29 +645,63 @@ (FLE_S $rs1, $rs1)>; def : Pat<(strict_fsetccs FPR32:$rs1, FPR32:$rs1, SETOEQ), (FLE_S $rs1, $rs1)>; +} // Predicates = [HasStdExtF] + +let Predicates = [HasStdExtZfinx] in { +// Match signaling FEQ_S +def : Pat<(strict_fsetccs FPR32INX:$rs1, FPR32INX:$rs2, SETEQ), + (AND (FLE_S_INX $rs1, $rs2), + (FLE_S_INX $rs2, $rs1))>; +def : Pat<(strict_fsetccs FPR32INX:$rs1, FPR32INX:$rs2, SETOEQ), + (AND (FLE_S_INX $rs1, $rs2), + (FLE_S_INX $rs2, $rs1))>; +// If both operands are the same, use a single FLE. +def : Pat<(strict_fsetccs FPR32INX:$rs1, FPR32INX:$rs1, SETEQ), + (FLE_S_INX $rs1, $rs1)>; +def : Pat<(strict_fsetccs FPR32INX:$rs1, FPR32INX:$rs1, SETOEQ), + (FLE_S_INX $rs1, $rs1)>; +} // Predicates = [HasStdExtZfinx] -def : PatSetCC; -def : PatSetCC; -def : PatSetCC; -def : PatSetCC; +defm : PatSetCC_m; +defm : PatSetCC_m; +defm : PatSetCC_m; +defm : PatSetCC_m; + +let Predicates = [HasStdExtF] in { defm Select_FPR32 : SelectCC_GPR_rrirr; /// Loads - defm : LdPat; /// Stores - defm : StPat; - } // Predicates = [HasStdExtF] +let Predicates = [HasStdExtZfinx] in { +defm Select_FPR32INX : SelectCC_GPR_rrirr; + +/// Loads +def : Pat<(f32 (load GPR:$rs1)), (COPY (LW GPR:$rs1, 0))>; + +/// Stores +def : Pat<(store (f32 FPR32INX:$rs2), GPR:$rs1), + (SW (COPY FPR32INX:$rs2), GPR:$rs1, 0)>; +} // Predicates = [HasStdExtZfinx] + let Predicates = [HasStdExtF, IsRV32] in { // Moves (no conversion) def : Pat<(bitconvert (i32 GPR:$rs1)), (FMV_W_X GPR:$rs1)>; def : Pat<(i32 (bitconvert FPR32:$rs1)), (FMV_X_W FPR32:$rs1)>; +} // Predicates = [HasStdExtF, IsRV32] +let Predicates = [HasStdExtZfinx, IsRV32] in { +// Moves (no conversion) +def : Pat<(f32 (bitconvert (i32 GPR:$rs1))), (COPY GPR:$rs1)>; +def : Pat<(i32 (bitconvert FPR32INX:$rs1)), (COPY FPR32INX:$rs1)>; +} // Predicates = [HasStdExtZfinx, IsRV32] + +let Predicates = [HasStdExtF, IsRV32] in { // float->[u]int. Round-to-zero must be used. def : Pat<(i32 (any_fp_to_sint FPR32:$rs1)), (FCVT_W_S $rs1, 0b001)>; def : Pat<(i32 (any_fp_to_uint FPR32:$rs1)), (FCVT_WU_S $rs1, 0b001)>; @@ -600,6 +721,26 @@ def : Pat<(any_uint_to_fp (i32 GPR:$rs1)), (FCVT_S_WU $rs1, 0b111)>; } // Predicates = [HasStdExtF, IsRV32] +let Predicates = [HasStdExtZfinx, IsRV32] in { +// float->[u]int. Round-to-zero must be used. +def : Pat<(i32 (any_fp_to_sint FPR32INX:$rs1)), (FCVT_W_S_INX $rs1, 0b001)>; +def : Pat<(i32 (any_fp_to_uint FPR32INX:$rs1)), (FCVT_WU_S_INX $rs1, 0b001)>; + +// Saturating float->[u]int32. +def : Pat<(i32 (riscv_fcvt_x FPR32INX:$rs1, timm:$frm)), (FCVT_W_S_INX $rs1, timm:$frm)>; +def : Pat<(i32 (riscv_fcvt_xu FPR32INX:$rs1, timm:$frm)), (FCVT_WU_S_INX $rs1, timm:$frm)>; + +// float->int32 with current rounding mode. +def : Pat<(i32 (any_lrint FPR32INX:$rs1)), (FCVT_W_S_INX $rs1, 0b111)>; + +// float->int32 rounded to nearest with ties rounded away from zero. +def : Pat<(i32 (any_lround FPR32INX:$rs1)), (FCVT_W_S_INX $rs1, 0b100)>; + +// [u]int->float. Match GCC and default to using dynamic rounding mode. +def : Pat<(any_sint_to_fp (i32 GPR:$rs1)), (FCVT_S_W_INX $rs1, 0b111)>; +def : Pat<(any_uint_to_fp (i32 GPR:$rs1)), (FCVT_S_WU_INX $rs1, 0b111)>; +} // Predicates = [HasStdExtZfinx, IsRV32] + let Predicates = [HasStdExtF, IsRV64] in { // Moves (no conversion) def : Pat<(riscv_fmv_w_x_rv64 GPR:$src), (FMV_W_X GPR:$src)>; @@ -635,3 +776,39 @@ def : Pat<(any_sint_to_fp (i64 GPR:$rs1)), (FCVT_S_L $rs1, 0b111)>; def : Pat<(any_uint_to_fp (i64 GPR:$rs1)), (FCVT_S_LU $rs1, 0b111)>; } // Predicates = [HasStdExtF, IsRV64] + +let Predicates = [HasStdExtZfinx, IsRV64] in { +// Moves (no conversion) +def : Pat<(riscv_fmv_w_x_rv64 GPR:$src), (COPY GPR:$src)>; +def : Pat<(riscv_fmv_x_anyextw_rv64 GPRF32:$src), (COPY GPRF32:$src)>; +def : Pat<(sext_inreg (riscv_fmv_x_anyextw_rv64 GPRF32:$src), i32), + (COPY GPRF32:$src)>; + +// Use target specific isd nodes to help us remember the result is sign +// extended. Matching sext_inreg+fptoui/fptosi may cause the conversion to be +// duplicated if it has another user that didn't need the sign_extend. +def : Pat<(riscv_any_fcvt_w_rv64 FPR32INX:$rs1, timm:$frm), (FCVT_W_S_INX $rs1, timm:$frm)>; +def : Pat<(riscv_any_fcvt_wu_rv64 FPR32INX:$rs1, timm:$frm), (FCVT_WU_S_INX $rs1, timm:$frm)>; + +// float->[u]int64. Round-to-zero must be used. +def : Pat<(i64 (any_fp_to_sint FPR32INX:$rs1)), (FCVT_L_S_INX $rs1, 0b001)>; +def : Pat<(i64 (any_fp_to_uint FPR32INX:$rs1)), (FCVT_LU_S_INX $rs1, 0b001)>; + +// Saturating float->[u]int64. +def : Pat<(i64 (riscv_fcvt_x FPR32INX:$rs1, timm:$frm)), (FCVT_L_S_INX $rs1, timm:$frm)>; +def : Pat<(i64 (riscv_fcvt_xu FPR32INX:$rs1, timm:$frm)), (FCVT_LU_S_INX $rs1, timm:$frm)>; + +// float->int64 with current rounding mode. +def : Pat<(i64 (any_lrint FPR32INX:$rs1)), (FCVT_L_S_INX $rs1, 0b111)>; +def : Pat<(i64 (any_llrint FPR32INX:$rs1)), (FCVT_L_S_INX $rs1, 0b111)>; + +// float->int64 rounded to neartest with ties rounded away from zero. +def : Pat<(i64 (any_lround FPR32INX:$rs1)), (FCVT_L_S_INX $rs1, 0b100)>; +def : Pat<(i64 (any_llround FPR32INX:$rs1)), (FCVT_L_S_INX $rs1, 0b100)>; + +// [u]int->fp. Match GCC and default to using dynamic rounding mode. +def : Pat<(any_sint_to_fp (i64 (sexti32 (i64 GPR:$rs1)))), (FCVT_S_W_INX $rs1, 0b111)>; +def : Pat<(any_uint_to_fp (i64 (zexti32 (i64 GPR:$rs1)))), (FCVT_S_WU_INX $rs1, 0b111)>; +def : Pat<(any_sint_to_fp (i64 GPR:$rs1)), (FCVT_S_L_INX $rs1, 0b111)>; +def : Pat<(any_uint_to_fp (i64 GPR:$rs1)), (FCVT_S_LU_INX $rs1, 0b111)>; +} // Predicates = [HasStdExtZfinx, IsRV64] diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoZfh.td b/llvm/lib/Target/RISCV/RISCVInstrInfoZfh.td --- a/llvm/lib/Target/RISCV/RISCVInstrInfoZfh.td +++ b/llvm/lib/Target/RISCV/RISCVInstrInfoZfh.td @@ -237,7 +237,6 @@ } // Predicates = [HasStdExtZfhOrZfhmin] let Predicates = [HasStdExtZhinx] in { -def : InstAlias<"fmv.h $rd, $rs", (FSGNJ_H_INX FPR16INX:$rd, FPR16INX:$rs, FPR16INX:$rs)>; def : InstAlias<"fabs.h $rd, $rs", (FSGNJX_H_INX FPR16INX:$rd, FPR16INX:$rs, FPR16INX:$rs)>; def : InstAlias<"fneg.h $rd, $rs", (FSGNJN_H_INX FPR16INX:$rd, FPR16INX:$rs, FPR16INX:$rs)>; @@ -247,15 +246,28 @@ (FLE_H_INX GPR:$rd, FPR16INX:$rt, FPR16INX:$rs), 0>; } // Predicates = [HasStdExtZhinx] +let Predicates = [HasStdExtZhinx] in { +let usesCustomInserter = 1 in { +def PseudoQuietFLE_H_INX : PseudoQuietFCMP; +def PseudoQuietFLT_H_INX : PseudoQuietFCMP; +} +} // Predicates = [HasStdExtZhinx] + //===----------------------------------------------------------------------===// // Pseudo-instructions and codegen patterns //===----------------------------------------------------------------------===// let Predicates = [HasStdExtZfh] in { - /// Float constants def : Pat<(f16 (fpimm0)), (FMV_H_X X0)>; def : Pat<(f16 (fpimmneg0)), (FSGNJN_H (FMV_H_X X0), (FMV_H_X X0))>; +} // Predicates = [HasStdExtZfh] + +let Predicates = [HasStdExtZhinx] in { +/// Float constants +def : Pat<(f16 (fpimm0)), (COPY (f16 X0))>; +def : Pat<(f16 (fpimmneg0)), (FSGNJN_H_INX (COPY (f16 X0)), (COPY (f16 X0)))>; +} // Predicates = [HasStdExtZhinx] /// Float conversion operations @@ -264,11 +276,12 @@ /// Float arithmetic operations -def : PatFprFprDynFrm; -def : PatFprFprDynFrm; -def : PatFprFprDynFrm; -def : PatFprFprDynFrm; +defm : PatFprFprDynFrm_m; +defm : PatFprFprDynFrm_m; +defm : PatFprFprDynFrm_m; +defm : PatFprFprDynFrm_m; +let Predicates = [HasStdExtZfh] in { def : Pat<(any_fsqrt FPR16:$rs1), (FSQRT_H FPR16:$rs1, 0b111)>; def : Pat<(fneg FPR16:$rs1), (FSGNJN_H $rs1, $rs1)>; @@ -299,25 +312,60 @@ // fnmadd: -(rs1 * rs2 + rs3) (the nsz flag on the FMA) def : Pat<(fneg (any_fma_nsz FPR16:$rs1, FPR16:$rs2, FPR16:$rs3)), (FNMADD_H FPR16:$rs1, FPR16:$rs2, FPR16:$rs3, 0b111)>; + } // Predicates = [HasStdExtZfh] + + let Predicates = [HasStdExtZhinx] in { +def : Pat<(any_fsqrt FPR16INX:$rs1), (FSQRT_H_INX FPR16INX:$rs1, 0b111)>; + +def : Pat<(fneg FPR16INX:$rs1), (FSGNJN_H_INX $rs1, $rs1)>; +def : Pat<(fabs FPR16INX:$rs1), (FSGNJX_H_INX $rs1, $rs1)>; + +def : PatFprFpr; +def : Pat<(fcopysign FPR16INX:$rs1, (fneg FPR16INX:$rs2)), (FSGNJN_H_INX $rs1, $rs2)>; +def : Pat<(fcopysign FPR16INX:$rs1, FPR32INX:$rs2), + (FSGNJ_H_INX $rs1, (FCVT_H_S $rs2, 0b111))>; +def : Pat<(fcopysign FPR32INX:$rs1, FPR16INX:$rs2), (FSGNJ_S_INX $rs1, (FCVT_S_H_INX $rs2))>; + +// fmadd: rs1 * rs2 + rs3 +def : Pat<(any_fma FPR16INX:$rs1, FPR16INX:$rs2, FPR16INX:$rs3), + (FMADD_H_INX $rs1, $rs2, $rs3, 0b111)>; + +// fmsub: rs1 * rs2 - rs3 +def : Pat<(any_fma FPR16INX:$rs1, FPR16INX:$rs2, (fneg FPR16INX:$rs3)), + (FMSUB_H_INX FPR16INX:$rs1, FPR16INX:$rs2, FPR16INX:$rs3, 0b111)>; + +// fnmsub: -rs1 * rs2 + rs3 +def : Pat<(any_fma (fneg FPR16INX:$rs1), FPR16INX:$rs2, FPR16INX:$rs3), + (FNMSUB_H_INX FPR16INX:$rs1, FPR16INX:$rs2, FPR16INX:$rs3, 0b111)>; + +// fnmadd: -rs1 * rs2 - rs3 +def : Pat<(any_fma (fneg FPR16INX:$rs1), FPR16INX:$rs2, (fneg FPR16INX:$rs3)), + (FNMADD_H_INX FPR16INX:$rs1, FPR16INX:$rs2, FPR16INX:$rs3, 0b111)>; + +// fnmadd: -(rs1 * rs2 + rs3) (the nsz flag on the FMA) +def : Pat<(fneg (any_fma_nsz FPR16INX:$rs1, FPR16INX:$rs2, FPR16INX:$rs3)), + (FNMADD_H_INX FPR16INX:$rs1, FPR16INX:$rs2, FPR16INX:$rs3, 0b111)>; + } // Predicates = [HasStdExtZhinx] // The ratified 20191213 ISA spec defines fmin and fmax in a way that matches // LLVM's fminnum and fmaxnum // . -def : PatFprFpr; -def : PatFprFpr; +defm : PatFprFpr_m; +defm : PatFprFpr_m; /// Setcc // FIXME: SETEQ/SETLT/SETLE imply nonans, can we pick better instructions for // strict versions of those. // Match non-signaling FEQ_D -def : PatSetCC; -def : PatSetCC; -def : PatSetCC; -def : PatSetCC; -def : PatSetCC; -def : PatSetCC; +defm : PatSetCC_m; +defm : PatSetCC_m; +defm : PatSetCC_m; +defm : PatSetCC_m; +defm : PatSetCC_m; +defm : PatSetCC_m; +let Predicates = [HasStdExtZfh] in { // Match signaling FEQ_H def : Pat<(strict_fsetccs FPR16:$rs1, FPR16:$rs2, SETEQ), (AND (FLE_H $rs1, $rs2), @@ -330,24 +378,52 @@ (FLE_H $rs1, $rs1)>; def : Pat<(strict_fsetccs FPR16:$rs1, FPR16:$rs1, SETOEQ), (FLE_H $rs1, $rs1)>; +} // Predicates = [HasStdExtZfh] + +let Predicates = [HasStdExtZhinx] in { +// Match signaling FEQ_H +def : Pat<(strict_fsetccs FPR16INX:$rs1, FPR16INX:$rs2, SETEQ), + (AND (FLE_H_INX $rs1, $rs2), + (FLE_H_INX $rs2, $rs1))>; +def : Pat<(strict_fsetccs FPR16INX:$rs1, FPR16INX:$rs2, SETOEQ), + (AND (FLE_H_INX $rs1, $rs2), + (FLE_H_INX $rs2, $rs1))>; +// If both operands are the same, use a single FLE. +def : Pat<(strict_fsetccs FPR16INX:$rs1, FPR16INX:$rs1, SETEQ), + (FLE_H_INX $rs1, $rs1)>; +def : Pat<(strict_fsetccs FPR16INX:$rs1, FPR16INX:$rs1, SETOEQ), + (FLE_H_INX $rs1, $rs1)>; +} // Predicates = [HasStdExtZhinx] -def : PatSetCC; -def : PatSetCC; -def : PatSetCC; -def : PatSetCC; +defm : PatSetCC_m; +defm : PatSetCC_m; +defm : PatSetCC_m; +defm : PatSetCC_m; +let Predicates = [HasStdExtZfh] in defm Select_FPR16 : SelectCC_GPR_rrirr; -} // Predicates = [HasStdExtZfh] + +let Predicates = [HasStdExtZhinx] in +defm Select_FPR16INX : SelectCC_GPR_rrirr; let Predicates = [HasStdExtZfhOrZfhmin] in { /// Loads - defm : LdPat; /// Stores - defm : StPat; +} // Predicates = [HasStdExtZfhOrZfhmin] + +let Predicates = [HasStdExtZhinx] in { +/// Loads +def : Pat<(f16 (load GPR:$rs1)), (COPY (LH GPR:$rs1, 0))>; +/// Stores +def : Pat<(store (f16 FPR16INX:$rs2), GPR:$rs1), + (SH (COPY FPR16INX:$rs2), GPR:$rs1, 0)>; +} // Predicates = [HasStdExtZhinx] + +let Predicates = [HasStdExtZfhOrZfhmin] in { /// Float conversion operations // f32 -> f16, f16 -> f32 @@ -360,6 +436,19 @@ def : Pat<(riscv_fmv_x_signexth FPR16:$src), (FMV_X_H FPR16:$src)>; } // Predicates = [HasStdExtZfhOrZfhmin] +let Predicates = [HasStdExtZhinxOrZhinxmin] in { +/// Float conversion operations + +// f32 -> f16, f16 -> f32 +def : Pat<(any_fpround FPR32INX:$rs1), (FCVT_H_S_INX FPR32INX:$rs1, 0b111)>; +def : Pat<(any_fpextend FPR16INX:$rs1), (FCVT_S_H_INX FPR16INX:$rs1)>; + +// Moves (no conversion) +def : Pat<(riscv_fmv_h_x GPR:$src), (COPY GPR:$src)>; +def : Pat<(riscv_fmv_x_anyexth FPR16INX:$src), (COPY FPR16INX:$src)>; +def : Pat<(riscv_fmv_x_signexth FPR16INX:$src), (COPY FPR16INX:$src)>; +} // Predicates = [HasStdExtZhinx] + let Predicates = [HasStdExtZfh, IsRV32] in { // half->[u]int. Round-to-zero must be used. def : Pat<(i32 (any_fp_to_sint FPR16:$rs1)), (FCVT_W_H $rs1, 0b001)>; @@ -380,6 +469,26 @@ def : Pat<(any_uint_to_fp (i32 GPR:$rs1)), (FCVT_H_WU $rs1, 0b111)>; } // Predicates = [HasStdExtZfh, IsRV32] +let Predicates = [HasStdExtZhinx, IsRV32] in { +// half->[u]int. Round-to-zero must be used. +def : Pat<(i32 (any_fp_to_sint FPR16INX:$rs1)), (FCVT_W_H_INX $rs1, 0b001)>; +def : Pat<(i32 (any_fp_to_uint FPR16INX:$rs1)), (FCVT_WU_H_INX $rs1, 0b001)>; + +// Saturating float->[u]int32. +def : Pat<(i32 (riscv_fcvt_x FPR16INX:$rs1, timm:$frm)), (FCVT_W_H_INX $rs1, timm:$frm)>; +def : Pat<(i32 (riscv_fcvt_xu FPR16INX:$rs1, timm:$frm)), (FCVT_WU_H_INX $rs1, timm:$frm)>; + +// half->int32 with current rounding mode. +def : Pat<(i32 (any_lrint FPR16INX:$rs1)), (FCVT_W_H_INX $rs1, 0b111)>; + +// half->int32 rounded to nearest with ties rounded away from zero. +def : Pat<(i32 (any_lround FPR16INX:$rs1)), (FCVT_W_H_INX $rs1, 0b100)>; + +// [u]int->half. Match GCC and default to using dynamic rounding mode. +def : Pat<(any_sint_to_fp (i32 GPR:$rs1)), (FCVT_H_W_INX $rs1, 0b111)>; +def : Pat<(any_uint_to_fp (i32 GPR:$rs1)), (FCVT_H_WU_INX $rs1, 0b111)>; +} // Predicates = [HasStdExtZhinx, IsRV32] + let Predicates = [HasStdExtZfh, IsRV64] in { // Use target specific isd nodes to help us remember the result is sign // extended. Matching sext_inreg+fptoui/fptosi may cause the conversion to be @@ -410,6 +519,36 @@ def : Pat<(any_uint_to_fp (i64 GPR:$rs1)), (FCVT_H_LU $rs1, 0b111)>; } // Predicates = [HasStdExtZfh, IsRV64] +let Predicates = [HasStdExtZhinx, IsRV64] in { +// Use target specific isd nodes to help us remember the result is sign +// extended. Matching sext_inreg+fptoui/fptosi may cause the conversion to be +// duplicated if it has another user that didn't need the sign_extend. +def : Pat<(riscv_any_fcvt_w_rv64 FPR16INX:$rs1, timm:$frm), (FCVT_W_H_INX $rs1, timm:$frm)>; +def : Pat<(riscv_any_fcvt_wu_rv64 FPR16INX:$rs1, timm:$frm), (FCVT_WU_H_INX $rs1, timm:$frm)>; + +// half->[u]int64. Round-to-zero must be used. +def : Pat<(i64 (any_fp_to_sint FPR16INX:$rs1)), (FCVT_L_H_INX $rs1, 0b001)>; +def : Pat<(i64 (any_fp_to_uint FPR16INX:$rs1)), (FCVT_LU_H_INX $rs1, 0b001)>; + +// Saturating float->[u]int64. +def : Pat<(i64 (riscv_fcvt_x FPR16INX:$rs1, timm:$frm)), (FCVT_L_H_INX $rs1, timm:$frm)>; +def : Pat<(i64 (riscv_fcvt_xu FPR16INX:$rs1, timm:$frm)), (FCVT_LU_H_INX $rs1, timm:$frm)>; + +// half->int64 with current rounding mode. +def : Pat<(i64 (any_lrint FPR16INX:$rs1)), (FCVT_L_H_INX $rs1, 0b111)>; +def : Pat<(i64 (any_llrint FPR16INX:$rs1)), (FCVT_L_H_INX $rs1, 0b111)>; + +// half->int64 rounded to nearest with ties rounded away from zero. +def : Pat<(i64 (any_lround FPR16INX:$rs1)), (FCVT_L_H_INX $rs1, 0b100)>; +def : Pat<(i64 (any_llround FPR16INX:$rs1)), (FCVT_L_H_INX $rs1, 0b100)>; + +// [u]int->fp. Match GCC and default to using dynamic rounding mode. +def : Pat<(any_sint_to_fp (i64 (sexti32 (i64 GPR:$rs1)))), (FCVT_H_W_INX $rs1, 0b111)>; +def : Pat<(any_uint_to_fp (i64 (zexti32 (i64 GPR:$rs1)))), (FCVT_H_WU_INX $rs1, 0b111)>; +def : Pat<(any_sint_to_fp (i64 GPR:$rs1)), (FCVT_H_L_INX $rs1, 0b111)>; +def : Pat<(any_uint_to_fp (i64 GPR:$rs1)), (FCVT_H_LU_INX $rs1, 0b111)>; +} // Predicates = [HasStdExtZhinx, IsRV64] + let Predicates = [HasStdExtZfhOrZfhmin, HasStdExtD] in { /// Float conversion operations // f64 -> f16, f16 -> f64 @@ -421,3 +560,15 @@ (FSGNJ_H $rs1, (FCVT_H_D $rs2, 0b111))>; def : Pat<(fcopysign FPR64:$rs1, FPR16:$rs2), (FSGNJ_D $rs1, (FCVT_D_H $rs2))>; } // Predicates = [HasStdExtZfhOrZfhmin, HasStdExtD] + +let Predicates = [HasStdExtZhinxOrZhinxmin, HasStdExtZdinx] in { +/// Float conversion operations +// f64 -> f16, f16 -> f64 +def : Pat<(any_fpround FPR64INX:$rs1), (FCVT_H_D_INX FPR64INX:$rs1, 0b111)>; +def : Pat<(any_fpextend FPR16INX:$rs1), (FCVT_D_H_INX FPR16INX:$rs1)>; + +/// Float arithmetic operations +def : Pat<(fcopysign FPR16INX:$rs1, FPR64INX:$rs2), + (FSGNJ_H_INX $rs1, (FCVT_H_D_INX $rs2, 0b111))>; +def : Pat<(fcopysign FPR64INX:$rs1, FPR16INX:$rs2), (FSGNJ_D_INX $rs1, (FCVT_D_H_INX $rs2))>; +} // Predicates = [HasStdExtZhinx, HasStdExtZdinx] diff --git a/llvm/lib/Target/RISCV/RISCVRegisterInfo.td b/llvm/lib/Target/RISCV/RISCVRegisterInfo.td --- a/llvm/lib/Target/RISCV/RISCVRegisterInfo.td +++ b/llvm/lib/Target/RISCV/RISCVRegisterInfo.td @@ -562,8 +562,8 @@ } } -let RegInfos = RegInfoByHwMode<[RV64], [RegInfo<64, 64, 64>]> in -def GPRPF64 : RegisterClass<"RISCV", [f64], 64, (add +let RegInfos = RegInfoByHwMode<[RV32], [RegInfo<64, 64, 32>]> in +def GPRPF64 : RegisterClass<"RISCV", [f64], 32, (add X10_PD, X12_PD, X14_PD, X16_PD, X6_PD, X28_PD, X30_PD, diff --git a/llvm/lib/Target/RISCV/RISCVSubtarget.h b/llvm/lib/Target/RISCV/RISCVSubtarget.h --- a/llvm/lib/Target/RISCV/RISCVSubtarget.h +++ b/llvm/lib/Target/RISCV/RISCVSubtarget.h @@ -166,9 +166,12 @@ bool hasStdExtZfhmin() const { return HasStdExtZfhmin; } bool hasStdExtZfh() const { return HasStdExtZfh; } bool hasStdExtZfinx() const { return HasStdExtZfinx; } + bool hasStdExtFOrZfinx() const { return HasStdExtF || HasStdExtZfinx; } bool hasStdExtZdinx() const { return HasStdExtZdinx; } + bool hasStdExtDOrZdinx() const { return HasStdExtD || HasStdExtZdinx; } bool hasStdExtZhinxmin() const { return HasStdExtZhinxmin; } bool hasStdExtZhinx() const { return HasStdExtZhinx; } + bool hasStdExtZfhOrZhinx() const { return HasStdExtZfh || HasStdExtZhinx; } bool hasStdExtZbkb() const { return HasStdExtZbkb; } bool hasStdExtZbkc() const { return HasStdExtZbkc; } bool hasStdExtZbkx() const { return HasStdExtZbkx; } diff --git a/llvm/test/CodeGen/RISCV/double-arith-strict.ll b/llvm/test/CodeGen/RISCV/double-arith-strict.ll --- a/llvm/test/CodeGen/RISCV/double-arith-strict.ll +++ b/llvm/test/CodeGen/RISCV/double-arith-strict.ll @@ -5,6 +5,12 @@ ; RUN: llc -mtriple=riscv64 -mattr=+d -verify-machineinstrs < %s \ ; RUN: -disable-strictnode-mutation -target-abi=lp64d \ ; RUN: | FileCheck -check-prefixes=CHECKIFD,RV64IFD %s +; RUN: llc -mtriple=riscv32 -mattr=+zdinx -verify-machineinstrs < %s \ +; RUN: -disable-strictnode-mutation -target-abi=ilp32 \ +; RUN: | FileCheck -check-prefix=RV32IZFINXZDINX %s +; RUN: llc -mtriple=riscv64 -mattr=+zdinx -verify-machineinstrs < %s \ +; RUN: -disable-strictnode-mutation -target-abi=lp64 \ +; RUN: | FileCheck -check-prefix=RV64IZFINXZDINX %s ; RUN: llc -mtriple=riscv32 -verify-machineinstrs < %s \ ; RUN: -disable-strictnode-mutation | FileCheck -check-prefix=RV32I %s ; RUN: llc -mtriple=riscv64 -verify-machineinstrs < %s \ @@ -16,6 +22,30 @@ ; CHECKIFD-NEXT: fadd.d fa0, fa0, fa1 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fadd_d: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fadd.d a0, a0, a2 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fadd_d: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fadd.d a0, a0, a1 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fadd_d: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -44,6 +74,30 @@ ; CHECKIFD-NEXT: fsub.d fa0, fa0, fa1 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fsub_d: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fsub.d a0, a0, a2 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fsub_d: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fsub.d a0, a0, a1 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fsub_d: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -72,6 +126,30 @@ ; CHECKIFD-NEXT: fmul.d fa0, fa0, fa1 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fmul_d: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fmul.d a0, a0, a2 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fmul_d: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fmul.d a0, a0, a1 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fmul_d: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -100,6 +178,30 @@ ; CHECKIFD-NEXT: fdiv.d fa0, fa0, fa1 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fdiv_d: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fdiv.d a0, a0, a2 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fdiv_d: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fdiv.d a0, a0, a1 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fdiv_d: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -128,6 +230,26 @@ ; CHECKIFD-NEXT: fsqrt.d fa0, fa0 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fsqrt_d: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fsqrt.d a0, a0 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fsqrt_d: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fsqrt.d a0, a0 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fsqrt_d: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -169,6 +291,24 @@ ; RV64IFD-NEXT: addi sp, sp, 16 ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fmin_d: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: call fmin@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fmin_d: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV64IZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: call fmin@plt +; RV64IZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fmin_d: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -210,6 +350,24 @@ ; RV64IFD-NEXT: addi sp, sp, 16 ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fmax_d: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: call fmax@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fmax_d: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV64IZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: call fmax@plt +; RV64IZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fmax_d: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -238,6 +396,34 @@ ; CHECKIFD-NEXT: fmadd.d fa0, fa0, fa1, fa2 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fmadd_d: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fmadd.d a0, a0, a2, a4 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fmadd_d: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fmadd.d a0, a0, a1, a2 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fmadd_d: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -275,6 +461,37 @@ ; RV64IFD-NEXT: fmsub.d fa0, fa0, fa1, ft0 ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fmsub_d: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.d.w a6, zero +; RV32IZFINXZDINX-NEXT: fadd.d a4, a4, a6 +; RV32IZFINXZDINX-NEXT: fmsub.d a0, a0, a2, a4 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fmsub_d: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fadd.d a2, a2, zero +; RV64IZFINXZDINX-NEXT: fmsub.d a0, a0, a1, a2 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fmsub_d: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -32 @@ -353,6 +570,39 @@ ; RV64IFD-NEXT: fnmadd.d fa0, ft1, fa1, ft0 ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fnmadd_d: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.d.w a6, zero +; RV32IZFINXZDINX-NEXT: fadd.d a0, a0, a6 +; RV32IZFINXZDINX-NEXT: fadd.d a4, a4, a6 +; RV32IZFINXZDINX-NEXT: fnmadd.d a0, a0, a2, a4 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fnmadd_d: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fadd.d a0, a0, zero +; RV64IZFINXZDINX-NEXT: fadd.d a2, a2, zero +; RV64IZFINXZDINX-NEXT: fnmadd.d a0, a0, a1, a2 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fnmadd_d: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -32 @@ -449,6 +699,39 @@ ; RV64IFD-NEXT: fnmadd.d fa0, ft1, fa0, ft0 ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fnmadd_d_2: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.d.w a6, zero +; RV32IZFINXZDINX-NEXT: fadd.d a2, a2, a6 +; RV32IZFINXZDINX-NEXT: fadd.d a4, a4, a6 +; RV32IZFINXZDINX-NEXT: fnmadd.d a0, a2, a0, a4 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fnmadd_d_2: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fadd.d a1, a1, zero +; RV64IZFINXZDINX-NEXT: fadd.d a2, a2, zero +; RV64IZFINXZDINX-NEXT: fnmadd.d a0, a1, a0, a2 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fnmadd_d_2: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -32 @@ -544,6 +827,37 @@ ; RV64IFD-NEXT: fnmsub.d fa0, ft0, fa1, fa2 ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fnmsub_d: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.d.w a6, zero +; RV32IZFINXZDINX-NEXT: fadd.d a0, a0, a6 +; RV32IZFINXZDINX-NEXT: fnmsub.d a0, a0, a2, a4 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fnmsub_d: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fadd.d a0, a0, zero +; RV64IZFINXZDINX-NEXT: fnmsub.d a0, a0, a1, a2 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fnmsub_d: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -32 @@ -616,6 +930,37 @@ ; RV64IFD-NEXT: fnmsub.d fa0, ft0, fa0, fa2 ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fnmsub_d_2: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.d.w a6, zero +; RV32IZFINXZDINX-NEXT: fadd.d a2, a2, a6 +; RV32IZFINXZDINX-NEXT: fnmsub.d a0, a2, a0, a4 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fnmsub_d_2: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fadd.d a1, a1, zero +; RV64IZFINXZDINX-NEXT: fnmsub.d a0, a1, a0, a2 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fnmsub_d_2: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -32 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 @@ -3,6 +3,10 @@ ; RUN: -target-abi=ilp32d | FileCheck -check-prefixes=CHECKIFD,RV32IFD %s ; RUN: llc -mtriple=riscv64 -mattr=+d -verify-machineinstrs < %s \ ; RUN: -target-abi=lp64d | FileCheck -check-prefixes=CHECKIFD,RV64IFD %s +; RUN: llc -mtriple=riscv32 -mattr=+zdinx -verify-machineinstrs < %s \ +; RUN: -target-abi=ilp32 | FileCheck -check-prefix=RV32IZFINXZDINX %s +; RUN: llc -mtriple=riscv64 -mattr=+zdinx -verify-machineinstrs < %s \ +; RUN: -target-abi=lp64 | FileCheck -check-prefix=RV64IZFINXZDINX %s ; RUN: llc -mtriple=riscv32 -verify-machineinstrs < %s \ ; RUN: | FileCheck -check-prefix=RV32I %s ; RUN: llc -mtriple=riscv64 -verify-machineinstrs < %s \ @@ -19,6 +23,30 @@ ; CHECKIFD-NEXT: fadd.d fa0, fa0, fa1 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fadd_d: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fadd.d a0, a0, a2 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fadd_d: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fadd.d a0, a0, a1 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fadd_d: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -46,6 +74,30 @@ ; CHECKIFD-NEXT: fsub.d fa0, fa0, fa1 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fsub_d: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fsub.d a0, a0, a2 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fsub_d: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fsub.d a0, a0, a1 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fsub_d: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -73,6 +125,30 @@ ; CHECKIFD-NEXT: fmul.d fa0, fa0, fa1 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fmul_d: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fmul.d a0, a0, a2 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fmul_d: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fmul.d a0, a0, a1 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fmul_d: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -100,6 +176,30 @@ ; CHECKIFD-NEXT: fdiv.d fa0, fa0, fa1 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fdiv_d: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fdiv.d a0, a0, a2 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fdiv_d: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fdiv.d a0, a0, a1 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fdiv_d: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -129,6 +229,26 @@ ; CHECKIFD-NEXT: fsqrt.d fa0, fa0 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fsqrt_d: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fsqrt.d a0, a0 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fsqrt_d: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fsqrt.d a0, a0 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fsqrt_d: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -158,6 +278,30 @@ ; CHECKIFD-NEXT: fsgnj.d fa0, fa0, fa1 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fsgnj_d: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fsgnj.d a0, a0, a2 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fsgnj_d: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fsgnj.d a0, a0, a1 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fsgnj_d: ; RV32I: # %bb.0: ; RV32I-NEXT: lui a2, 524288 @@ -189,6 +333,26 @@ ; CHECKIFD-NEXT: feq.d a0, ft0, ft1 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fneg_d: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fadd.d a0, a0, a0 +; RV32IZFINXZDINX-NEXT: fneg.d a2, a0 +; RV32IZFINXZDINX-NEXT: feq.d a0, a0, a2 +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fneg_d: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fadd.d a0, a0, a0 +; RV64IZFINXZDINX-NEXT: fneg.d a1, a0 +; RV64IZFINXZDINX-NEXT: feq.d a0, a0, a1 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fneg_d: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -235,6 +399,33 @@ ; CHECKIFD-NEXT: fsgnjn.d fa0, fa0, fa1 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fsgnjn_d: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fsgnjn.d a0, a0, a2 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fsgnjn_d: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: li a2, -1 +; RV64IZFINXZDINX-NEXT: slli a2, a2, 63 +; RV64IZFINXZDINX-NEXT: xor a1, a1, a2 +; RV64IZFINXZDINX-NEXT: fsgnj.d a0, a0, a1 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fsgnjn_d: ; RV32I: # %bb.0: ; RV32I-NEXT: not a2, a3 @@ -271,6 +462,34 @@ ; CHECKIFD-NEXT: fadd.d fa0, ft1, ft0 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fabs_d: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fadd.d a0, a0, a2 +; RV32IZFINXZDINX-NEXT: fabs.d a2, a0 +; RV32IZFINXZDINX-NEXT: fadd.d a0, a2, a0 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fabs_d: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fadd.d a0, a0, a1 +; RV64IZFINXZDINX-NEXT: fabs.d a1, a0 +; RV64IZFINXZDINX-NEXT: fadd.d a0, a1, a0 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fabs_d: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -311,6 +530,30 @@ ; CHECKIFD-NEXT: fmin.d fa0, fa0, fa1 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fmin_d: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fmin.d a0, a0, a2 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fmin_d: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fmin.d a0, a0, a1 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fmin_d: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -340,6 +583,30 @@ ; CHECKIFD-NEXT: fmax.d fa0, fa0, fa1 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fmax_d: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fmax.d a0, a0, a2 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fmax_d: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fmax.d a0, a0, a1 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fmax_d: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -369,6 +636,34 @@ ; CHECKIFD-NEXT: fmadd.d fa0, fa0, fa1, fa2 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fmadd_d: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fmadd.d a0, a0, a2, a4 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fmadd_d: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fmadd.d a0, a0, a1, a2 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fmadd_d: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -405,6 +700,37 @@ ; RV64IFD-NEXT: fmsub.d fa0, fa0, fa1, ft0 ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fmsub_d: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.d.w a6, zero +; RV32IZFINXZDINX-NEXT: fadd.d a4, a4, a6 +; RV32IZFINXZDINX-NEXT: fmsub.d a0, a0, a2, a4 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fmsub_d: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fadd.d a2, a2, zero +; RV64IZFINXZDINX-NEXT: fmsub.d a0, a0, a1, a2 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fmsub_d: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -32 @@ -483,6 +809,39 @@ ; RV64IFD-NEXT: fnmadd.d fa0, ft1, fa1, ft0 ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fnmadd_d: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.d.w a6, zero +; RV32IZFINXZDINX-NEXT: fadd.d a0, a0, a6 +; RV32IZFINXZDINX-NEXT: fadd.d a4, a4, a6 +; RV32IZFINXZDINX-NEXT: fnmadd.d a0, a0, a2, a4 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fnmadd_d: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fadd.d a0, a0, zero +; RV64IZFINXZDINX-NEXT: fadd.d a2, a2, zero +; RV64IZFINXZDINX-NEXT: fnmadd.d a0, a0, a1, a2 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fnmadd_d: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -32 @@ -579,6 +938,39 @@ ; RV64IFD-NEXT: fnmadd.d fa0, ft1, fa0, ft0 ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fnmadd_d_2: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.d.w a6, zero +; RV32IZFINXZDINX-NEXT: fadd.d a2, a2, a6 +; RV32IZFINXZDINX-NEXT: fadd.d a4, a4, a6 +; RV32IZFINXZDINX-NEXT: fnmadd.d a0, a2, a0, a4 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fnmadd_d_2: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fadd.d a1, a1, zero +; RV64IZFINXZDINX-NEXT: fadd.d a2, a2, zero +; RV64IZFINXZDINX-NEXT: fnmadd.d a0, a1, a0, a2 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fnmadd_d_2: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -32 @@ -666,6 +1058,39 @@ ; CHECKIFD-NEXT: fneg.d fa0, ft0 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fnmadd_d_3: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fmadd.d a0, a0, a2, a4 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lui a2, 524288 +; RV32IZFINXZDINX-NEXT: xor a1, a1, a2 +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fnmadd_d_3: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fmadd.d a0, a0, a1, a2 +; RV64IZFINXZDINX-NEXT: li a1, -1 +; RV64IZFINXZDINX-NEXT: slli a1, a1, 63 +; RV64IZFINXZDINX-NEXT: xor a0, a0, a1 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fnmadd_d_3: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -700,6 +1125,39 @@ ; CHECKIFD-NEXT: fnmadd.d fa0, fa0, fa1, fa2 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fnmadd_nsz: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fmadd.d a0, a0, a2, a4 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lui a2, 524288 +; RV32IZFINXZDINX-NEXT: xor a1, a1, a2 +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fnmadd_nsz: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fmadd.d a0, a0, a1, a2 +; RV64IZFINXZDINX-NEXT: li a1, -1 +; RV64IZFINXZDINX-NEXT: slli a1, a1, 63 +; RV64IZFINXZDINX-NEXT: xor a0, a0, a1 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fnmadd_nsz: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -742,6 +1200,37 @@ ; RV64IFD-NEXT: fnmsub.d fa0, ft0, fa1, fa2 ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fnmsub_d: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.d.w a6, zero +; RV32IZFINXZDINX-NEXT: fadd.d a0, a0, a6 +; RV32IZFINXZDINX-NEXT: fnmsub.d a0, a0, a2, a4 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fnmsub_d: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fadd.d a0, a0, zero +; RV64IZFINXZDINX-NEXT: fnmsub.d a0, a0, a1, a2 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fnmsub_d: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -32 @@ -814,6 +1303,37 @@ ; RV64IFD-NEXT: fnmsub.d fa0, ft0, fa0, fa2 ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fnmsub_d_2: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.d.w a6, zero +; RV32IZFINXZDINX-NEXT: fadd.d a2, a2, a6 +; RV32IZFINXZDINX-NEXT: fnmsub.d a0, a2, a0, a4 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fnmsub_d_2: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fadd.d a1, a1, zero +; RV64IZFINXZDINX-NEXT: fnmsub.d a0, a1, a0, a2 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fnmsub_d_2: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -32 @@ -881,6 +1401,34 @@ ; CHECKIFD-NEXT: fmadd.d fa0, fa0, fa1, fa2 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fmadd_d_contract: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fmadd.d a0, a0, a2, a4 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fmadd_d_contract: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fmadd.d a0, a0, a1, a2 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fmadd_d_contract: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -932,6 +1480,37 @@ ; RV64IFD-NEXT: fmsub.d fa0, fa0, fa1, ft0 ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fmsub_d_contract: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.d.w a6, zero +; RV32IZFINXZDINX-NEXT: fadd.d a4, a4, a6 +; RV32IZFINXZDINX-NEXT: fmsub.d a0, a0, a2, a4 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fmsub_d_contract: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fadd.d a2, a2, zero +; RV64IZFINXZDINX-NEXT: fmsub.d a0, a0, a1, a2 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fmsub_d_contract: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -32 @@ -1020,6 +1599,41 @@ ; RV64IFD-NEXT: fnmadd.d fa0, ft1, ft2, ft0 ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fnmadd_d_contract: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.d.w a6, zero +; RV32IZFINXZDINX-NEXT: fadd.d a0, a0, a6 +; RV32IZFINXZDINX-NEXT: fadd.d a2, a2, a6 +; RV32IZFINXZDINX-NEXT: fadd.d a4, a4, a6 +; RV32IZFINXZDINX-NEXT: fnmadd.d a0, a0, a2, a4 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fnmadd_d_contract: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fadd.d a0, a0, zero +; RV64IZFINXZDINX-NEXT: fadd.d a1, a1, zero +; RV64IZFINXZDINX-NEXT: fadd.d a2, a2, zero +; RV64IZFINXZDINX-NEXT: fnmadd.d a0, a0, a1, a2 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fnmadd_d_contract: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -32 @@ -1133,6 +1747,39 @@ ; RV64IFD-NEXT: fnmsub.d fa0, ft1, ft0, fa2 ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fnmsub_d_contract: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.d.w a6, zero +; RV32IZFINXZDINX-NEXT: fadd.d a0, a0, a6 +; RV32IZFINXZDINX-NEXT: fadd.d a2, a2, a6 +; RV32IZFINXZDINX-NEXT: fnmsub.d a0, a0, a2, a4 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fnmsub_d_contract: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fadd.d a0, a0, zero +; RV64IZFINXZDINX-NEXT: fadd.d a1, a1, zero +; RV64IZFINXZDINX-NEXT: fnmsub.d a0, a0, a1, a2 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fnmsub_d_contract: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -32 diff --git a/llvm/test/CodeGen/RISCV/double-bitmanip-dagcombines.ll b/llvm/test/CodeGen/RISCV/double-bitmanip-dagcombines.ll --- a/llvm/test/CodeGen/RISCV/double-bitmanip-dagcombines.ll +++ b/llvm/test/CodeGen/RISCV/double-bitmanip-dagcombines.ll @@ -3,10 +3,14 @@ ; RUN: | FileCheck -check-prefix=RV32I %s ; RUN: llc -mtriple=riscv32 -target-abi=ilp32 -mattr=+d -verify-machineinstrs < %s \ ; RUN: | FileCheck -check-prefix=RV32IFD %s +; RUN: llc -mtriple=riscv32 -target-abi=ilp32 -mattr=+zdinx -verify-machineinstrs < %s \ +; RUN: | FileCheck -check-prefix=RV32IZFINXZDINX %s ; RUN: llc -mtriple=riscv64 -target-abi=lp64 -verify-machineinstrs < %s \ ; RUN: | FileCheck -check-prefix=RV64I %s ; RUN: llc -mtriple=riscv64 -target-abi=lp64 -mattr=+d -verify-machineinstrs < %s \ ; RUN: | FileCheck -check-prefix=RV64IFD %s +; RUN: llc -mtriple=riscv64 -target-abi=lp64 -mattr=+zdinx -verify-machineinstrs < %s \ +; RUN: | FileCheck -check-prefix=RV64IZFINXZDINX %s ; ; This file tests cases where simple floating point operations can be ; profitably handled though bit manipulation if a soft-float ABI is being used @@ -30,6 +34,12 @@ ; RV32IFD-NEXT: xor a1, a1, a2 ; RV32IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fneg: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: lui a2, 524288 +; RV32IZFINXZDINX-NEXT: xor a1, a1, a2 +; RV32IZFINXZDINX-NEXT: ret +; ; RV64I-LABEL: fneg: ; RV64I: # %bb.0: ; RV64I-NEXT: li a1, -1 @@ -43,6 +53,13 @@ ; RV64IFD-NEXT: slli a1, a1, 63 ; RV64IFD-NEXT: xor a0, a0, a1 ; RV64IFD-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fneg: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: li a1, -1 +; RV64IZFINXZDINX-NEXT: slli a1, a1, 63 +; RV64IZFINXZDINX-NEXT: xor a0, a0, a1 +; RV64IZFINXZDINX-NEXT: ret %1 = fneg double %a ret double %1 } @@ -62,6 +79,12 @@ ; RV32IFD-NEXT: srli a1, a1, 1 ; RV32IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fabs: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: slli a1, a1, 1 +; RV32IZFINXZDINX-NEXT: srli a1, a1, 1 +; RV32IZFINXZDINX-NEXT: ret +; ; RV64I-LABEL: fabs: ; RV64I: # %bb.0: ; RV64I-NEXT: slli a0, a0, 1 @@ -73,6 +96,12 @@ ; RV64IFD-NEXT: slli a0, a0, 1 ; RV64IFD-NEXT: srli a0, a0, 1 ; RV64IFD-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fabs: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: slli a0, a0, 1 +; RV64IZFINXZDINX-NEXT: srli a0, a0, 1 +; RV64IZFINXZDINX-NEXT: ret %1 = call double @llvm.fabs.f64(double %a) ret double %1 } @@ -110,6 +139,25 @@ ; RV32IFD-NEXT: addi sp, sp, 16 ; RV32IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcopysign_fneg: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fsgnjn.d a0, a0, a2 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; ; RV64I-LABEL: fcopysign_fneg: ; RV64I: # %bb.0: ; RV64I-NEXT: not a1, a1 @@ -130,6 +178,14 @@ ; RV64IFD-NEXT: fsgnj.d ft0, ft1, ft0 ; RV64IFD-NEXT: fmv.x.d a0, ft0 ; RV64IFD-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcopysign_fneg: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: li a2, -1 +; RV64IZFINXZDINX-NEXT: slli a2, a2, 63 +; RV64IZFINXZDINX-NEXT: xor a1, a1, a2 +; RV64IZFINXZDINX-NEXT: fsgnj.d a0, a0, a1 +; RV64IZFINXZDINX-NEXT: ret %1 = fneg double %b %2 = call double @llvm.copysign.f64(double %a, double %1) ret double %2 diff --git a/llvm/test/CodeGen/RISCV/double-br-fcmp.ll b/llvm/test/CodeGen/RISCV/double-br-fcmp.ll --- a/llvm/test/CodeGen/RISCV/double-br-fcmp.ll +++ b/llvm/test/CodeGen/RISCV/double-br-fcmp.ll @@ -3,6 +3,10 @@ ; RUN: -target-abi=ilp32d | FileCheck -check-prefix=RV32IFD %s ; RUN: llc -mtriple=riscv64 -mattr=+d -verify-machineinstrs < %s \ ; RUN: -target-abi=lp64d | FileCheck -check-prefix=RV64IFD %s +; RUN: llc -mtriple=riscv32 -mattr=+zdinx -verify-machineinstrs < %s \ +; RUN: -target-abi=ilp32 | FileCheck -check-prefix=RV32IZFINXZDINX %s +; RUN: llc -mtriple=riscv64 -mattr=+zdinx -verify-machineinstrs < %s \ +; RUN: -target-abi=lp64 | FileCheck -check-prefix=RV64IZFINXZDINX %s declare void @abort() declare void @exit(i32) @@ -29,6 +33,28 @@ ; RV64IFD-NEXT: addi sp, sp, -16 ; RV64IFD-NEXT: sd ra, 8(sp) # 8-byte Folded Spill ; RV64IFD-NEXT: call abort@plt +; +; RV32IZFINXZDINX-LABEL: br_fcmp_false: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: li a0, 1 +; RV32IZFINXZDINX-NEXT: bnez a0, .LBB0_2 +; RV32IZFINXZDINX-NEXT: # %bb.1: # %if.then +; RV32IZFINXZDINX-NEXT: ret +; RV32IZFINXZDINX-NEXT: .LBB0_2: # %if.else +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: call abort@plt +; +; RV64IZFINXZDINX-LABEL: br_fcmp_false: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: li a0, 1 +; RV64IZFINXZDINX-NEXT: bnez a0, .LBB0_2 +; RV64IZFINXZDINX-NEXT: # %bb.1: # %if.then +; RV64IZFINXZDINX-NEXT: ret +; RV64IZFINXZDINX-NEXT: .LBB0_2: # %if.else +; RV64IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV64IZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: call abort@plt %1 = fcmp false double %a, %b br i1 %1, label %if.then, label %if.else if.then: @@ -60,6 +86,38 @@ ; RV64IFD-NEXT: addi sp, sp, -16 ; RV64IFD-NEXT: sd ra, 8(sp) # 8-byte Folded Spill ; RV64IFD-NEXT: call abort@plt +; +; RV32IZFINXZDINX-LABEL: br_fcmp_oeq: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: sw a2, 0(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 4(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 0(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 4(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 0(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 4(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 0(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 4(sp) +; RV32IZFINXZDINX-NEXT: feq.d a0, a0, a2 +; RV32IZFINXZDINX-NEXT: bnez a0, .LBB1_2 +; RV32IZFINXZDINX-NEXT: # %bb.1: # %if.else +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; RV32IZFINXZDINX-NEXT: .LBB1_2: # %if.then +; RV32IZFINXZDINX-NEXT: call abort@plt +; +; RV64IZFINXZDINX-LABEL: br_fcmp_oeq: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: feq.d a0, a0, a1 +; RV64IZFINXZDINX-NEXT: bnez a0, .LBB1_2 +; RV64IZFINXZDINX-NEXT: # %bb.1: # %if.else +; RV64IZFINXZDINX-NEXT: ret +; RV64IZFINXZDINX-NEXT: .LBB1_2: # %if.then +; RV64IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV64IZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: call abort@plt %1 = fcmp oeq double %a, %b br i1 %1, label %if.then, label %if.else if.else: @@ -94,6 +152,38 @@ ; RV64IFD-NEXT: addi sp, sp, -16 ; RV64IFD-NEXT: sd ra, 8(sp) # 8-byte Folded Spill ; RV64IFD-NEXT: call abort@plt +; +; RV32IZFINXZDINX-LABEL: br_fcmp_oeq_alt: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: sw a2, 0(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 4(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 0(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 4(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 0(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 4(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 0(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 4(sp) +; RV32IZFINXZDINX-NEXT: feq.d a0, a0, a2 +; RV32IZFINXZDINX-NEXT: bnez a0, .LBB2_2 +; RV32IZFINXZDINX-NEXT: # %bb.1: # %if.else +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; RV32IZFINXZDINX-NEXT: .LBB2_2: # %if.then +; RV32IZFINXZDINX-NEXT: call abort@plt +; +; RV64IZFINXZDINX-LABEL: br_fcmp_oeq_alt: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: feq.d a0, a0, a1 +; RV64IZFINXZDINX-NEXT: bnez a0, .LBB2_2 +; RV64IZFINXZDINX-NEXT: # %bb.1: # %if.else +; RV64IZFINXZDINX-NEXT: ret +; RV64IZFINXZDINX-NEXT: .LBB2_2: # %if.then +; RV64IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV64IZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: call abort@plt %1 = fcmp oeq double %a, %b br i1 %1, label %if.then, label %if.else if.then: @@ -125,6 +215,38 @@ ; RV64IFD-NEXT: addi sp, sp, -16 ; RV64IFD-NEXT: sd ra, 8(sp) # 8-byte Folded Spill ; RV64IFD-NEXT: call abort@plt +; +; RV32IZFINXZDINX-LABEL: br_fcmp_ogt: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: sw a0, 0(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 4(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 0(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 4(sp) +; RV32IZFINXZDINX-NEXT: sw a2, 0(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 4(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 0(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 4(sp) +; RV32IZFINXZDINX-NEXT: flt.d a0, a2, a0 +; RV32IZFINXZDINX-NEXT: bnez a0, .LBB3_2 +; RV32IZFINXZDINX-NEXT: # %bb.1: # %if.else +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; RV32IZFINXZDINX-NEXT: .LBB3_2: # %if.then +; RV32IZFINXZDINX-NEXT: call abort@plt +; +; RV64IZFINXZDINX-LABEL: br_fcmp_ogt: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: flt.d a0, a1, a0 +; RV64IZFINXZDINX-NEXT: bnez a0, .LBB3_2 +; RV64IZFINXZDINX-NEXT: # %bb.1: # %if.else +; RV64IZFINXZDINX-NEXT: ret +; RV64IZFINXZDINX-NEXT: .LBB3_2: # %if.then +; RV64IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV64IZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: call abort@plt %1 = fcmp ogt double %a, %b br i1 %1, label %if.then, label %if.else if.else: @@ -156,6 +278,38 @@ ; RV64IFD-NEXT: addi sp, sp, -16 ; RV64IFD-NEXT: sd ra, 8(sp) # 8-byte Folded Spill ; RV64IFD-NEXT: call abort@plt +; +; RV32IZFINXZDINX-LABEL: br_fcmp_oge: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: sw a0, 0(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 4(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 0(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 4(sp) +; RV32IZFINXZDINX-NEXT: sw a2, 0(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 4(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 0(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 4(sp) +; RV32IZFINXZDINX-NEXT: fle.d a0, a2, a0 +; RV32IZFINXZDINX-NEXT: bnez a0, .LBB4_2 +; RV32IZFINXZDINX-NEXT: # %bb.1: # %if.else +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; RV32IZFINXZDINX-NEXT: .LBB4_2: # %if.then +; RV32IZFINXZDINX-NEXT: call abort@plt +; +; RV64IZFINXZDINX-LABEL: br_fcmp_oge: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fle.d a0, a1, a0 +; RV64IZFINXZDINX-NEXT: bnez a0, .LBB4_2 +; RV64IZFINXZDINX-NEXT: # %bb.1: # %if.else +; RV64IZFINXZDINX-NEXT: ret +; RV64IZFINXZDINX-NEXT: .LBB4_2: # %if.then +; RV64IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV64IZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: call abort@plt %1 = fcmp oge double %a, %b br i1 %1, label %if.then, label %if.else if.else: @@ -187,6 +341,38 @@ ; RV64IFD-NEXT: addi sp, sp, -16 ; RV64IFD-NEXT: sd ra, 8(sp) # 8-byte Folded Spill ; RV64IFD-NEXT: call abort@plt +; +; RV32IZFINXZDINX-LABEL: br_fcmp_olt: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: sw a2, 0(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 4(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 0(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 4(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 0(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 4(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 0(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 4(sp) +; RV32IZFINXZDINX-NEXT: flt.d a0, a0, a2 +; RV32IZFINXZDINX-NEXT: bnez a0, .LBB5_2 +; RV32IZFINXZDINX-NEXT: # %bb.1: # %if.else +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; RV32IZFINXZDINX-NEXT: .LBB5_2: # %if.then +; RV32IZFINXZDINX-NEXT: call abort@plt +; +; RV64IZFINXZDINX-LABEL: br_fcmp_olt: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: flt.d a0, a0, a1 +; RV64IZFINXZDINX-NEXT: bnez a0, .LBB5_2 +; RV64IZFINXZDINX-NEXT: # %bb.1: # %if.else +; RV64IZFINXZDINX-NEXT: ret +; RV64IZFINXZDINX-NEXT: .LBB5_2: # %if.then +; RV64IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV64IZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: call abort@plt %1 = fcmp olt double %a, %b br i1 %1, label %if.then, label %if.else if.else: @@ -218,6 +404,38 @@ ; RV64IFD-NEXT: addi sp, sp, -16 ; RV64IFD-NEXT: sd ra, 8(sp) # 8-byte Folded Spill ; RV64IFD-NEXT: call abort@plt +; +; RV32IZFINXZDINX-LABEL: br_fcmp_ole: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: sw a2, 0(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 4(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 0(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 4(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 0(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 4(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 0(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 4(sp) +; RV32IZFINXZDINX-NEXT: fle.d a0, a0, a2 +; RV32IZFINXZDINX-NEXT: bnez a0, .LBB6_2 +; RV32IZFINXZDINX-NEXT: # %bb.1: # %if.else +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; RV32IZFINXZDINX-NEXT: .LBB6_2: # %if.then +; RV32IZFINXZDINX-NEXT: call abort@plt +; +; RV64IZFINXZDINX-LABEL: br_fcmp_ole: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fle.d a0, a0, a1 +; RV64IZFINXZDINX-NEXT: bnez a0, .LBB6_2 +; RV64IZFINXZDINX-NEXT: # %bb.1: # %if.else +; RV64IZFINXZDINX-NEXT: ret +; RV64IZFINXZDINX-NEXT: .LBB6_2: # %if.then +; RV64IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV64IZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: call abort@plt %1 = fcmp ole double %a, %b br i1 %1, label %if.then, label %if.else if.else: @@ -253,6 +471,42 @@ ; RV64IFD-NEXT: addi sp, sp, -16 ; RV64IFD-NEXT: sd ra, 8(sp) # 8-byte Folded Spill ; RV64IFD-NEXT: call abort@plt +; +; RV32IZFINXZDINX-LABEL: br_fcmp_one: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: sw a2, 0(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 4(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 0(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 4(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 0(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 4(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 0(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 4(sp) +; RV32IZFINXZDINX-NEXT: flt.d a4, a0, a2 +; RV32IZFINXZDINX-NEXT: flt.d a0, a2, a0 +; RV32IZFINXZDINX-NEXT: or a0, a0, a4 +; RV32IZFINXZDINX-NEXT: bnez a0, .LBB7_2 +; RV32IZFINXZDINX-NEXT: # %bb.1: # %if.else +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; RV32IZFINXZDINX-NEXT: .LBB7_2: # %if.then +; RV32IZFINXZDINX-NEXT: call abort@plt +; +; RV64IZFINXZDINX-LABEL: br_fcmp_one: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: flt.d a2, a0, a1 +; RV64IZFINXZDINX-NEXT: flt.d a0, a1, a0 +; RV64IZFINXZDINX-NEXT: or a0, a0, a2 +; RV64IZFINXZDINX-NEXT: bnez a0, .LBB7_2 +; RV64IZFINXZDINX-NEXT: # %bb.1: # %if.else +; RV64IZFINXZDINX-NEXT: ret +; RV64IZFINXZDINX-NEXT: .LBB7_2: # %if.then +; RV64IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV64IZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: call abort@plt %1 = fcmp one double %a, %b br i1 %1, label %if.then, label %if.else if.else: @@ -288,6 +542,42 @@ ; RV64IFD-NEXT: addi sp, sp, -16 ; RV64IFD-NEXT: sd ra, 8(sp) # 8-byte Folded Spill ; RV64IFD-NEXT: call abort@plt +; +; RV32IZFINXZDINX-LABEL: br_fcmp_ord: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: sw a0, 0(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 4(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 0(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 4(sp) +; RV32IZFINXZDINX-NEXT: sw a2, 0(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 4(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 0(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 4(sp) +; RV32IZFINXZDINX-NEXT: feq.d a2, a2, a2 +; RV32IZFINXZDINX-NEXT: feq.d a0, a0, a0 +; RV32IZFINXZDINX-NEXT: and a0, a0, a2 +; RV32IZFINXZDINX-NEXT: bnez a0, .LBB8_2 +; RV32IZFINXZDINX-NEXT: # %bb.1: # %if.else +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; RV32IZFINXZDINX-NEXT: .LBB8_2: # %if.then +; RV32IZFINXZDINX-NEXT: call abort@plt +; +; RV64IZFINXZDINX-LABEL: br_fcmp_ord: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: feq.d a1, a1, a1 +; RV64IZFINXZDINX-NEXT: feq.d a0, a0, a0 +; RV64IZFINXZDINX-NEXT: and a0, a0, a1 +; RV64IZFINXZDINX-NEXT: bnez a0, .LBB8_2 +; RV64IZFINXZDINX-NEXT: # %bb.1: # %if.else +; RV64IZFINXZDINX-NEXT: ret +; RV64IZFINXZDINX-NEXT: .LBB8_2: # %if.then +; RV64IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV64IZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: call abort@plt %1 = fcmp ord double %a, %b br i1 %1, label %if.then, label %if.else if.else: @@ -323,6 +613,42 @@ ; RV64IFD-NEXT: addi sp, sp, -16 ; RV64IFD-NEXT: sd ra, 8(sp) # 8-byte Folded Spill ; RV64IFD-NEXT: call abort@plt +; +; RV32IZFINXZDINX-LABEL: br_fcmp_ueq: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: sw a2, 0(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 4(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 0(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 4(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 0(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 4(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 0(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 4(sp) +; RV32IZFINXZDINX-NEXT: flt.d a4, a0, a2 +; RV32IZFINXZDINX-NEXT: flt.d a0, a2, a0 +; RV32IZFINXZDINX-NEXT: or a0, a0, a4 +; RV32IZFINXZDINX-NEXT: beqz a0, .LBB9_2 +; RV32IZFINXZDINX-NEXT: # %bb.1: # %if.else +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; RV32IZFINXZDINX-NEXT: .LBB9_2: # %if.then +; RV32IZFINXZDINX-NEXT: call abort@plt +; +; RV64IZFINXZDINX-LABEL: br_fcmp_ueq: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: flt.d a2, a0, a1 +; RV64IZFINXZDINX-NEXT: flt.d a0, a1, a0 +; RV64IZFINXZDINX-NEXT: or a0, a0, a2 +; RV64IZFINXZDINX-NEXT: beqz a0, .LBB9_2 +; RV64IZFINXZDINX-NEXT: # %bb.1: # %if.else +; RV64IZFINXZDINX-NEXT: ret +; RV64IZFINXZDINX-NEXT: .LBB9_2: # %if.then +; RV64IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV64IZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: call abort@plt %1 = fcmp ueq double %a, %b br i1 %1, label %if.then, label %if.else if.else: @@ -354,6 +680,38 @@ ; RV64IFD-NEXT: addi sp, sp, -16 ; RV64IFD-NEXT: sd ra, 8(sp) # 8-byte Folded Spill ; RV64IFD-NEXT: call abort@plt +; +; RV32IZFINXZDINX-LABEL: br_fcmp_ugt: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: sw a2, 0(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 4(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 0(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 4(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 0(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 4(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 0(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 4(sp) +; RV32IZFINXZDINX-NEXT: fle.d a0, a0, a2 +; RV32IZFINXZDINX-NEXT: beqz a0, .LBB10_2 +; RV32IZFINXZDINX-NEXT: # %bb.1: # %if.else +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; RV32IZFINXZDINX-NEXT: .LBB10_2: # %if.then +; RV32IZFINXZDINX-NEXT: call abort@plt +; +; RV64IZFINXZDINX-LABEL: br_fcmp_ugt: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fle.d a0, a0, a1 +; RV64IZFINXZDINX-NEXT: beqz a0, .LBB10_2 +; RV64IZFINXZDINX-NEXT: # %bb.1: # %if.else +; RV64IZFINXZDINX-NEXT: ret +; RV64IZFINXZDINX-NEXT: .LBB10_2: # %if.then +; RV64IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV64IZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: call abort@plt %1 = fcmp ugt double %a, %b br i1 %1, label %if.then, label %if.else if.else: @@ -385,6 +743,38 @@ ; RV64IFD-NEXT: addi sp, sp, -16 ; RV64IFD-NEXT: sd ra, 8(sp) # 8-byte Folded Spill ; RV64IFD-NEXT: call abort@plt +; +; RV32IZFINXZDINX-LABEL: br_fcmp_uge: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: sw a2, 0(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 4(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 0(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 4(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 0(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 4(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 0(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 4(sp) +; RV32IZFINXZDINX-NEXT: flt.d a0, a0, a2 +; RV32IZFINXZDINX-NEXT: beqz a0, .LBB11_2 +; RV32IZFINXZDINX-NEXT: # %bb.1: # %if.else +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; RV32IZFINXZDINX-NEXT: .LBB11_2: # %if.then +; RV32IZFINXZDINX-NEXT: call abort@plt +; +; RV64IZFINXZDINX-LABEL: br_fcmp_uge: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: flt.d a0, a0, a1 +; RV64IZFINXZDINX-NEXT: beqz a0, .LBB11_2 +; RV64IZFINXZDINX-NEXT: # %bb.1: # %if.else +; RV64IZFINXZDINX-NEXT: ret +; RV64IZFINXZDINX-NEXT: .LBB11_2: # %if.then +; RV64IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV64IZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: call abort@plt %1 = fcmp uge double %a, %b br i1 %1, label %if.then, label %if.else if.else: @@ -416,6 +806,38 @@ ; RV64IFD-NEXT: addi sp, sp, -16 ; RV64IFD-NEXT: sd ra, 8(sp) # 8-byte Folded Spill ; RV64IFD-NEXT: call abort@plt +; +; RV32IZFINXZDINX-LABEL: br_fcmp_ult: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: sw a0, 0(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 4(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 0(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 4(sp) +; RV32IZFINXZDINX-NEXT: sw a2, 0(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 4(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 0(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 4(sp) +; RV32IZFINXZDINX-NEXT: fle.d a0, a2, a0 +; RV32IZFINXZDINX-NEXT: beqz a0, .LBB12_2 +; RV32IZFINXZDINX-NEXT: # %bb.1: # %if.else +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; RV32IZFINXZDINX-NEXT: .LBB12_2: # %if.then +; RV32IZFINXZDINX-NEXT: call abort@plt +; +; RV64IZFINXZDINX-LABEL: br_fcmp_ult: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fle.d a0, a1, a0 +; RV64IZFINXZDINX-NEXT: beqz a0, .LBB12_2 +; RV64IZFINXZDINX-NEXT: # %bb.1: # %if.else +; RV64IZFINXZDINX-NEXT: ret +; RV64IZFINXZDINX-NEXT: .LBB12_2: # %if.then +; RV64IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV64IZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: call abort@plt %1 = fcmp ult double %a, %b br i1 %1, label %if.then, label %if.else if.else: @@ -447,6 +869,38 @@ ; RV64IFD-NEXT: addi sp, sp, -16 ; RV64IFD-NEXT: sd ra, 8(sp) # 8-byte Folded Spill ; RV64IFD-NEXT: call abort@plt +; +; RV32IZFINXZDINX-LABEL: br_fcmp_ule: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: sw a0, 0(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 4(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 0(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 4(sp) +; RV32IZFINXZDINX-NEXT: sw a2, 0(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 4(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 0(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 4(sp) +; RV32IZFINXZDINX-NEXT: flt.d a0, a2, a0 +; RV32IZFINXZDINX-NEXT: beqz a0, .LBB13_2 +; RV32IZFINXZDINX-NEXT: # %bb.1: # %if.else +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; RV32IZFINXZDINX-NEXT: .LBB13_2: # %if.then +; RV32IZFINXZDINX-NEXT: call abort@plt +; +; RV64IZFINXZDINX-LABEL: br_fcmp_ule: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: flt.d a0, a1, a0 +; RV64IZFINXZDINX-NEXT: beqz a0, .LBB13_2 +; RV64IZFINXZDINX-NEXT: # %bb.1: # %if.else +; RV64IZFINXZDINX-NEXT: ret +; RV64IZFINXZDINX-NEXT: .LBB13_2: # %if.then +; RV64IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV64IZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: call abort@plt %1 = fcmp ule double %a, %b br i1 %1, label %if.then, label %if.else if.else: @@ -478,6 +932,38 @@ ; RV64IFD-NEXT: addi sp, sp, -16 ; RV64IFD-NEXT: sd ra, 8(sp) # 8-byte Folded Spill ; RV64IFD-NEXT: call abort@plt +; +; RV32IZFINXZDINX-LABEL: br_fcmp_une: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: sw a2, 0(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 4(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 0(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 4(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 0(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 4(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 0(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 4(sp) +; RV32IZFINXZDINX-NEXT: feq.d a0, a0, a2 +; RV32IZFINXZDINX-NEXT: beqz a0, .LBB14_2 +; RV32IZFINXZDINX-NEXT: # %bb.1: # %if.else +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; RV32IZFINXZDINX-NEXT: .LBB14_2: # %if.then +; RV32IZFINXZDINX-NEXT: call abort@plt +; +; RV64IZFINXZDINX-LABEL: br_fcmp_une: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: feq.d a0, a0, a1 +; RV64IZFINXZDINX-NEXT: beqz a0, .LBB14_2 +; RV64IZFINXZDINX-NEXT: # %bb.1: # %if.else +; RV64IZFINXZDINX-NEXT: ret +; RV64IZFINXZDINX-NEXT: .LBB14_2: # %if.then +; RV64IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV64IZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: call abort@plt %1 = fcmp une double %a, %b br i1 %1, label %if.then, label %if.else if.else: @@ -513,6 +999,42 @@ ; RV64IFD-NEXT: addi sp, sp, -16 ; RV64IFD-NEXT: sd ra, 8(sp) # 8-byte Folded Spill ; RV64IFD-NEXT: call abort@plt +; +; RV32IZFINXZDINX-LABEL: br_fcmp_uno: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: sw a0, 0(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 4(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 0(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 4(sp) +; RV32IZFINXZDINX-NEXT: sw a2, 0(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 4(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 0(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 4(sp) +; RV32IZFINXZDINX-NEXT: feq.d a2, a2, a2 +; RV32IZFINXZDINX-NEXT: feq.d a0, a0, a0 +; RV32IZFINXZDINX-NEXT: and a0, a0, a2 +; RV32IZFINXZDINX-NEXT: beqz a0, .LBB15_2 +; RV32IZFINXZDINX-NEXT: # %bb.1: # %if.else +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; RV32IZFINXZDINX-NEXT: .LBB15_2: # %if.then +; RV32IZFINXZDINX-NEXT: call abort@plt +; +; RV64IZFINXZDINX-LABEL: br_fcmp_uno: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: feq.d a1, a1, a1 +; RV64IZFINXZDINX-NEXT: feq.d a0, a0, a0 +; RV64IZFINXZDINX-NEXT: and a0, a0, a1 +; RV64IZFINXZDINX-NEXT: beqz a0, .LBB15_2 +; RV64IZFINXZDINX-NEXT: # %bb.1: # %if.else +; RV64IZFINXZDINX-NEXT: ret +; RV64IZFINXZDINX-NEXT: .LBB15_2: # %if.then +; RV64IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV64IZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: call abort@plt %1 = fcmp uno double %a, %b br i1 %1, label %if.then, label %if.else if.else: @@ -544,6 +1066,28 @@ ; RV64IFD-NEXT: addi sp, sp, -16 ; RV64IFD-NEXT: sd ra, 8(sp) # 8-byte Folded Spill ; RV64IFD-NEXT: call abort@plt +; +; RV32IZFINXZDINX-LABEL: br_fcmp_true: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: li a0, 1 +; RV32IZFINXZDINX-NEXT: bnez a0, .LBB16_2 +; RV32IZFINXZDINX-NEXT: # %bb.1: # %if.else +; RV32IZFINXZDINX-NEXT: ret +; RV32IZFINXZDINX-NEXT: .LBB16_2: # %if.then +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: call abort@plt +; +; RV64IZFINXZDINX-LABEL: br_fcmp_true: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: li a0, 1 +; RV64IZFINXZDINX-NEXT: bnez a0, .LBB16_2 +; RV64IZFINXZDINX-NEXT: # %bb.1: # %if.else +; RV64IZFINXZDINX-NEXT: ret +; RV64IZFINXZDINX-NEXT: .LBB16_2: # %if.then +; RV64IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV64IZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: call abort@plt %1 = fcmp true double %a, %b br i1 %1, label %if.then, label %if.else if.else: diff --git a/llvm/test/CodeGen/RISCV/double-calling-conv.ll b/llvm/test/CodeGen/RISCV/double-calling-conv.ll --- a/llvm/test/CodeGen/RISCV/double-calling-conv.ll +++ b/llvm/test/CodeGen/RISCV/double-calling-conv.ll @@ -1,6 +1,8 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py ; RUN: llc -mtriple=riscv32 -mattr=+d -target-abi=ilp32 -verify-machineinstrs < %s \ ; RUN: | FileCheck -check-prefix=RV32IFD %s +; RUN: llc -mtriple=riscv32 -mattr=+zdinx -target-abi=ilp32 -verify-machineinstrs < %s \ +; RUN: | FileCheck -check-prefix=RV32IZFINXZDINX %s ; Basic correctness checks for calling convention lowering for RV32D. This can ; be somewhat error-prone for soft-float RV32D due to the fact that f64 is legal @@ -23,6 +25,25 @@ ; RV32IFD-NEXT: lw a1, 12(sp) ; RV32IFD-NEXT: addi sp, sp, 16 ; RV32IFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: callee_double_inreg: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fadd.d a0, a0, a2 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret %1 = fadd double %a, %b ret double %1 } @@ -45,6 +66,22 @@ ; RV32IFD-NEXT: lw ra, 12(sp) # 4-byte Folded Reload ; RV32IFD-NEXT: addi sp, sp, 16 ; RV32IFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: caller_double_inreg: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: lui a0, 262236 +; RV32IZFINXZDINX-NEXT: addi a1, a0, 655 +; RV32IZFINXZDINX-NEXT: lui a0, 377487 +; RV32IZFINXZDINX-NEXT: addi a0, a0, 1475 +; RV32IZFINXZDINX-NEXT: lui a2, 262364 +; RV32IZFINXZDINX-NEXT: addi a3, a2, 655 +; RV32IZFINXZDINX-NEXT: mv a2, a0 +; RV32IZFINXZDINX-NEXT: call callee_double_inreg@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret %1 = call double @callee_double_inreg(double 2.720000e+00, double 3.720000e+00) ret double %1 } @@ -66,6 +103,26 @@ ; RV32IFD-NEXT: lw a1, 12(sp) ; RV32IFD-NEXT: addi sp, sp, 16 ; RV32IFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: callee_double_split_reg_stack: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: lw a0, 16(sp) +; RV32IZFINXZDINX-NEXT: sw a7, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a5, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a6, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: fadd.d a0, a2, a0 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret %1 = fadd double %d, %e ret double %1 } @@ -92,6 +149,28 @@ ; RV32IFD-NEXT: lw ra, 12(sp) # 4-byte Folded Reload ; RV32IFD-NEXT: addi sp, sp, 16 ; RV32IFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: caller_double_split_reg_stack: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: lui a0, 262510 +; RV32IZFINXZDINX-NEXT: addi a2, a0, 327 +; RV32IZFINXZDINX-NEXT: lui a0, 262446 +; RV32IZFINXZDINX-NEXT: addi a6, a0, 327 +; RV32IZFINXZDINX-NEXT: lui a0, 713032 +; RV32IZFINXZDINX-NEXT: addi a5, a0, -1311 +; RV32IZFINXZDINX-NEXT: li a0, 1 +; RV32IZFINXZDINX-NEXT: li a1, 2 +; RV32IZFINXZDINX-NEXT: li a3, 3 +; RV32IZFINXZDINX-NEXT: sw a2, 0(sp) +; RV32IZFINXZDINX-NEXT: li a2, 0 +; RV32IZFINXZDINX-NEXT: li a4, 0 +; RV32IZFINXZDINX-NEXT: mv a7, a5 +; RV32IZFINXZDINX-NEXT: call callee_double_split_reg_stack@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret %1 = call double @callee_double_split_reg_stack(i32 1, i64 2, i64 3, double 4.72, double 5.72) ret double %1 } @@ -108,6 +187,21 @@ ; RV32IFD-NEXT: lw a1, 12(sp) ; RV32IFD-NEXT: addi sp, sp, 16 ; RV32IFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: callee_double_stack: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: lw a0, 24(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 28(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 16(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 20(sp) +; RV32IZFINXZDINX-NEXT: fadd.d a0, a2, a0 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret %1 = fadd double %e, %f ret double %1 } @@ -139,6 +233,33 @@ ; RV32IFD-NEXT: lw ra, 28(sp) # 4-byte Folded Reload ; RV32IFD-NEXT: addi sp, sp, 32 ; RV32IFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: caller_double_stack: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -32 +; RV32IZFINXZDINX-NEXT: sw ra, 28(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: lui a0, 262510 +; RV32IZFINXZDINX-NEXT: addi a0, a0, 327 +; RV32IZFINXZDINX-NEXT: sw a0, 4(sp) +; RV32IZFINXZDINX-NEXT: lui a0, 713032 +; RV32IZFINXZDINX-NEXT: addi a1, a0, -1311 +; RV32IZFINXZDINX-NEXT: sw a1, 0(sp) +; RV32IZFINXZDINX-NEXT: lui a0, 262574 +; RV32IZFINXZDINX-NEXT: addi a0, a0, 327 +; RV32IZFINXZDINX-NEXT: sw a0, 12(sp) +; RV32IZFINXZDINX-NEXT: li a0, 1 +; RV32IZFINXZDINX-NEXT: li a2, 2 +; RV32IZFINXZDINX-NEXT: li a4, 3 +; RV32IZFINXZDINX-NEXT: li a6, 4 +; RV32IZFINXZDINX-NEXT: sw a1, 8(sp) +; RV32IZFINXZDINX-NEXT: li a1, 0 +; RV32IZFINXZDINX-NEXT: li a3, 0 +; RV32IZFINXZDINX-NEXT: li a5, 0 +; RV32IZFINXZDINX-NEXT: li a7, 0 +; RV32IZFINXZDINX-NEXT: call callee_double_stack@plt +; RV32IZFINXZDINX-NEXT: lw ra, 28(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 32 +; RV32IZFINXZDINX-NEXT: ret %1 = call double @callee_double_stack(i64 1, i64 2, i64 3, i64 4, double 5.72, double 6.72) ret double %1 } @@ -147,5 +268,9 @@ ; RV32IFD-LABEL: func_return_double_undef: ; RV32IFD: # %bb.0: ; RV32IFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: func_return_double_undef: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: ret ret double undef } diff --git a/llvm/test/CodeGen/RISCV/double-convert-strict.ll b/llvm/test/CodeGen/RISCV/double-convert-strict.ll --- a/llvm/test/CodeGen/RISCV/double-convert-strict.ll +++ b/llvm/test/CodeGen/RISCV/double-convert-strict.ll @@ -5,6 +5,12 @@ ; RUN: llc -mtriple=riscv64 -mattr=+d -verify-machineinstrs < %s \ ; RUN: -disable-strictnode-mutation -target-abi=lp64d \ ; RUN: | FileCheck -check-prefixes=CHECKIFD,RV64IFD %s +; RUN: llc -mtriple=riscv32 -mattr=+zdinx -verify-machineinstrs < %s \ +; RUN: -disable-strictnode-mutation -target-abi=ilp32 \ +; RUN: | FileCheck -check-prefix=RV32IZFINXZDINX %s +; RUN: llc -mtriple=riscv64 -mattr=+zdinx -verify-machineinstrs < %s \ +; RUN: -disable-strictnode-mutation -target-abi=lp64 \ +; RUN: | FileCheck -check-prefix=RV64IZFINXZDINX %s ; RUN: llc -mtriple=riscv32 -verify-machineinstrs < %s \ ; RUN: -disable-strictnode-mutation | FileCheck -check-prefix=RV32I %s ; RUN: llc -mtriple=riscv64 -verify-machineinstrs < %s \ @@ -20,6 +26,22 @@ ; CHECKIFD-NEXT: fcvt.s.d fa0, fa0 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcvt_s_d: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.s.d a0, a0 +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcvt_s_d: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.s.d a0, a0 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcvt_s_d: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -48,6 +70,22 @@ ; CHECKIFD-NEXT: fcvt.d.s fa0, fa0 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcvt_d_s: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: fcvt.d.s a0, a0 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcvt_d_s: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.d.s a0, a0 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcvt_d_s: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -76,6 +114,22 @@ ; CHECKIFD-NEXT: fcvt.w.d a0, fa0, rtz ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcvt_w_d: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.w.d a0, a0, rtz +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcvt_w_d: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.w.d a0, a0, rtz +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcvt_w_d: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -106,6 +160,22 @@ ; CHECKIFD-NEXT: fcvt.wu.d a0, fa0, rtz ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcvt_wu_d: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.wu.d a0, a0, rtz +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcvt_wu_d: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.wu.d a0, a0, rtz +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcvt_wu_d: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -141,6 +211,32 @@ ; CHECKIFD-NEXT: .LBB4_2: ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcvt_wu_d_multiple_use: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.wu.d a1, a0, rtz +; RV32IZFINXZDINX-NEXT: li a0, 1 +; RV32IZFINXZDINX-NEXT: beqz a1, .LBB4_2 +; RV32IZFINXZDINX-NEXT: # %bb.1: +; RV32IZFINXZDINX-NEXT: mv a0, a1 +; RV32IZFINXZDINX-NEXT: .LBB4_2: +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcvt_wu_d_multiple_use: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.wu.d a1, a0, rtz +; RV64IZFINXZDINX-NEXT: li a0, 1 +; RV64IZFINXZDINX-NEXT: beqz a1, .LBB4_2 +; RV64IZFINXZDINX-NEXT: # %bb.1: +; RV64IZFINXZDINX-NEXT: mv a0, a1 +; RV64IZFINXZDINX-NEXT: .LBB4_2: +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcvt_wu_d_multiple_use: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -182,6 +278,22 @@ ; CHECKIFD-NEXT: fcvt.d.w fa0, a0 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcvt_d_w: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: fcvt.d.w a0, a0 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcvt_d_w: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.d.w a0, a0 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcvt_d_w: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -212,6 +324,24 @@ ; CHECKIFD-NEXT: fcvt.d.w fa0, a0 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcvt_d_w_load: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: lw a0, 0(a0) +; RV32IZFINXZDINX-NEXT: fcvt.d.w a0, a0 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcvt_d_w_load: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: lw a0, 0(a0) +; RV64IZFINXZDINX-NEXT: fcvt.d.w a0, a0 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcvt_d_w_load: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -242,6 +372,22 @@ ; CHECKIFD-NEXT: fcvt.d.wu fa0, a0 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcvt_d_wu: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: fcvt.d.wu a0, a0 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcvt_d_wu: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.d.wu a0, a0 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcvt_d_wu: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -278,6 +424,24 @@ ; RV64IFD-NEXT: fcvt.d.wu fa0, a0 ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcvt_d_wu_load: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: lw a0, 0(a0) +; RV32IZFINXZDINX-NEXT: fcvt.d.wu a0, a0 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcvt_d_wu_load: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: lwu a0, 0(a0) +; RV64IZFINXZDINX-NEXT: fcvt.d.wu a0, a0 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcvt_d_wu_load: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -317,6 +481,20 @@ ; RV64IFD-NEXT: fcvt.l.d a0, fa0, rtz ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcvt_l_d: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: call __fixdfdi@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcvt_l_d: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.l.d a0, a0, rtz +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcvt_l_d: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -354,6 +532,20 @@ ; RV64IFD-NEXT: fcvt.lu.d a0, fa0, rtz ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcvt_lu_d: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: call __fixunsdfdi@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcvt_lu_d: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.lu.d a0, a0, rtz +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcvt_lu_d: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -391,6 +583,20 @@ ; RV64IFD-NEXT: fcvt.d.l fa0, a0 ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcvt_d_l: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: call __floatdidf@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcvt_d_l: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.d.l a0, a0 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcvt_d_l: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -428,6 +634,20 @@ ; RV64IFD-NEXT: fcvt.d.lu fa0, a0 ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcvt_d_lu: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: call __floatundidf@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcvt_d_lu: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.d.lu a0, a0 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcvt_d_lu: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -456,6 +676,22 @@ ; CHECKIFD-NEXT: fcvt.d.w fa0, a0 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcvt_d_w_i8: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: fcvt.d.w a0, a0 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcvt_d_w_i8: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.d.w a0, a0 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcvt_d_w_i8: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -484,6 +720,22 @@ ; CHECKIFD-NEXT: fcvt.d.wu fa0, a0 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcvt_d_wu_i8: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: fcvt.d.wu a0, a0 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcvt_d_wu_i8: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.d.wu a0, a0 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcvt_d_wu_i8: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -512,6 +764,22 @@ ; CHECKIFD-NEXT: fcvt.d.w fa0, a0 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcvt_d_w_i16: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: fcvt.d.w a0, a0 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcvt_d_w_i16: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.d.w a0, a0 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcvt_d_w_i16: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -540,6 +808,22 @@ ; CHECKIFD-NEXT: fcvt.d.wu fa0, a0 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcvt_d_wu_i16: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: fcvt.d.wu a0, a0 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcvt_d_wu_i16: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.d.wu a0, a0 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcvt_d_wu_i16: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -578,6 +862,23 @@ ; RV64IFD-NEXT: fsd ft0, 0(a1) ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcvt_d_w_demanded_bits: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi a0, a0, 1 +; RV32IZFINXZDINX-NEXT: fcvt.d.w a2, a0 +; RV32IZFINXZDINX-NEXT: sw a2, 0(a1) +; RV32IZFINXZDINX-NEXT: sw a3, 4(a1) +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcvt_d_w_demanded_bits: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: addiw a2, a0, 1 +; RV64IZFINXZDINX-NEXT: addi a0, a0, 1 +; RV64IZFINXZDINX-NEXT: fcvt.d.w a0, a0 +; RV64IZFINXZDINX-NEXT: sd a0, 0(a1) +; RV64IZFINXZDINX-NEXT: mv a0, a2 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcvt_d_w_demanded_bits: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -636,6 +937,21 @@ ; RV64IFD-NEXT: fsd ft0, 0(a1) ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcvt_d_wu_demanded_bits: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi a0, a0, 1 +; RV32IZFINXZDINX-NEXT: fcvt.d.wu a2, a0 +; RV32IZFINXZDINX-NEXT: sw a2, 0(a1) +; RV32IZFINXZDINX-NEXT: sw a3, 4(a1) +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcvt_d_wu_demanded_bits: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: addiw a0, a0, 1 +; RV64IZFINXZDINX-NEXT: fcvt.d.wu a2, a0 +; RV64IZFINXZDINX-NEXT: sd a2, 0(a1) +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcvt_d_wu_demanded_bits: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 diff --git a/llvm/test/CodeGen/RISCV/double-convert.ll b/llvm/test/CodeGen/RISCV/double-convert.ll --- a/llvm/test/CodeGen/RISCV/double-convert.ll +++ b/llvm/test/CodeGen/RISCV/double-convert.ll @@ -3,6 +3,10 @@ ; RUN: -target-abi=ilp32d | FileCheck -check-prefixes=CHECKIFD,RV32IFD %s ; RUN: llc -mtriple=riscv64 -mattr=+d -verify-machineinstrs < %s \ ; RUN: -target-abi=lp64d | FileCheck -check-prefixes=CHECKIFD,RV64IFD %s +; RUN: llc -mtriple=riscv32 -mattr=+zdinx -verify-machineinstrs < %s \ +; RUN: -target-abi=ilp32 | FileCheck -check-prefixes=RV32IZFINXZDINX %s +; RUN: llc -mtriple=riscv64 -mattr=+zdinx -verify-machineinstrs < %s \ +; RUN: -target-abi=lp64 | FileCheck -check-prefixes=RV64IZFINXZDINX %s ; RUN: llc -mtriple=riscv32 -verify-machineinstrs < %s \ ; RUN: | FileCheck -check-prefix=RV32I %s ; RUN: llc -mtriple=riscv64 -verify-machineinstrs < %s \ @@ -14,6 +18,22 @@ ; CHECKIFD-NEXT: fcvt.s.d fa0, fa0 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcvt_s_d: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.s.d a0, a0 +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcvt_s_d: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.s.d a0, a0 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcvt_s_d: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -41,6 +61,22 @@ ; CHECKIFD-NEXT: fcvt.d.s fa0, fa0 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcvt_d_s: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: fcvt.d.s a0, a0 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcvt_d_s: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.d.s a0, a0 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcvt_d_s: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -68,6 +104,22 @@ ; CHECKIFD-NEXT: fcvt.w.d a0, fa0, rtz ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcvt_w_d: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.w.d a0, a0, rtz +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcvt_w_d: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.w.d a0, a0, rtz +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcvt_w_d: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -99,6 +151,35 @@ ; CHECKIFD-NEXT: .LBB3_2: # %start ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcvt_w_d_sat: +; RV32IZFINXZDINX: # %bb.0: # %start +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: feq.d a2, a0, a0 +; RV32IZFINXZDINX-NEXT: bnez a2, .LBB3_2 +; RV32IZFINXZDINX-NEXT: # %bb.1: # %start +; RV32IZFINXZDINX-NEXT: li a0, 0 +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; RV32IZFINXZDINX-NEXT: .LBB3_2: +; RV32IZFINXZDINX-NEXT: fcvt.w.d a0, a0, rtz +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcvt_w_d_sat: +; RV64IZFINXZDINX: # %bb.0: # %start +; RV64IZFINXZDINX-NEXT: feq.d a1, a0, a0 +; RV64IZFINXZDINX-NEXT: bnez a1, .LBB3_2 +; RV64IZFINXZDINX-NEXT: # %bb.1: # %start +; RV64IZFINXZDINX-NEXT: li a0, 0 +; RV64IZFINXZDINX-NEXT: ret +; RV64IZFINXZDINX-NEXT: .LBB3_2: +; RV64IZFINXZDINX-NEXT: fcvt.w.d a0, a0, rtz +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcvt_w_d_sat: ; RV32I: # %bb.0: # %start ; RV32I-NEXT: addi sp, sp, -32 @@ -219,6 +300,22 @@ ; CHECKIFD-NEXT: fcvt.wu.d a0, fa0, rtz ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcvt_wu_d: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.wu.d a0, a0, rtz +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcvt_wu_d: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.wu.d a0, a0, rtz +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcvt_wu_d: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -253,6 +350,32 @@ ; CHECKIFD-NEXT: .LBB5_2: ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcvt_wu_d_multiple_use: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.wu.d a1, a0, rtz +; RV32IZFINXZDINX-NEXT: li a0, 1 +; RV32IZFINXZDINX-NEXT: beqz a1, .LBB5_2 +; RV32IZFINXZDINX-NEXT: # %bb.1: +; RV32IZFINXZDINX-NEXT: mv a0, a1 +; RV32IZFINXZDINX-NEXT: .LBB5_2: +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcvt_wu_d_multiple_use: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.wu.d a1, a0, rtz +; RV64IZFINXZDINX-NEXT: li a0, 1 +; RV64IZFINXZDINX-NEXT: beqz a1, .LBB5_2 +; RV64IZFINXZDINX-NEXT: # %bb.1: +; RV64IZFINXZDINX-NEXT: mv a0, a1 +; RV64IZFINXZDINX-NEXT: .LBB5_2: +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcvt_wu_d_multiple_use: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -309,6 +432,37 @@ ; RV64IFD-NEXT: .LBB6_2: # %start ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcvt_wu_d_sat: +; RV32IZFINXZDINX: # %bb.0: # %start +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: feq.d a2, a0, a0 +; RV32IZFINXZDINX-NEXT: bnez a2, .LBB6_2 +; RV32IZFINXZDINX-NEXT: # %bb.1: # %start +; RV32IZFINXZDINX-NEXT: li a0, 0 +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; RV32IZFINXZDINX-NEXT: .LBB6_2: +; RV32IZFINXZDINX-NEXT: fcvt.wu.d a0, a0, rtz +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcvt_wu_d_sat: +; RV64IZFINXZDINX: # %bb.0: # %start +; RV64IZFINXZDINX-NEXT: feq.d a1, a0, a0 +; RV64IZFINXZDINX-NEXT: bnez a1, .LBB6_2 +; RV64IZFINXZDINX-NEXT: # %bb.1: # %start +; RV64IZFINXZDINX-NEXT: li a0, 0 +; RV64IZFINXZDINX-NEXT: ret +; RV64IZFINXZDINX-NEXT: .LBB6_2: +; RV64IZFINXZDINX-NEXT: fcvt.wu.d a0, a0, rtz +; RV64IZFINXZDINX-NEXT: slli a0, a0, 32 +; RV64IZFINXZDINX-NEXT: srli a0, a0, 32 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcvt_wu_d_sat: ; RV32I: # %bb.0: # %start ; RV32I-NEXT: addi sp, sp, -32 @@ -396,6 +550,22 @@ ; CHECKIFD-NEXT: fcvt.d.w fa0, a0 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcvt_d_w: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: fcvt.d.w a0, a0 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcvt_d_w: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.d.w a0, a0 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcvt_d_w: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -425,6 +595,24 @@ ; CHECKIFD-NEXT: fcvt.d.w fa0, a0 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcvt_d_w_load: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: lw a0, 0(a0) +; RV32IZFINXZDINX-NEXT: fcvt.d.w a0, a0 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcvt_d_w_load: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: lw a0, 0(a0) +; RV64IZFINXZDINX-NEXT: fcvt.d.w a0, a0 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcvt_d_w_load: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -455,6 +643,22 @@ ; CHECKIFD-NEXT: fcvt.d.wu fa0, a0 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcvt_d_wu: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: fcvt.d.wu a0, a0 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcvt_d_wu: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.d.wu a0, a0 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcvt_d_wu: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -490,6 +694,24 @@ ; RV64IFD-NEXT: fcvt.d.wu fa0, a0 ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcvt_d_wu_load: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: lw a0, 0(a0) +; RV32IZFINXZDINX-NEXT: fcvt.d.wu a0, a0 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcvt_d_wu_load: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: lwu a0, 0(a0) +; RV64IZFINXZDINX-NEXT: fcvt.d.wu a0, a0 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcvt_d_wu_load: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -529,6 +751,20 @@ ; RV64IFD-NEXT: fcvt.l.d a0, fa0, rtz ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcvt_l_d: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: call __fixdfdi@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcvt_l_d: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.l.d a0, a0, rtz +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcvt_l_d: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -602,6 +838,64 @@ ; RV64IFD-NEXT: .LBB12_2: # %start ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcvt_l_d_sat: +; RV32IZFINXZDINX: # %bb.0: # %start +; RV32IZFINXZDINX-NEXT: addi sp, sp, -32 +; RV32IZFINXZDINX-NEXT: sw ra, 28(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: sw a0, 16(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 20(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 16(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 20(sp) +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: call __fixdfdi@plt +; RV32IZFINXZDINX-NEXT: lw t1, 8(sp) +; RV32IZFINXZDINX-NEXT: lw t2, 12(sp) +; RV32IZFINXZDINX-NEXT: lui a2, %hi(.LCPI12_0) +; RV32IZFINXZDINX-NEXT: lw a2, %lo(.LCPI12_0)(a2) +; RV32IZFINXZDINX-NEXT: lw a3, %lo(.LCPI12_0+4)(a2) +; RV32IZFINXZDINX-NEXT: fle.d a2, a2, t1 +; RV32IZFINXZDINX-NEXT: lui a4, 524288 +; RV32IZFINXZDINX-NEXT: bnez a2, .LBB12_2 +; RV32IZFINXZDINX-NEXT: # %bb.1: # %start +; RV32IZFINXZDINX-NEXT: lui a1, 524288 +; RV32IZFINXZDINX-NEXT: .LBB12_2: # %start +; RV32IZFINXZDINX-NEXT: lui a3, %hi(.LCPI12_1) +; RV32IZFINXZDINX-NEXT: lw a6, %lo(.LCPI12_1)(a3) +; RV32IZFINXZDINX-NEXT: lw a7, %lo(.LCPI12_1+4)(a3) +; RV32IZFINXZDINX-NEXT: flt.d a3, a6, t1 +; RV32IZFINXZDINX-NEXT: beqz a3, .LBB12_4 +; RV32IZFINXZDINX-NEXT: # %bb.3: +; RV32IZFINXZDINX-NEXT: addi a1, a4, -1 +; RV32IZFINXZDINX-NEXT: .LBB12_4: # %start +; RV32IZFINXZDINX-NEXT: feq.d a4, t1, t1 +; RV32IZFINXZDINX-NEXT: bnez a4, .LBB12_6 +; RV32IZFINXZDINX-NEXT: # %bb.5: # %start +; RV32IZFINXZDINX-NEXT: li a1, 0 +; RV32IZFINXZDINX-NEXT: li a0, 0 +; RV32IZFINXZDINX-NEXT: j .LBB12_7 +; RV32IZFINXZDINX-NEXT: .LBB12_6: +; RV32IZFINXZDINX-NEXT: neg a2, a2 +; RV32IZFINXZDINX-NEXT: and a0, a2, a0 +; RV32IZFINXZDINX-NEXT: seqz a2, a3 +; RV32IZFINXZDINX-NEXT: addi a2, a2, -1 +; RV32IZFINXZDINX-NEXT: or a0, a0, a2 +; RV32IZFINXZDINX-NEXT: .LBB12_7: # %start +; RV32IZFINXZDINX-NEXT: lw ra, 28(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 32 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcvt_l_d_sat: +; RV64IZFINXZDINX: # %bb.0: # %start +; RV64IZFINXZDINX-NEXT: feq.d a1, a0, a0 +; RV64IZFINXZDINX-NEXT: bnez a1, .LBB12_2 +; RV64IZFINXZDINX-NEXT: # %bb.1: # %start +; RV64IZFINXZDINX-NEXT: li a0, 0 +; RV64IZFINXZDINX-NEXT: ret +; RV64IZFINXZDINX-NEXT: .LBB12_2: +; RV64IZFINXZDINX-NEXT: fcvt.l.d a0, a0, rtz +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcvt_l_d_sat: ; RV32I: # %bb.0: # %start ; RV32I-NEXT: addi sp, sp, -32 @@ -760,6 +1054,20 @@ ; RV64IFD-NEXT: fcvt.lu.d a0, fa0, rtz ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcvt_lu_d: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: call __fixunsdfdi@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcvt_lu_d: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.lu.d a0, a0, rtz +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcvt_lu_d: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -817,6 +1125,47 @@ ; RV64IFD-NEXT: .LBB14_2: # %start ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcvt_lu_d_sat: +; RV32IZFINXZDINX: # %bb.0: # %start +; RV32IZFINXZDINX-NEXT: addi sp, sp, -32 +; RV32IZFINXZDINX-NEXT: sw ra, 28(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: sw a0, 16(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 20(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 16(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 20(sp) +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: call __fixunsdfdi@plt +; RV32IZFINXZDINX-NEXT: fcvt.d.w a2, zero +; RV32IZFINXZDINX-NEXT: lui a4, %hi(.LCPI14_0) +; RV32IZFINXZDINX-NEXT: lw a4, %lo(.LCPI14_0)(a4) +; RV32IZFINXZDINX-NEXT: lw a5, %lo(.LCPI14_0+4)(a4) +; RV32IZFINXZDINX-NEXT: lw a6, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a7, 12(sp) +; RV32IZFINXZDINX-NEXT: fle.d a2, a2, a6 +; RV32IZFINXZDINX-NEXT: neg a2, a2 +; RV32IZFINXZDINX-NEXT: and a0, a2, a0 +; RV32IZFINXZDINX-NEXT: flt.d a3, a4, a6 +; RV32IZFINXZDINX-NEXT: seqz a3, a3 +; RV32IZFINXZDINX-NEXT: addi a3, a3, -1 +; RV32IZFINXZDINX-NEXT: or a0, a0, a3 +; RV32IZFINXZDINX-NEXT: and a1, a2, a1 +; RV32IZFINXZDINX-NEXT: or a1, a1, a3 +; RV32IZFINXZDINX-NEXT: lw ra, 28(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 32 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcvt_lu_d_sat: +; RV64IZFINXZDINX: # %bb.0: # %start +; RV64IZFINXZDINX-NEXT: feq.d a1, a0, a0 +; RV64IZFINXZDINX-NEXT: bnez a1, .LBB14_2 +; RV64IZFINXZDINX-NEXT: # %bb.1: # %start +; RV64IZFINXZDINX-NEXT: li a0, 0 +; RV64IZFINXZDINX-NEXT: ret +; RV64IZFINXZDINX-NEXT: .LBB14_2: +; RV64IZFINXZDINX-NEXT: fcvt.lu.d a0, a0, rtz +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcvt_lu_d_sat: ; RV32I: # %bb.0: # %start ; RV32I-NEXT: addi sp, sp, -32 @@ -934,6 +1283,30 @@ ; RV64IFD-NEXT: fmv.x.d a0, ft0 ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fmv_x_d: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a2, 0(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 4(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 0(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 4(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 0(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 4(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 0(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 4(sp) +; RV32IZFINXZDINX-NEXT: fadd.d a0, a0, a2 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fmv_x_d: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fadd.d a0, a0, a1 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fmv_x_d: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -971,6 +1344,20 @@ ; RV64IFD-NEXT: fcvt.d.l fa0, a0 ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcvt_d_l: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: call __floatdidf@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcvt_d_l: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.d.l a0, a0 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcvt_d_l: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -1007,6 +1394,20 @@ ; RV64IFD-NEXT: fcvt.d.lu fa0, a0 ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcvt_d_lu: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: call __floatundidf@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcvt_d_lu: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.d.lu a0, a0 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcvt_d_lu: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -1050,6 +1451,30 @@ ; RV64IFD-NEXT: fadd.d fa0, ft0, ft1 ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fmv_d_x: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -32 +; RV32IZFINXZDINX-NEXT: sw a3, 20(sp) +; RV32IZFINXZDINX-NEXT: sw a2, 16(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 28(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 24(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 16(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 20(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 24(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 28(sp) +; RV32IZFINXZDINX-NEXT: fadd.d a0, a2, a0 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 32 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fmv_d_x: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fadd.d a0, a0, a1 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fmv_d_x: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -1079,6 +1504,22 @@ ; CHECKIFD-NEXT: fcvt.d.w fa0, a0 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcvt_d_w_i8: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: fcvt.d.w a0, a0 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcvt_d_w_i8: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.d.w a0, a0 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcvt_d_w_i8: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -1106,6 +1547,22 @@ ; CHECKIFD-NEXT: fcvt.d.wu fa0, a0 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcvt_d_wu_i8: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: fcvt.d.wu a0, a0 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcvt_d_wu_i8: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.d.wu a0, a0 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcvt_d_wu_i8: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -1133,6 +1590,22 @@ ; CHECKIFD-NEXT: fcvt.d.w fa0, a0 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcvt_d_w_i16: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: fcvt.d.w a0, a0 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcvt_d_w_i16: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.d.w a0, a0 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcvt_d_w_i16: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -1160,6 +1633,22 @@ ; CHECKIFD-NEXT: fcvt.d.wu fa0, a0 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcvt_d_wu_i16: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: fcvt.d.wu a0, a0 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcvt_d_wu_i16: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.d.wu a0, a0 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcvt_d_wu_i16: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -1197,6 +1686,23 @@ ; RV64IFD-NEXT: fsd ft0, 0(a1) ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcvt_d_w_demanded_bits: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi a0, a0, 1 +; RV32IZFINXZDINX-NEXT: fcvt.d.w a2, a0 +; RV32IZFINXZDINX-NEXT: sw a2, 0(a1) +; RV32IZFINXZDINX-NEXT: sw a3, 4(a1) +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcvt_d_w_demanded_bits: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: addiw a2, a0, 1 +; RV64IZFINXZDINX-NEXT: addi a0, a0, 1 +; RV64IZFINXZDINX-NEXT: fcvt.d.w a0, a0 +; RV64IZFINXZDINX-NEXT: sd a0, 0(a1) +; RV64IZFINXZDINX-NEXT: mv a0, a2 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcvt_d_w_demanded_bits: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -1255,6 +1761,21 @@ ; RV64IFD-NEXT: fsd ft0, 0(a1) ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcvt_d_wu_demanded_bits: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi a0, a0, 1 +; RV32IZFINXZDINX-NEXT: fcvt.d.wu a2, a0 +; RV32IZFINXZDINX-NEXT: sw a2, 0(a1) +; RV32IZFINXZDINX-NEXT: sw a3, 4(a1) +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcvt_d_wu_demanded_bits: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: addiw a0, a0, 1 +; RV64IZFINXZDINX-NEXT: fcvt.d.wu a2, a0 +; RV64IZFINXZDINX-NEXT: sd a2, 0(a1) +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcvt_d_wu_demanded_bits: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -1308,6 +1829,22 @@ ; RV64IFD-NEXT: fcvt.l.d a0, fa0, rtz ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcvt_w_s_i16: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.w.d a0, a0, rtz +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcvt_w_s_i16: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.l.d a0, a0, rtz +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcvt_w_s_i16: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -1360,6 +1897,51 @@ ; RV64IFD-NEXT: .LBB26_2: # %start ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcvt_w_s_sat_i16: +; RV32IZFINXZDINX: # %bb.0: # %start +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: feq.d a2, a0, a0 +; RV32IZFINXZDINX-NEXT: bnez a2, .LBB26_2 +; RV32IZFINXZDINX-NEXT: # %bb.1: # %start +; RV32IZFINXZDINX-NEXT: li a0, 0 +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; RV32IZFINXZDINX-NEXT: .LBB26_2: +; RV32IZFINXZDINX-NEXT: lui a2, %hi(.LCPI26_0) +; RV32IZFINXZDINX-NEXT: lw a2, %lo(.LCPI26_0)(a2) +; RV32IZFINXZDINX-NEXT: lw a3, %lo(.LCPI26_0+4)(a2) +; RV32IZFINXZDINX-NEXT: lui a4, %hi(.LCPI26_1) +; RV32IZFINXZDINX-NEXT: lw a4, %lo(.LCPI26_1)(a4) +; RV32IZFINXZDINX-NEXT: lw a5, %lo(.LCPI26_1+4)(a4) +; RV32IZFINXZDINX-NEXT: fmax.d a0, a0, a2 +; RV32IZFINXZDINX-NEXT: fmin.d a0, a0, a4 +; RV32IZFINXZDINX-NEXT: fcvt.w.d a0, a0, rtz +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcvt_w_s_sat_i16: +; RV64IZFINXZDINX: # %bb.0: # %start +; RV64IZFINXZDINX-NEXT: feq.d a1, a0, a0 +; RV64IZFINXZDINX-NEXT: bnez a1, .LBB26_2 +; RV64IZFINXZDINX-NEXT: # %bb.1: # %start +; RV64IZFINXZDINX-NEXT: li a0, 0 +; RV64IZFINXZDINX-NEXT: ret +; RV64IZFINXZDINX-NEXT: .LBB26_2: +; RV64IZFINXZDINX-NEXT: lui a1, %hi(.LCPI26_0) +; RV64IZFINXZDINX-NEXT: addi a1, a1, %lo(.LCPI26_0) +; RV64IZFINXZDINX-NEXT: ld a1, 0(a1) +; RV64IZFINXZDINX-NEXT: lui a2, %hi(.LCPI26_1) +; RV64IZFINXZDINX-NEXT: addi a2, a2, %lo(.LCPI26_1) +; RV64IZFINXZDINX-NEXT: ld a2, 0(a2) +; RV64IZFINXZDINX-NEXT: fmax.d a0, a0, a1 +; RV64IZFINXZDINX-NEXT: fmin.d a0, a0, a2 +; RV64IZFINXZDINX-NEXT: fcvt.l.d a0, a0, rtz +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcvt_w_s_sat_i16: ; RV32I: # %bb.0: # %start ; RV32I-NEXT: addi sp, sp, -32 @@ -1482,6 +2064,22 @@ ; RV64IFD-NEXT: fcvt.lu.d a0, fa0, rtz ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcvt_wu_s_i16: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.wu.d a0, a0, rtz +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcvt_wu_s_i16: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.lu.d a0, a0, rtz +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcvt_wu_s_i16: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -1524,6 +2122,33 @@ ; RV64IFD-NEXT: fcvt.lu.d a0, ft0, rtz ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcvt_wu_s_sat_i16: +; RV32IZFINXZDINX: # %bb.0: # %start +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lui a2, %hi(.LCPI28_0) +; RV32IZFINXZDINX-NEXT: lw a2, %lo(.LCPI28_0)(a2) +; RV32IZFINXZDINX-NEXT: lw a3, %lo(.LCPI28_0+4)(a2) +; RV32IZFINXZDINX-NEXT: fcvt.d.w a4, zero +; RV32IZFINXZDINX-NEXT: fmax.d a0, a0, a4 +; RV32IZFINXZDINX-NEXT: fmin.d a0, a0, a2 +; RV32IZFINXZDINX-NEXT: fcvt.wu.d a0, a0, rtz +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcvt_wu_s_sat_i16: +; RV64IZFINXZDINX: # %bb.0: # %start +; RV64IZFINXZDINX-NEXT: lui a1, %hi(.LCPI28_0) +; RV64IZFINXZDINX-NEXT: addi a1, a1, %lo(.LCPI28_0) +; RV64IZFINXZDINX-NEXT: ld a1, 0(a1) +; RV64IZFINXZDINX-NEXT: fmax.d a0, a0, zero +; RV64IZFINXZDINX-NEXT: fmin.d a0, a0, a1 +; RV64IZFINXZDINX-NEXT: fcvt.lu.d a0, a0, rtz +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcvt_wu_s_sat_i16: ; RV32I: # %bb.0: # %start ; RV32I-NEXT: addi sp, sp, -32 @@ -1624,6 +2249,22 @@ ; RV64IFD-NEXT: fcvt.l.d a0, fa0, rtz ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcvt_w_s_i8: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.w.d a0, a0, rtz +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcvt_w_s_i8: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.l.d a0, a0, rtz +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcvt_w_s_i8: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -1676,6 +2317,51 @@ ; RV64IFD-NEXT: .LBB30_2: # %start ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcvt_w_s_sat_i8: +; RV32IZFINXZDINX: # %bb.0: # %start +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: feq.d a2, a0, a0 +; RV32IZFINXZDINX-NEXT: bnez a2, .LBB30_2 +; RV32IZFINXZDINX-NEXT: # %bb.1: # %start +; RV32IZFINXZDINX-NEXT: li a0, 0 +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; RV32IZFINXZDINX-NEXT: .LBB30_2: +; RV32IZFINXZDINX-NEXT: lui a2, %hi(.LCPI30_0) +; RV32IZFINXZDINX-NEXT: lw a2, %lo(.LCPI30_0)(a2) +; RV32IZFINXZDINX-NEXT: lw a3, %lo(.LCPI30_0+4)(a2) +; RV32IZFINXZDINX-NEXT: lui a4, %hi(.LCPI30_1) +; RV32IZFINXZDINX-NEXT: lw a4, %lo(.LCPI30_1)(a4) +; RV32IZFINXZDINX-NEXT: lw a5, %lo(.LCPI30_1+4)(a4) +; RV32IZFINXZDINX-NEXT: fmax.d a0, a0, a2 +; RV32IZFINXZDINX-NEXT: fmin.d a0, a0, a4 +; RV32IZFINXZDINX-NEXT: fcvt.w.d a0, a0, rtz +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcvt_w_s_sat_i8: +; RV64IZFINXZDINX: # %bb.0: # %start +; RV64IZFINXZDINX-NEXT: feq.d a1, a0, a0 +; RV64IZFINXZDINX-NEXT: bnez a1, .LBB30_2 +; RV64IZFINXZDINX-NEXT: # %bb.1: # %start +; RV64IZFINXZDINX-NEXT: li a0, 0 +; RV64IZFINXZDINX-NEXT: ret +; RV64IZFINXZDINX-NEXT: .LBB30_2: +; RV64IZFINXZDINX-NEXT: lui a1, %hi(.LCPI30_0) +; RV64IZFINXZDINX-NEXT: addi a1, a1, %lo(.LCPI30_0) +; RV64IZFINXZDINX-NEXT: ld a1, 0(a1) +; RV64IZFINXZDINX-NEXT: lui a2, %hi(.LCPI30_1) +; RV64IZFINXZDINX-NEXT: addi a2, a2, %lo(.LCPI30_1) +; RV64IZFINXZDINX-NEXT: ld a2, 0(a2) +; RV64IZFINXZDINX-NEXT: fmax.d a0, a0, a1 +; RV64IZFINXZDINX-NEXT: fmin.d a0, a0, a2 +; RV64IZFINXZDINX-NEXT: fcvt.l.d a0, a0, rtz +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcvt_w_s_sat_i8: ; RV32I: # %bb.0: # %start ; RV32I-NEXT: addi sp, sp, -32 @@ -1795,6 +2481,22 @@ ; RV64IFD-NEXT: fcvt.lu.d a0, fa0, rtz ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcvt_wu_s_i8: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.wu.d a0, a0, rtz +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcvt_wu_s_i8: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.lu.d a0, a0, rtz +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcvt_wu_s_i8: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -1839,6 +2541,33 @@ ; RV64IFD-NEXT: fcvt.lu.d a0, ft0, rtz ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcvt_wu_s_sat_i8: +; RV32IZFINXZDINX: # %bb.0: # %start +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lui a2, %hi(.LCPI32_0) +; RV32IZFINXZDINX-NEXT: lw a2, %lo(.LCPI32_0)(a2) +; RV32IZFINXZDINX-NEXT: lw a3, %lo(.LCPI32_0+4)(a2) +; RV32IZFINXZDINX-NEXT: fcvt.d.w a4, zero +; RV32IZFINXZDINX-NEXT: fmax.d a0, a0, a4 +; RV32IZFINXZDINX-NEXT: fmin.d a0, a0, a2 +; RV32IZFINXZDINX-NEXT: fcvt.wu.d a0, a0, rtz +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcvt_wu_s_sat_i8: +; RV64IZFINXZDINX: # %bb.0: # %start +; RV64IZFINXZDINX-NEXT: lui a1, %hi(.LCPI32_0) +; RV64IZFINXZDINX-NEXT: addi a1, a1, %lo(.LCPI32_0) +; RV64IZFINXZDINX-NEXT: ld a1, 0(a1) +; RV64IZFINXZDINX-NEXT: fmax.d a0, a0, zero +; RV64IZFINXZDINX-NEXT: fmin.d a0, a0, a1 +; RV64IZFINXZDINX-NEXT: fcvt.lu.d a0, a0, rtz +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcvt_wu_s_sat_i8: ; RV32I: # %bb.0: # %start ; RV32I-NEXT: addi sp, sp, -32 @@ -1942,6 +2671,37 @@ ; RV64IFD-NEXT: .LBB33_2: # %start ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcvt_wu_d_sat_zext: +; RV32IZFINXZDINX: # %bb.0: # %start +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: feq.d a2, a0, a0 +; RV32IZFINXZDINX-NEXT: bnez a2, .LBB33_2 +; RV32IZFINXZDINX-NEXT: # %bb.1: # %start +; RV32IZFINXZDINX-NEXT: li a0, 0 +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; RV32IZFINXZDINX-NEXT: .LBB33_2: +; RV32IZFINXZDINX-NEXT: fcvt.wu.d a0, a0, rtz +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcvt_wu_d_sat_zext: +; RV64IZFINXZDINX: # %bb.0: # %start +; RV64IZFINXZDINX-NEXT: feq.d a1, a0, a0 +; RV64IZFINXZDINX-NEXT: bnez a1, .LBB33_2 +; RV64IZFINXZDINX-NEXT: # %bb.1: # %start +; RV64IZFINXZDINX-NEXT: li a0, 0 +; RV64IZFINXZDINX-NEXT: ret +; RV64IZFINXZDINX-NEXT: .LBB33_2: +; RV64IZFINXZDINX-NEXT: fcvt.wu.d a0, a0, rtz +; RV64IZFINXZDINX-NEXT: slli a0, a0, 32 +; RV64IZFINXZDINX-NEXT: srli a0, a0, 32 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcvt_wu_d_sat_zext: ; RV32I: # %bb.0: # %start ; RV32I-NEXT: addi sp, sp, -32 @@ -2033,6 +2793,35 @@ ; CHECKIFD-NEXT: .LBB34_2: # %start ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcvt_w_d_sat_sext: +; RV32IZFINXZDINX: # %bb.0: # %start +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: feq.d a2, a0, a0 +; RV32IZFINXZDINX-NEXT: bnez a2, .LBB34_2 +; RV32IZFINXZDINX-NEXT: # %bb.1: # %start +; RV32IZFINXZDINX-NEXT: li a0, 0 +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; RV32IZFINXZDINX-NEXT: .LBB34_2: +; RV32IZFINXZDINX-NEXT: fcvt.w.d a0, a0, rtz +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcvt_w_d_sat_sext: +; RV64IZFINXZDINX: # %bb.0: # %start +; RV64IZFINXZDINX-NEXT: feq.d a1, a0, a0 +; RV64IZFINXZDINX-NEXT: bnez a1, .LBB34_2 +; RV64IZFINXZDINX-NEXT: # %bb.1: # %start +; RV64IZFINXZDINX-NEXT: li a0, 0 +; RV64IZFINXZDINX-NEXT: ret +; RV64IZFINXZDINX-NEXT: .LBB34_2: +; RV64IZFINXZDINX-NEXT: fcvt.w.d a0, a0, rtz +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcvt_w_d_sat_sext: ; RV32I: # %bb.0: # %start ; RV32I-NEXT: addi sp, sp, -32 diff --git a/llvm/test/CodeGen/RISCV/double-fcmp-strict.ll b/llvm/test/CodeGen/RISCV/double-fcmp-strict.ll --- a/llvm/test/CodeGen/RISCV/double-fcmp-strict.ll +++ b/llvm/test/CodeGen/RISCV/double-fcmp-strict.ll @@ -5,6 +5,12 @@ ; RUN: llc -mtriple=riscv64 -mattr=+d -verify-machineinstrs < %s \ ; RUN: -disable-strictnode-mutation -target-abi=lp64d \ ; RUN: | FileCheck -check-prefix=CHECKIFD %s +; RUN: llc -mtriple=riscv32 -mattr=+zdinx -verify-machineinstrs < %s \ +; RUN: -disable-strictnode-mutation -target-abi=ilp32 \ +; RUN: | FileCheck -check-prefix=RV32IZFINXZDINX %s +; RUN: llc -mtriple=riscv64 -mattr=+zdinx -verify-machineinstrs < %s \ +; RUN: -disable-strictnode-mutation -target-abi=lp64 \ +; RUN: | FileCheck -check-prefix=RV64IZFINXZDINX %s ; RUN: llc -mtriple=riscv32 -verify-machineinstrs < %s \ ; RUN: -disable-strictnode-mutation | FileCheck -check-prefix=RV32I %s ; RUN: llc -mtriple=riscv64 -verify-machineinstrs < %s \ @@ -16,6 +22,26 @@ ; CHECKIFD-NEXT: feq.d a0, fa0, fa1 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcmp_oeq: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: feq.d a0, a0, a2 +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcmp_oeq: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: feq.d a0, a0, a1 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcmp_oeq: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -35,6 +61,26 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKRVZDINX-LABEL: fcmp_oeq: +; CHECKRVZDINX: # %bb.0: +; CHECKRVZDINX-NEXT: addi sp, sp, -16 +; CHECKRVZDINX-NEXT: sw a2, 8(sp) +; CHECKRVZDINX-NEXT: sw a3, 12(sp) +; CHECKRVZDINX-NEXT: ld a2, 8(sp) +; CHECKRVZDINX-NEXT: sw a0, 8(sp) +; CHECKRVZDINX-NEXT: sw a1, 12(sp) +; CHECKRVZDINX-NEXT: ld a0, 8(sp) +; CHECKRVZDINX-NEXT: feq.d a0, a0, a2 +; CHECKRVZDINX-NEXT: addi sp, sp, 16 +; CHECKRVZDINX-NEXT: ret +; CHECKRV64IZFINXZDINX-LABEL: fcmp_oeq: +; CHECKRV64IZFINXZDINX: # %bb.0: +; CHECKRV64IZFINXZDINX-NEXT: feq.d a0, a0, a1 +; CHECKRV64IZFINXZDINX-NEXT: ret +; CHECKIZFINXZDINX-LABEL: fcmp_oeq: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: feq.d a0, a0, a1 +; CHECKIZFINXZDINX-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmp.f64(double %a, double %b, metadata !"oeq", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 @@ -50,6 +96,33 @@ ; CHECKIFD-NEXT: feq.d zero, fa1, fa0 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcmp_ogt: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: frflags a1 +; RV32IZFINXZDINX-NEXT: flt.d a0, a2, a4 +; RV32IZFINXZDINX-NEXT: fsflags a1 +; RV32IZFINXZDINX-NEXT: feq.d zero, a2, a4 +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcmp_ogt: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: frflags a3 +; RV64IZFINXZDINX-NEXT: flt.d a2, a1, a0 +; RV64IZFINXZDINX-NEXT: fsflags a3 +; RV64IZFINXZDINX-NEXT: feq.d zero, a1, a0 +; RV64IZFINXZDINX-NEXT: mv a0, a2 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcmp_ogt: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -69,6 +142,37 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKRVZDINX-LABEL: fcmp_ogt: +; CHECKRVZDINX: # %bb.0: +; CHECKRVZDINX-NEXT: addi sp, sp, -16 +; CHECKRVZDINX-NEXT: sw a0, 8(sp) +; CHECKRVZDINX-NEXT: sw a1, 12(sp) +; CHECKRVZDINX-NEXT: ld a4, 8(sp) +; CHECKRVZDINX-NEXT: sw a2, 8(sp) +; CHECKRVZDINX-NEXT: sw a3, 12(sp) +; CHECKRVZDINX-NEXT: ld a2, 8(sp) +; CHECKRVZDINX-NEXT: frflags a1 +; CHECKRVZDINX-NEXT: flt.d a0, a2, a4 +; CHECKRVZDINX-NEXT: fsflags a1 +; CHECKRVZDINX-NEXT: feq.d zero, a2, a4 +; CHECKRVZDINX-NEXT: addi sp, sp, 16 +; CHECKRVZDINX-NEXT: ret +; CHECKRV64IZFINXZDINX-LABEL: fcmp_ogt: +; CHECKRV64IZFINXZDINX: # %bb.0: +; CHECKRV64IZFINXZDINX-NEXT: frflags a3 +; CHECKRV64IZFINXZDINX-NEXT: flt.d a2, a1, a0 +; CHECKRV64IZFINXZDINX-NEXT: fsflags a3 +; CHECKRV64IZFINXZDINX-NEXT: feq.d zero, a1, a0 +; CHECKRV64IZFINXZDINX-NEXT: mv a0, a2 +; CHECKRV64IZFINXZDINX-NEXT: ret +; CHECKIZFINXZDINX-LABEL: fcmp_ogt: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: frflags a3 +; CHECKIZFINXZDINX-NEXT: flt.d a2, a1, a0 +; CHECKIZFINXZDINX-NEXT: fsflags a3 +; CHECKIZFINXZDINX-NEXT: feq.d zero, a1, a0 +; CHECKIZFINXZDINX-NEXT: mv a0, a2 +; CHECKIZFINXZDINX-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmp.f64(double %a, double %b, metadata !"ogt", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 @@ -83,6 +187,33 @@ ; CHECKIFD-NEXT: feq.d zero, fa1, fa0 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcmp_oge: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: frflags a1 +; RV32IZFINXZDINX-NEXT: fle.d a0, a2, a4 +; RV32IZFINXZDINX-NEXT: fsflags a1 +; RV32IZFINXZDINX-NEXT: feq.d zero, a2, a4 +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcmp_oge: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: frflags a3 +; RV64IZFINXZDINX-NEXT: fle.d a2, a1, a0 +; RV64IZFINXZDINX-NEXT: fsflags a3 +; RV64IZFINXZDINX-NEXT: feq.d zero, a1, a0 +; RV64IZFINXZDINX-NEXT: mv a0, a2 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcmp_oge: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -104,6 +235,37 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKRVZDINX-LABEL: fcmp_oge: +; CHECKRVZDINX: # %bb.0: +; CHECKRVZDINX-NEXT: addi sp, sp, -16 +; CHECKRVZDINX-NEXT: sw a0, 8(sp) +; CHECKRVZDINX-NEXT: sw a1, 12(sp) +; CHECKRVZDINX-NEXT: ld a4, 8(sp) +; CHECKRVZDINX-NEXT: sw a2, 8(sp) +; CHECKRVZDINX-NEXT: sw a3, 12(sp) +; CHECKRVZDINX-NEXT: ld a2, 8(sp) +; CHECKRVZDINX-NEXT: frflags a1 +; CHECKRVZDINX-NEXT: fle.d a0, a2, a4 +; CHECKRVZDINX-NEXT: fsflags a1 +; CHECKRVZDINX-NEXT: feq.d zero, a2, a4 +; CHECKRVZDINX-NEXT: addi sp, sp, 16 +; CHECKRVZDINX-NEXT: ret +; CHECKRV64IZFINXZDINX-LABEL: fcmp_oge: +; CHECKRV64IZFINXZDINX: # %bb.0: +; CHECKRV64IZFINXZDINX-NEXT: frflags a3 +; CHECKRV64IZFINXZDINX-NEXT: fle.d a2, a1, a0 +; CHECKRV64IZFINXZDINX-NEXT: fsflags a3 +; CHECKRV64IZFINXZDINX-NEXT: feq.d zero, a1, a0 +; CHECKRV64IZFINXZDINX-NEXT: mv a0, a2 +; CHECKRV64IZFINXZDINX-NEXT: ret +; CHECKIZFINXZDINX-LABEL: fcmp_oge: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: frflags a3 +; CHECKIZFINXZDINX-NEXT: fle.d a2, a1, a0 +; CHECKIZFINXZDINX-NEXT: fsflags a3 +; CHECKIZFINXZDINX-NEXT: feq.d zero, a1, a0 +; CHECKIZFINXZDINX-NEXT: mv a0, a2 +; CHECKIZFINXZDINX-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmp.f64(double %a, double %b, metadata !"oge", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 @@ -118,6 +280,33 @@ ; CHECKIFD-NEXT: feq.d zero, fa0, fa1 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcmp_olt: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: frflags a1 +; RV32IZFINXZDINX-NEXT: flt.d a0, a4, a2 +; RV32IZFINXZDINX-NEXT: fsflags a1 +; RV32IZFINXZDINX-NEXT: feq.d zero, a4, a2 +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcmp_olt: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: frflags a3 +; RV64IZFINXZDINX-NEXT: flt.d a2, a0, a1 +; RV64IZFINXZDINX-NEXT: fsflags a3 +; RV64IZFINXZDINX-NEXT: feq.d zero, a0, a1 +; RV64IZFINXZDINX-NEXT: mv a0, a2 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcmp_olt: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -137,6 +326,37 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKRVZDINX-LABEL: fcmp_olt: +; CHECKRVZDINX: # %bb.0: +; CHECKRVZDINX-NEXT: addi sp, sp, -16 +; CHECKRVZDINX-NEXT: sw a2, 8(sp) +; CHECKRVZDINX-NEXT: sw a3, 12(sp) +; CHECKRVZDINX-NEXT: ld a2, 8(sp) +; CHECKRVZDINX-NEXT: sw a0, 8(sp) +; CHECKRVZDINX-NEXT: sw a1, 12(sp) +; CHECKRVZDINX-NEXT: ld a4, 8(sp) +; CHECKRVZDINX-NEXT: frflags a1 +; CHECKRVZDINX-NEXT: flt.d a0, a4, a2 +; CHECKRVZDINX-NEXT: fsflags a1 +; CHECKRVZDINX-NEXT: feq.d zero, a4, a2 +; CHECKRVZDINX-NEXT: addi sp, sp, 16 +; CHECKRVZDINX-NEXT: ret +; CHECKRV64IZFINXZDINX-LABEL: fcmp_olt: +; CHECKRV64IZFINXZDINX: # %bb.0: +; CHECKRV64IZFINXZDINX-NEXT: frflags a3 +; CHECKRV64IZFINXZDINX-NEXT: flt.d a2, a0, a1 +; CHECKRV64IZFINXZDINX-NEXT: fsflags a3 +; CHECKRV64IZFINXZDINX-NEXT: feq.d zero, a0, a1 +; CHECKRV64IZFINXZDINX-NEXT: mv a0, a2 +; CHECKRV64IZFINXZDINX-NEXT: ret +; CHECKIZFINXZDINX-LABEL: fcmp_olt: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: frflags a3 +; CHECKIZFINXZDINX-NEXT: flt.d a2, a0, a1 +; CHECKIZFINXZDINX-NEXT: fsflags a3 +; CHECKIZFINXZDINX-NEXT: feq.d zero, a0, a1 +; CHECKIZFINXZDINX-NEXT: mv a0, a2 +; CHECKIZFINXZDINX-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmp.f64(double %a, double %b, metadata !"olt", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 @@ -151,6 +371,33 @@ ; CHECKIFD-NEXT: feq.d zero, fa0, fa1 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcmp_ole: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: frflags a1 +; RV32IZFINXZDINX-NEXT: fle.d a0, a4, a2 +; RV32IZFINXZDINX-NEXT: fsflags a1 +; RV32IZFINXZDINX-NEXT: feq.d zero, a4, a2 +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcmp_ole: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: frflags a3 +; RV64IZFINXZDINX-NEXT: fle.d a2, a0, a1 +; RV64IZFINXZDINX-NEXT: fsflags a3 +; RV64IZFINXZDINX-NEXT: feq.d zero, a0, a1 +; RV64IZFINXZDINX-NEXT: mv a0, a2 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcmp_ole: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -170,6 +417,37 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKRVZDINX-LABEL: fcmp_ole: +; CHECKRVZDINX: # %bb.0: +; CHECKRVZDINX-NEXT: addi sp, sp, -16 +; CHECKRVZDINX-NEXT: sw a2, 8(sp) +; CHECKRVZDINX-NEXT: sw a3, 12(sp) +; CHECKRVZDINX-NEXT: ld a2, 8(sp) +; CHECKRVZDINX-NEXT: sw a0, 8(sp) +; CHECKRVZDINX-NEXT: sw a1, 12(sp) +; CHECKRVZDINX-NEXT: ld a4, 8(sp) +; CHECKRVZDINX-NEXT: frflags a1 +; CHECKRVZDINX-NEXT: fle.d a0, a4, a2 +; CHECKRVZDINX-NEXT: fsflags a1 +; CHECKRVZDINX-NEXT: feq.d zero, a4, a2 +; CHECKRVZDINX-NEXT: addi sp, sp, 16 +; CHECKRVZDINX-NEXT: ret +; CHECKRV64IZFINXZDINX-LABEL: fcmp_ole: +; CHECKRV64IZFINXZDINX: # %bb.0: +; CHECKRV64IZFINXZDINX-NEXT: frflags a3 +; CHECKRV64IZFINXZDINX-NEXT: fle.d a2, a0, a1 +; CHECKRV64IZFINXZDINX-NEXT: fsflags a3 +; CHECKRV64IZFINXZDINX-NEXT: feq.d zero, a0, a1 +; CHECKRV64IZFINXZDINX-NEXT: mv a0, a2 +; CHECKRV64IZFINXZDINX-NEXT: ret +; CHECKIZFINXZDINX-LABEL: fcmp_ole: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: frflags a3 +; CHECKIZFINXZDINX-NEXT: fle.d a2, a0, a1 +; CHECKIZFINXZDINX-NEXT: fsflags a3 +; CHECKIZFINXZDINX-NEXT: feq.d zero, a0, a1 +; CHECKIZFINXZDINX-NEXT: mv a0, a2 +; CHECKIZFINXZDINX-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmp.f64(double %a, double %b, metadata !"ole", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 @@ -191,6 +469,43 @@ ; CHECKIFD-NEXT: feq.d zero, fa1, fa0 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcmp_one: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: frflags a0 +; RV32IZFINXZDINX-NEXT: flt.d a1, a4, a2 +; RV32IZFINXZDINX-NEXT: fsflags a0 +; RV32IZFINXZDINX-NEXT: feq.d zero, a4, a2 +; RV32IZFINXZDINX-NEXT: frflags a0 +; RV32IZFINXZDINX-NEXT: flt.d a6, a2, a4 +; RV32IZFINXZDINX-NEXT: fsflags a0 +; RV32IZFINXZDINX-NEXT: or a0, a6, a1 +; RV32IZFINXZDINX-NEXT: feq.d zero, a2, a4 +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcmp_one: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: frflags a2 +; RV64IZFINXZDINX-NEXT: flt.d a3, a0, a1 +; RV64IZFINXZDINX-NEXT: fsflags a2 +; RV64IZFINXZDINX-NEXT: feq.d zero, a0, a1 +; RV64IZFINXZDINX-NEXT: frflags a2 +; RV64IZFINXZDINX-NEXT: flt.d a4, a1, a0 +; RV64IZFINXZDINX-NEXT: fsflags a2 +; RV64IZFINXZDINX-NEXT: or a2, a4, a3 +; RV64IZFINXZDINX-NEXT: feq.d zero, a1, a0 +; RV64IZFINXZDINX-NEXT: mv a0, a2 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcmp_one: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -32 @@ -244,6 +559,52 @@ ; RV64I-NEXT: ld s2, 0(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 32 ; RV64I-NEXT: ret +; CHECKRVZDINX-LABEL: fcmp_one: +; CHECKRVZDINX: # %bb.0: +; CHECKRVZDINX-NEXT: addi sp, sp, -16 +; CHECKRVZDINX-NEXT: sw a2, 8(sp) +; CHECKRVZDINX-NEXT: sw a3, 12(sp) +; CHECKRVZDINX-NEXT: ld a2, 8(sp) +; CHECKRVZDINX-NEXT: sw a0, 8(sp) +; CHECKRVZDINX-NEXT: sw a1, 12(sp) +; CHECKRVZDINX-NEXT: ld a4, 8(sp) +; CHECKRVZDINX-NEXT: frflags a0 +; CHECKRVZDINX-NEXT: flt.d a1, a4, a2 +; CHECKRVZDINX-NEXT: fsflags a0 +; CHECKRVZDINX-NEXT: feq.d zero, a4, a2 +; CHECKRVZDINX-NEXT: frflags a0 +; CHECKRVZDINX-NEXT: flt.d a6, a2, a4 +; CHECKRVZDINX-NEXT: fsflags a0 +; CHECKRVZDINX-NEXT: or a0, a6, a1 +; CHECKRVZDINX-NEXT: feq.d zero, a2, a4 +; CHECKRVZDINX-NEXT: addi sp, sp, 16 +; CHECKRVZDINX-NEXT: ret +; CHECKRV64IZFINXZDINX-LABEL: fcmp_one: +; CHECKRV64IZFINXZDINX: # %bb.0: +; CHECKRV64IZFINXZDINX-NEXT: frflags a2 +; CHECKRV64IZFINXZDINX-NEXT: flt.d a3, a0, a1 +; CHECKRV64IZFINXZDINX-NEXT: fsflags a2 +; CHECKRV64IZFINXZDINX-NEXT: feq.d zero, a0, a1 +; CHECKRV64IZFINXZDINX-NEXT: frflags a2 +; CHECKRV64IZFINXZDINX-NEXT: flt.d a4, a1, a0 +; CHECKRV64IZFINXZDINX-NEXT: fsflags a2 +; CHECKRV64IZFINXZDINX-NEXT: or a2, a4, a3 +; CHECKRV64IZFINXZDINX-NEXT: feq.d zero, a1, a0 +; CHECKRV64IZFINXZDINX-NEXT: mv a0, a2 +; CHECKRV64IZFINXZDINX-NEXT: ret +; CHECKIZFINXZDINX-LABEL: fcmp_one: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: frflags a2 +; CHECKIZFINXZDINX-NEXT: flt.d a3, a0, a1 +; CHECKIZFINXZDINX-NEXT: fsflags a2 +; CHECKIZFINXZDINX-NEXT: feq.d zero, a0, a1 +; CHECKIZFINXZDINX-NEXT: frflags a2 +; CHECKIZFINXZDINX-NEXT: flt.d a4, a1, a0 +; CHECKIZFINXZDINX-NEXT: fsflags a2 +; CHECKIZFINXZDINX-NEXT: or a2, a4, a3 +; CHECKIZFINXZDINX-NEXT: feq.d zero, a1, a0 +; CHECKIZFINXZDINX-NEXT: mv a0, a2 +; CHECKIZFINXZDINX-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmp.f64(double %a, double %b, metadata !"one", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 @@ -257,6 +618,30 @@ ; CHECKIFD-NEXT: and a0, a1, a0 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcmp_ord: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: feq.d a2, a2, a2 +; RV32IZFINXZDINX-NEXT: feq.d a0, a0, a0 +; RV32IZFINXZDINX-NEXT: and a0, a0, a2 +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcmp_ord: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: feq.d a1, a1, a1 +; RV64IZFINXZDINX-NEXT: feq.d a0, a0, a0 +; RV64IZFINXZDINX-NEXT: and a0, a0, a1 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcmp_ord: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -276,6 +661,32 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKRVZDINX-LABEL: fcmp_ord: +; CHECKRVZDINX: # %bb.0: +; CHECKRVZDINX-NEXT: addi sp, sp, -16 +; CHECKRVZDINX-NEXT: sw a0, 8(sp) +; CHECKRVZDINX-NEXT: sw a1, 12(sp) +; CHECKRVZDINX-NEXT: ld a0, 8(sp) +; CHECKRVZDINX-NEXT: sw a2, 8(sp) +; CHECKRVZDINX-NEXT: sw a3, 12(sp) +; CHECKRVZDINX-NEXT: ld a2, 8(sp) +; CHECKRVZDINX-NEXT: feq.d a2, a2, a2 +; CHECKRVZDINX-NEXT: feq.d a0, a0, a0 +; CHECKRVZDINX-NEXT: and a0, a0, a2 +; CHECKRVZDINX-NEXT: addi sp, sp, 16 +; CHECKRVZDINX-NEXT: ret +; CHECKRV64IZFINXZDINX-LABEL: fcmp_ord: +; CHECKRV64IZFINXZDINX: # %bb.0: +; CHECKRV64IZFINXZDINX-NEXT: feq.d a1, a1, a1 +; CHECKRV64IZFINXZDINX-NEXT: feq.d a0, a0, a0 +; CHECKRV64IZFINXZDINX-NEXT: and a0, a0, a1 +; CHECKRV64IZFINXZDINX-NEXT: ret +; CHECKIZFINXZDINX-LABEL: fcmp_ord: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: feq.d a1, a1, a1 +; CHECKIZFINXZDINX-NEXT: feq.d a0, a0, a0 +; CHECKIZFINXZDINX-NEXT: and a0, a0, a1 +; CHECKIZFINXZDINX-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmp.f64(double %a, double %b, metadata !"ord", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 @@ -298,6 +709,45 @@ ; CHECKIFD-NEXT: feq.d zero, fa1, fa0 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcmp_ueq: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: frflags a0 +; RV32IZFINXZDINX-NEXT: flt.d a1, a4, a2 +; RV32IZFINXZDINX-NEXT: fsflags a0 +; RV32IZFINXZDINX-NEXT: feq.d zero, a4, a2 +; RV32IZFINXZDINX-NEXT: frflags a0 +; RV32IZFINXZDINX-NEXT: flt.d a6, a2, a4 +; RV32IZFINXZDINX-NEXT: fsflags a0 +; RV32IZFINXZDINX-NEXT: or a0, a6, a1 +; RV32IZFINXZDINX-NEXT: xori a0, a0, 1 +; RV32IZFINXZDINX-NEXT: feq.d zero, a2, a4 +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcmp_ueq: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: frflags a2 +; RV64IZFINXZDINX-NEXT: flt.d a3, a0, a1 +; RV64IZFINXZDINX-NEXT: fsflags a2 +; RV64IZFINXZDINX-NEXT: feq.d zero, a0, a1 +; RV64IZFINXZDINX-NEXT: frflags a2 +; RV64IZFINXZDINX-NEXT: flt.d a4, a1, a0 +; RV64IZFINXZDINX-NEXT: fsflags a2 +; RV64IZFINXZDINX-NEXT: or a2, a4, a3 +; RV64IZFINXZDINX-NEXT: xori a2, a2, 1 +; RV64IZFINXZDINX-NEXT: feq.d zero, a1, a0 +; RV64IZFINXZDINX-NEXT: mv a0, a2 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcmp_ueq: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -32 @@ -351,6 +801,55 @@ ; RV64I-NEXT: ld s2, 0(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 32 ; RV64I-NEXT: ret +; CHECKRVZDINX-LABEL: fcmp_ueq: +; CHECKRVZDINX: # %bb.0: +; CHECKRVZDINX-NEXT: addi sp, sp, -16 +; CHECKRVZDINX-NEXT: sw a2, 8(sp) +; CHECKRVZDINX-NEXT: sw a3, 12(sp) +; CHECKRVZDINX-NEXT: ld a2, 8(sp) +; CHECKRVZDINX-NEXT: sw a0, 8(sp) +; CHECKRVZDINX-NEXT: sw a1, 12(sp) +; CHECKRVZDINX-NEXT: ld a4, 8(sp) +; CHECKRVZDINX-NEXT: frflags a0 +; CHECKRVZDINX-NEXT: flt.d a1, a4, a2 +; CHECKRVZDINX-NEXT: fsflags a0 +; CHECKRVZDINX-NEXT: feq.d zero, a4, a2 +; CHECKRVZDINX-NEXT: frflags a0 +; CHECKRVZDINX-NEXT: flt.d a6, a2, a4 +; CHECKRVZDINX-NEXT: fsflags a0 +; CHECKRVZDINX-NEXT: or a0, a6, a1 +; CHECKRVZDINX-NEXT: xori a0, a0, 1 +; CHECKRVZDINX-NEXT: feq.d zero, a2, a4 +; CHECKRVZDINX-NEXT: addi sp, sp, 16 +; CHECKRVZDINX-NEXT: ret +; CHECKRV64IZFINXZDINX-LABEL: fcmp_ueq: +; CHECKRV64IZFINXZDINX: # %bb.0: +; CHECKRV64IZFINXZDINX-NEXT: frflags a2 +; CHECKRV64IZFINXZDINX-NEXT: flt.d a3, a0, a1 +; CHECKRV64IZFINXZDINX-NEXT: fsflags a2 +; CHECKRV64IZFINXZDINX-NEXT: feq.d zero, a0, a1 +; CHECKRV64IZFINXZDINX-NEXT: frflags a2 +; CHECKRV64IZFINXZDINX-NEXT: flt.d a4, a1, a0 +; CHECKRV64IZFINXZDINX-NEXT: fsflags a2 +; CHECKRV64IZFINXZDINX-NEXT: or a2, a4, a3 +; CHECKRV64IZFINXZDINX-NEXT: xori a2, a2, 1 +; CHECKRV64IZFINXZDINX-NEXT: feq.d zero, a1, a0 +; CHECKRV64IZFINXZDINX-NEXT: mv a0, a2 +; CHECKRV64IZFINXZDINX-NEXT: ret +; CHECKIZFINXZDINX-LABEL: fcmp_ueq: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: frflags a2 +; CHECKIZFINXZDINX-NEXT: flt.d a3, a0, a1 +; CHECKIZFINXZDINX-NEXT: fsflags a2 +; CHECKIZFINXZDINX-NEXT: feq.d zero, a0, a1 +; CHECKIZFINXZDINX-NEXT: frflags a2 +; CHECKIZFINXZDINX-NEXT: flt.d a4, a1, a0 +; CHECKIZFINXZDINX-NEXT: fsflags a2 +; CHECKIZFINXZDINX-NEXT: or a2, a4, a3 +; CHECKIZFINXZDINX-NEXT: xori a2, a2, 1 +; CHECKIZFINXZDINX-NEXT: feq.d zero, a1, a0 +; CHECKIZFINXZDINX-NEXT: mv a0, a2 +; CHECKIZFINXZDINX-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmp.f64(double %a, double %b, metadata !"ueq", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 @@ -366,6 +865,35 @@ ; CHECKIFD-NEXT: feq.d zero, fa0, fa1 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcmp_ugt: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: frflags a0 +; RV32IZFINXZDINX-NEXT: fle.d a1, a4, a2 +; RV32IZFINXZDINX-NEXT: fsflags a0 +; RV32IZFINXZDINX-NEXT: xori a0, a1, 1 +; RV32IZFINXZDINX-NEXT: feq.d zero, a4, a2 +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcmp_ugt: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: frflags a2 +; RV64IZFINXZDINX-NEXT: fle.d a3, a0, a1 +; RV64IZFINXZDINX-NEXT: fsflags a2 +; RV64IZFINXZDINX-NEXT: xori a2, a3, 1 +; RV64IZFINXZDINX-NEXT: feq.d zero, a0, a1 +; RV64IZFINXZDINX-NEXT: mv a0, a2 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcmp_ugt: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -385,6 +913,40 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKRVZDINX-LABEL: fcmp_ugt: +; CHECKRVZDINX: # %bb.0: +; CHECKRVZDINX-NEXT: addi sp, sp, -16 +; CHECKRVZDINX-NEXT: sw a2, 8(sp) +; CHECKRVZDINX-NEXT: sw a3, 12(sp) +; CHECKRVZDINX-NEXT: ld a2, 8(sp) +; CHECKRVZDINX-NEXT: sw a0, 8(sp) +; CHECKRVZDINX-NEXT: sw a1, 12(sp) +; CHECKRVZDINX-NEXT: ld a4, 8(sp) +; CHECKRVZDINX-NEXT: frflags a0 +; CHECKRVZDINX-NEXT: fle.d a1, a4, a2 +; CHECKRVZDINX-NEXT: fsflags a0 +; CHECKRVZDINX-NEXT: xori a0, a1, 1 +; CHECKRVZDINX-NEXT: feq.d zero, a4, a2 +; CHECKRVZDINX-NEXT: addi sp, sp, 16 +; CHECKRVZDINX-NEXT: ret +; CHECKRV64IZFINXZDINX-LABEL: fcmp_ugt: +; CHECKRV64IZFINXZDINX: # %bb.0: +; CHECKRV64IZFINXZDINX-NEXT: frflags a2 +; CHECKRV64IZFINXZDINX-NEXT: fle.d a3, a0, a1 +; CHECKRV64IZFINXZDINX-NEXT: fsflags a2 +; CHECKRV64IZFINXZDINX-NEXT: xori a2, a3, 1 +; CHECKRV64IZFINXZDINX-NEXT: feq.d zero, a0, a1 +; CHECKRV64IZFINXZDINX-NEXT: mv a0, a2 +; CHECKRV64IZFINXZDINX-NEXT: ret +; CHECKIZFINXZDINX-LABEL: fcmp_ugt: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: frflags a2 +; CHECKIZFINXZDINX-NEXT: fle.d a3, a0, a1 +; CHECKIZFINXZDINX-NEXT: fsflags a2 +; CHECKIZFINXZDINX-NEXT: xori a2, a3, 1 +; CHECKIZFINXZDINX-NEXT: feq.d zero, a0, a1 +; CHECKIZFINXZDINX-NEXT: mv a0, a2 +; CHECKIZFINXZDINX-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmp.f64(double %a, double %b, metadata !"ugt", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 @@ -400,6 +962,35 @@ ; CHECKIFD-NEXT: feq.d zero, fa0, fa1 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcmp_uge: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: frflags a0 +; RV32IZFINXZDINX-NEXT: flt.d a1, a4, a2 +; RV32IZFINXZDINX-NEXT: fsflags a0 +; RV32IZFINXZDINX-NEXT: xori a0, a1, 1 +; RV32IZFINXZDINX-NEXT: feq.d zero, a4, a2 +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcmp_uge: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: frflags a2 +; RV64IZFINXZDINX-NEXT: flt.d a3, a0, a1 +; RV64IZFINXZDINX-NEXT: fsflags a2 +; RV64IZFINXZDINX-NEXT: xori a2, a3, 1 +; RV64IZFINXZDINX-NEXT: feq.d zero, a0, a1 +; RV64IZFINXZDINX-NEXT: mv a0, a2 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcmp_uge: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -421,6 +1012,40 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKRVZDINX-LABEL: fcmp_uge: +; CHECKRVZDINX: # %bb.0: +; CHECKRVZDINX-NEXT: addi sp, sp, -16 +; CHECKRVZDINX-NEXT: sw a2, 8(sp) +; CHECKRVZDINX-NEXT: sw a3, 12(sp) +; CHECKRVZDINX-NEXT: ld a2, 8(sp) +; CHECKRVZDINX-NEXT: sw a0, 8(sp) +; CHECKRVZDINX-NEXT: sw a1, 12(sp) +; CHECKRVZDINX-NEXT: ld a4, 8(sp) +; CHECKRVZDINX-NEXT: frflags a0 +; CHECKRVZDINX-NEXT: flt.d a1, a4, a2 +; CHECKRVZDINX-NEXT: fsflags a0 +; CHECKRVZDINX-NEXT: xori a0, a1, 1 +; CHECKRVZDINX-NEXT: feq.d zero, a4, a2 +; CHECKRVZDINX-NEXT: addi sp, sp, 16 +; CHECKRVZDINX-NEXT: ret +; CHECKRV64IZFINXZDINX-LABEL: fcmp_uge: +; CHECKRV64IZFINXZDINX: # %bb.0: +; CHECKRV64IZFINXZDINX-NEXT: frflags a2 +; CHECKRV64IZFINXZDINX-NEXT: flt.d a3, a0, a1 +; CHECKRV64IZFINXZDINX-NEXT: fsflags a2 +; CHECKRV64IZFINXZDINX-NEXT: xori a2, a3, 1 +; CHECKRV64IZFINXZDINX-NEXT: feq.d zero, a0, a1 +; CHECKRV64IZFINXZDINX-NEXT: mv a0, a2 +; CHECKRV64IZFINXZDINX-NEXT: ret +; CHECKIZFINXZDINX-LABEL: fcmp_uge: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: frflags a2 +; CHECKIZFINXZDINX-NEXT: flt.d a3, a0, a1 +; CHECKIZFINXZDINX-NEXT: fsflags a2 +; CHECKIZFINXZDINX-NEXT: xori a2, a3, 1 +; CHECKIZFINXZDINX-NEXT: feq.d zero, a0, a1 +; CHECKIZFINXZDINX-NEXT: mv a0, a2 +; CHECKIZFINXZDINX-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmp.f64(double %a, double %b, metadata !"uge", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 @@ -436,6 +1061,35 @@ ; CHECKIFD-NEXT: feq.d zero, fa1, fa0 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcmp_ult: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: frflags a0 +; RV32IZFINXZDINX-NEXT: fle.d a1, a2, a4 +; RV32IZFINXZDINX-NEXT: fsflags a0 +; RV32IZFINXZDINX-NEXT: xori a0, a1, 1 +; RV32IZFINXZDINX-NEXT: feq.d zero, a2, a4 +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcmp_ult: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: frflags a2 +; RV64IZFINXZDINX-NEXT: fle.d a3, a1, a0 +; RV64IZFINXZDINX-NEXT: fsflags a2 +; RV64IZFINXZDINX-NEXT: xori a2, a3, 1 +; RV64IZFINXZDINX-NEXT: feq.d zero, a1, a0 +; RV64IZFINXZDINX-NEXT: mv a0, a2 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcmp_ult: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -455,6 +1109,40 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKRVZDINX-LABEL: fcmp_ult: +; CHECKRVZDINX: # %bb.0: +; CHECKRVZDINX-NEXT: addi sp, sp, -16 +; CHECKRVZDINX-NEXT: sw a0, 8(sp) +; CHECKRVZDINX-NEXT: sw a1, 12(sp) +; CHECKRVZDINX-NEXT: ld a4, 8(sp) +; CHECKRVZDINX-NEXT: sw a2, 8(sp) +; CHECKRVZDINX-NEXT: sw a3, 12(sp) +; CHECKRVZDINX-NEXT: ld a2, 8(sp) +; CHECKRVZDINX-NEXT: frflags a0 +; CHECKRVZDINX-NEXT: fle.d a1, a2, a4 +; CHECKRVZDINX-NEXT: fsflags a0 +; CHECKRVZDINX-NEXT: xori a0, a1, 1 +; CHECKRVZDINX-NEXT: feq.d zero, a2, a4 +; CHECKRVZDINX-NEXT: addi sp, sp, 16 +; CHECKRVZDINX-NEXT: ret +; CHECKRV64IZFINXZDINX-LABEL: fcmp_ult: +; CHECKRV64IZFINXZDINX: # %bb.0: +; CHECKRV64IZFINXZDINX-NEXT: frflags a2 +; CHECKRV64IZFINXZDINX-NEXT: fle.d a3, a1, a0 +; CHECKRV64IZFINXZDINX-NEXT: fsflags a2 +; CHECKRV64IZFINXZDINX-NEXT: xori a2, a3, 1 +; CHECKRV64IZFINXZDINX-NEXT: feq.d zero, a1, a0 +; CHECKRV64IZFINXZDINX-NEXT: mv a0, a2 +; CHECKRV64IZFINXZDINX-NEXT: ret +; CHECKIZFINXZDINX-LABEL: fcmp_ult: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: frflags a2 +; CHECKIZFINXZDINX-NEXT: fle.d a3, a1, a0 +; CHECKIZFINXZDINX-NEXT: fsflags a2 +; CHECKIZFINXZDINX-NEXT: xori a2, a3, 1 +; CHECKIZFINXZDINX-NEXT: feq.d zero, a1, a0 +; CHECKIZFINXZDINX-NEXT: mv a0, a2 +; CHECKIZFINXZDINX-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmp.f64(double %a, double %b, metadata !"ult", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 @@ -470,6 +1158,35 @@ ; CHECKIFD-NEXT: feq.d zero, fa1, fa0 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcmp_ule: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: frflags a0 +; RV32IZFINXZDINX-NEXT: flt.d a1, a2, a4 +; RV32IZFINXZDINX-NEXT: fsflags a0 +; RV32IZFINXZDINX-NEXT: xori a0, a1, 1 +; RV32IZFINXZDINX-NEXT: feq.d zero, a2, a4 +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcmp_ule: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: frflags a2 +; RV64IZFINXZDINX-NEXT: flt.d a3, a1, a0 +; RV64IZFINXZDINX-NEXT: fsflags a2 +; RV64IZFINXZDINX-NEXT: xori a2, a3, 1 +; RV64IZFINXZDINX-NEXT: feq.d zero, a1, a0 +; RV64IZFINXZDINX-NEXT: mv a0, a2 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcmp_ule: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -489,6 +1206,40 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKRVZDINX-LABEL: fcmp_ule: +; CHECKRVZDINX: # %bb.0: +; CHECKRVZDINX-NEXT: addi sp, sp, -16 +; CHECKRVZDINX-NEXT: sw a0, 8(sp) +; CHECKRVZDINX-NEXT: sw a1, 12(sp) +; CHECKRVZDINX-NEXT: ld a4, 8(sp) +; CHECKRVZDINX-NEXT: sw a2, 8(sp) +; CHECKRVZDINX-NEXT: sw a3, 12(sp) +; CHECKRVZDINX-NEXT: ld a2, 8(sp) +; CHECKRVZDINX-NEXT: frflags a0 +; CHECKRVZDINX-NEXT: flt.d a1, a2, a4 +; CHECKRVZDINX-NEXT: fsflags a0 +; CHECKRVZDINX-NEXT: xori a0, a1, 1 +; CHECKRVZDINX-NEXT: feq.d zero, a2, a4 +; CHECKRVZDINX-NEXT: addi sp, sp, 16 +; CHECKRVZDINX-NEXT: ret +; CHECKRV64IZFINXZDINX-LABEL: fcmp_ule: +; CHECKRV64IZFINXZDINX: # %bb.0: +; CHECKRV64IZFINXZDINX-NEXT: frflags a2 +; CHECKRV64IZFINXZDINX-NEXT: flt.d a3, a1, a0 +; CHECKRV64IZFINXZDINX-NEXT: fsflags a2 +; CHECKRV64IZFINXZDINX-NEXT: xori a2, a3, 1 +; CHECKRV64IZFINXZDINX-NEXT: feq.d zero, a1, a0 +; CHECKRV64IZFINXZDINX-NEXT: mv a0, a2 +; CHECKRV64IZFINXZDINX-NEXT: ret +; CHECKIZFINXZDINX-LABEL: fcmp_ule: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: frflags a2 +; CHECKIZFINXZDINX-NEXT: flt.d a3, a1, a0 +; CHECKIZFINXZDINX-NEXT: fsflags a2 +; CHECKIZFINXZDINX-NEXT: xori a2, a3, 1 +; CHECKIZFINXZDINX-NEXT: feq.d zero, a1, a0 +; CHECKIZFINXZDINX-NEXT: mv a0, a2 +; CHECKIZFINXZDINX-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmp.f64(double %a, double %b, metadata !"ule", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 @@ -501,6 +1252,28 @@ ; CHECKIFD-NEXT: xori a0, a0, 1 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcmp_une: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: feq.d a0, a0, a2 +; RV32IZFINXZDINX-NEXT: xori a0, a0, 1 +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcmp_une: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: feq.d a0, a0, a1 +; RV64IZFINXZDINX-NEXT: xori a0, a0, 1 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcmp_une: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -520,6 +1293,29 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKRVZDINX-LABEL: fcmp_une: +; CHECKRVZDINX: # %bb.0: +; CHECKRVZDINX-NEXT: addi sp, sp, -16 +; CHECKRVZDINX-NEXT: sw a2, 8(sp) +; CHECKRVZDINX-NEXT: sw a3, 12(sp) +; CHECKRVZDINX-NEXT: ld a2, 8(sp) +; CHECKRVZDINX-NEXT: sw a0, 8(sp) +; CHECKRVZDINX-NEXT: sw a1, 12(sp) +; CHECKRVZDINX-NEXT: ld a0, 8(sp) +; CHECKRVZDINX-NEXT: feq.d a0, a0, a2 +; CHECKRVZDINX-NEXT: xori a0, a0, 1 +; CHECKRVZDINX-NEXT: addi sp, sp, 16 +; CHECKRVZDINX-NEXT: ret +; CHECKRV64IZFINXZDINX-LABEL: fcmp_une: +; CHECKRV64IZFINXZDINX: # %bb.0: +; CHECKRV64IZFINXZDINX-NEXT: feq.d a0, a0, a1 +; CHECKRV64IZFINXZDINX-NEXT: xori a0, a0, 1 +; CHECKRV64IZFINXZDINX-NEXT: ret +; CHECKIZFINXZDINX-LABEL: fcmp_une: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: feq.d a0, a0, a1 +; CHECKIZFINXZDINX-NEXT: xori a0, a0, 1 +; CHECKIZFINXZDINX-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmp.f64(double %a, double %b, metadata !"une", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 @@ -534,6 +1330,32 @@ ; CHECKIFD-NEXT: xori a0, a0, 1 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcmp_uno: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: feq.d a2, a2, a2 +; RV32IZFINXZDINX-NEXT: feq.d a0, a0, a0 +; RV32IZFINXZDINX-NEXT: and a0, a0, a2 +; RV32IZFINXZDINX-NEXT: xori a0, a0, 1 +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcmp_uno: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: feq.d a1, a1, a1 +; RV64IZFINXZDINX-NEXT: feq.d a0, a0, a0 +; RV64IZFINXZDINX-NEXT: and a0, a0, a1 +; RV64IZFINXZDINX-NEXT: xori a0, a0, 1 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcmp_uno: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -553,6 +1375,35 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKRVZDINX-LABEL: fcmp_uno: +; CHECKRVZDINX: # %bb.0: +; CHECKRVZDINX-NEXT: addi sp, sp, -16 +; CHECKRVZDINX-NEXT: sw a0, 8(sp) +; CHECKRVZDINX-NEXT: sw a1, 12(sp) +; CHECKRVZDINX-NEXT: ld a0, 8(sp) +; CHECKRVZDINX-NEXT: sw a2, 8(sp) +; CHECKRVZDINX-NEXT: sw a3, 12(sp) +; CHECKRVZDINX-NEXT: ld a2, 8(sp) +; CHECKRVZDINX-NEXT: feq.d a2, a2, a2 +; CHECKRVZDINX-NEXT: feq.d a0, a0, a0 +; CHECKRVZDINX-NEXT: and a0, a0, a2 +; CHECKRVZDINX-NEXT: xori a0, a0, 1 +; CHECKRVZDINX-NEXT: addi sp, sp, 16 +; CHECKRVZDINX-NEXT: ret +; CHECKRV64IZFINXZDINX-LABEL: fcmp_uno: +; CHECKRV64IZFINXZDINX: # %bb.0: +; CHECKRV64IZFINXZDINX-NEXT: feq.d a1, a1, a1 +; CHECKRV64IZFINXZDINX-NEXT: feq.d a0, a0, a0 +; CHECKRV64IZFINXZDINX-NEXT: and a0, a0, a1 +; CHECKRV64IZFINXZDINX-NEXT: xori a0, a0, 1 +; CHECKRV64IZFINXZDINX-NEXT: ret +; CHECKIZFINXZDINX-LABEL: fcmp_uno: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: feq.d a1, a1, a1 +; CHECKIZFINXZDINX-NEXT: feq.d a0, a0, a0 +; CHECKIZFINXZDINX-NEXT: and a0, a0, a1 +; CHECKIZFINXZDINX-NEXT: xori a0, a0, 1 +; CHECKIZFINXZDINX-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmp.f64(double %a, double %b, metadata !"uno", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 @@ -566,6 +1417,30 @@ ; CHECKIFD-NEXT: and a0, a1, a0 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcmps_oeq: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: fle.d a4, a2, a0 +; RV32IZFINXZDINX-NEXT: fle.d a0, a0, a2 +; RV32IZFINXZDINX-NEXT: and a0, a0, a4 +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcmps_oeq: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fle.d a2, a1, a0 +; RV64IZFINXZDINX-NEXT: fle.d a0, a0, a1 +; RV64IZFINXZDINX-NEXT: and a0, a0, a2 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcmps_oeq: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -585,6 +1460,32 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKRVZDINX-LABEL: fcmps_oeq: +; CHECKRVZDINX: # %bb.0: +; CHECKRVZDINX-NEXT: addi sp, sp, -16 +; CHECKRVZDINX-NEXT: sw a0, 8(sp) +; CHECKRVZDINX-NEXT: sw a1, 12(sp) +; CHECKRVZDINX-NEXT: ld a0, 8(sp) +; CHECKRVZDINX-NEXT: sw a2, 8(sp) +; CHECKRVZDINX-NEXT: sw a3, 12(sp) +; CHECKRVZDINX-NEXT: ld a2, 8(sp) +; CHECKRVZDINX-NEXT: fle.d a4, a2, a0 +; CHECKRVZDINX-NEXT: fle.d a0, a0, a2 +; CHECKRVZDINX-NEXT: and a0, a0, a4 +; CHECKRVZDINX-NEXT: addi sp, sp, 16 +; CHECKRVZDINX-NEXT: ret +; CHECKRV64IZFINXZDINX-LABEL: fcmps_oeq: +; CHECKRV64IZFINXZDINX: # %bb.0: +; CHECKRV64IZFINXZDINX-NEXT: fle.d a2, a1, a0 +; CHECKRV64IZFINXZDINX-NEXT: fle.d a0, a0, a1 +; CHECKRV64IZFINXZDINX-NEXT: and a0, a0, a2 +; CHECKRV64IZFINXZDINX-NEXT: ret +; CHECKIZFINXZDINX-LABEL: fcmps_oeq: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: fle.d a2, a1, a0 +; CHECKIZFINXZDINX-NEXT: fle.d a0, a0, a1 +; CHECKIZFINXZDINX-NEXT: and a0, a0, a2 +; CHECKIZFINXZDINX-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmps.f64(double %a, double %b, metadata !"oeq", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 @@ -597,6 +1498,26 @@ ; CHECKIFD-NEXT: flt.d a0, fa1, fa0 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcmps_ogt: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: flt.d a0, a2, a0 +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcmps_ogt: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: flt.d a0, a1, a0 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcmps_ogt: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -616,6 +1537,26 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKRVZDINX-LABEL: fcmps_ogt: +; CHECKRVZDINX: # %bb.0: +; CHECKRVZDINX-NEXT: addi sp, sp, -16 +; CHECKRVZDINX-NEXT: sw a0, 8(sp) +; CHECKRVZDINX-NEXT: sw a1, 12(sp) +; CHECKRVZDINX-NEXT: ld a0, 8(sp) +; CHECKRVZDINX-NEXT: sw a2, 8(sp) +; CHECKRVZDINX-NEXT: sw a3, 12(sp) +; CHECKRVZDINX-NEXT: ld a2, 8(sp) +; CHECKRVZDINX-NEXT: flt.d a0, a2, a0 +; CHECKRVZDINX-NEXT: addi sp, sp, 16 +; CHECKRVZDINX-NEXT: ret +; CHECKRV64IZFINXZDINX-LABEL: fcmps_ogt: +; CHECKRV64IZFINXZDINX: # %bb.0: +; CHECKRV64IZFINXZDINX-NEXT: flt.d a0, a1, a0 +; CHECKRV64IZFINXZDINX-NEXT: ret +; CHECKIZFINXZDINX-LABEL: fcmps_ogt: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: flt.d a0, a1, a0 +; CHECKIZFINXZDINX-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmps.f64(double %a, double %b, metadata !"ogt", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 @@ -627,6 +1568,26 @@ ; CHECKIFD-NEXT: fle.d a0, fa1, fa0 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcmps_oge: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: fle.d a0, a2, a0 +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcmps_oge: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fle.d a0, a1, a0 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcmps_oge: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -648,6 +1609,26 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKRVZDINX-LABEL: fcmps_oge: +; CHECKRVZDINX: # %bb.0: +; CHECKRVZDINX-NEXT: addi sp, sp, -16 +; CHECKRVZDINX-NEXT: sw a0, 8(sp) +; CHECKRVZDINX-NEXT: sw a1, 12(sp) +; CHECKRVZDINX-NEXT: ld a0, 8(sp) +; CHECKRVZDINX-NEXT: sw a2, 8(sp) +; CHECKRVZDINX-NEXT: sw a3, 12(sp) +; CHECKRVZDINX-NEXT: ld a2, 8(sp) +; CHECKRVZDINX-NEXT: fle.d a0, a2, a0 +; CHECKRVZDINX-NEXT: addi sp, sp, 16 +; CHECKRVZDINX-NEXT: ret +; CHECKRV64IZFINXZDINX-LABEL: fcmps_oge: +; CHECKRV64IZFINXZDINX: # %bb.0: +; CHECKRV64IZFINXZDINX-NEXT: fle.d a0, a1, a0 +; CHECKRV64IZFINXZDINX-NEXT: ret +; CHECKIZFINXZDINX-LABEL: fcmps_oge: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: fle.d a0, a1, a0 +; CHECKIZFINXZDINX-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmps.f64(double %a, double %b, metadata !"oge", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 @@ -659,6 +1640,26 @@ ; CHECKIFD-NEXT: flt.d a0, fa0, fa1 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcmps_olt: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: flt.d a0, a0, a2 +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcmps_olt: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: flt.d a0, a0, a1 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcmps_olt: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -678,6 +1679,26 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKRVZDINX-LABEL: fcmps_olt: +; CHECKRVZDINX: # %bb.0: +; CHECKRVZDINX-NEXT: addi sp, sp, -16 +; CHECKRVZDINX-NEXT: sw a2, 8(sp) +; CHECKRVZDINX-NEXT: sw a3, 12(sp) +; CHECKRVZDINX-NEXT: ld a2, 8(sp) +; CHECKRVZDINX-NEXT: sw a0, 8(sp) +; CHECKRVZDINX-NEXT: sw a1, 12(sp) +; CHECKRVZDINX-NEXT: ld a0, 8(sp) +; CHECKRVZDINX-NEXT: flt.d a0, a0, a2 +; CHECKRVZDINX-NEXT: addi sp, sp, 16 +; CHECKRVZDINX-NEXT: ret +; CHECKRV64IZFINXZDINX-LABEL: fcmps_olt: +; CHECKRV64IZFINXZDINX: # %bb.0: +; CHECKRV64IZFINXZDINX-NEXT: flt.d a0, a0, a1 +; CHECKRV64IZFINXZDINX-NEXT: ret +; CHECKIZFINXZDINX-LABEL: fcmps_olt: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: flt.d a0, a0, a1 +; CHECKIZFINXZDINX-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmps.f64(double %a, double %b, metadata !"olt", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 @@ -689,6 +1710,26 @@ ; CHECKIFD-NEXT: fle.d a0, fa0, fa1 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcmps_ole: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fle.d a0, a0, a2 +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcmps_ole: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fle.d a0, a0, a1 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcmps_ole: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -708,6 +1749,26 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKRVZDINX-LABEL: fcmps_ole: +; CHECKRVZDINX: # %bb.0: +; CHECKRVZDINX-NEXT: addi sp, sp, -16 +; CHECKRVZDINX-NEXT: sw a2, 8(sp) +; CHECKRVZDINX-NEXT: sw a3, 12(sp) +; CHECKRVZDINX-NEXT: ld a2, 8(sp) +; CHECKRVZDINX-NEXT: sw a0, 8(sp) +; CHECKRVZDINX-NEXT: sw a1, 12(sp) +; CHECKRVZDINX-NEXT: ld a0, 8(sp) +; CHECKRVZDINX-NEXT: fle.d a0, a0, a2 +; CHECKRVZDINX-NEXT: addi sp, sp, 16 +; CHECKRVZDINX-NEXT: ret +; CHECKRV64IZFINXZDINX-LABEL: fcmps_ole: +; CHECKRV64IZFINXZDINX: # %bb.0: +; CHECKRV64IZFINXZDINX-NEXT: fle.d a0, a0, a1 +; CHECKRV64IZFINXZDINX-NEXT: ret +; CHECKIZFINXZDINX-LABEL: fcmps_ole: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: fle.d a0, a0, a1 +; CHECKIZFINXZDINX-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmps.f64(double %a, double %b, metadata !"ole", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 @@ -721,6 +1782,30 @@ ; CHECKIFD-NEXT: or a0, a1, a0 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcmps_one: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: flt.d a4, a0, a2 +; RV32IZFINXZDINX-NEXT: flt.d a0, a2, a0 +; RV32IZFINXZDINX-NEXT: or a0, a0, a4 +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcmps_one: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: flt.d a2, a0, a1 +; RV64IZFINXZDINX-NEXT: flt.d a0, a1, a0 +; RV64IZFINXZDINX-NEXT: or a0, a0, a2 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcmps_one: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -32 @@ -774,6 +1859,32 @@ ; RV64I-NEXT: ld s2, 0(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 32 ; RV64I-NEXT: ret +; CHECKRVZDINX-LABEL: fcmps_one: +; CHECKRVZDINX: # %bb.0: +; CHECKRVZDINX-NEXT: addi sp, sp, -16 +; CHECKRVZDINX-NEXT: sw a2, 8(sp) +; CHECKRVZDINX-NEXT: sw a3, 12(sp) +; CHECKRVZDINX-NEXT: ld a2, 8(sp) +; CHECKRVZDINX-NEXT: sw a0, 8(sp) +; CHECKRVZDINX-NEXT: sw a1, 12(sp) +; CHECKRVZDINX-NEXT: ld a0, 8(sp) +; CHECKRVZDINX-NEXT: flt.d a4, a0, a2 +; CHECKRVZDINX-NEXT: flt.d a0, a2, a0 +; CHECKRVZDINX-NEXT: or a0, a0, a4 +; CHECKRVZDINX-NEXT: addi sp, sp, 16 +; CHECKRVZDINX-NEXT: ret +; CHECKRV64IZFINXZDINX-LABEL: fcmps_one: +; CHECKRV64IZFINXZDINX: # %bb.0: +; CHECKRV64IZFINXZDINX-NEXT: flt.d a2, a0, a1 +; CHECKRV64IZFINXZDINX-NEXT: flt.d a0, a1, a0 +; CHECKRV64IZFINXZDINX-NEXT: or a0, a0, a2 +; CHECKRV64IZFINXZDINX-NEXT: ret +; CHECKIZFINXZDINX-LABEL: fcmps_one: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: flt.d a2, a0, a1 +; CHECKIZFINXZDINX-NEXT: flt.d a0, a1, a0 +; CHECKIZFINXZDINX-NEXT: or a0, a0, a2 +; CHECKIZFINXZDINX-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmps.f64(double %a, double %b, metadata !"one", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 @@ -787,6 +1898,30 @@ ; CHECKIFD-NEXT: and a0, a1, a0 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcmps_ord: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: fle.d a2, a2, a2 +; RV32IZFINXZDINX-NEXT: fle.d a0, a0, a0 +; RV32IZFINXZDINX-NEXT: and a0, a0, a2 +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcmps_ord: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fle.d a1, a1, a1 +; RV64IZFINXZDINX-NEXT: fle.d a0, a0, a0 +; RV64IZFINXZDINX-NEXT: and a0, a0, a1 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcmps_ord: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -806,6 +1941,32 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKRVZDINX-LABEL: fcmps_ord: +; CHECKRVZDINX: # %bb.0: +; CHECKRVZDINX-NEXT: addi sp, sp, -16 +; CHECKRVZDINX-NEXT: sw a0, 8(sp) +; CHECKRVZDINX-NEXT: sw a1, 12(sp) +; CHECKRVZDINX-NEXT: ld a0, 8(sp) +; CHECKRVZDINX-NEXT: sw a2, 8(sp) +; CHECKRVZDINX-NEXT: sw a3, 12(sp) +; CHECKRVZDINX-NEXT: ld a2, 8(sp) +; CHECKRVZDINX-NEXT: fle.d a2, a2, a2 +; CHECKRVZDINX-NEXT: fle.d a0, a0, a0 +; CHECKRVZDINX-NEXT: and a0, a0, a2 +; CHECKRVZDINX-NEXT: addi sp, sp, 16 +; CHECKRVZDINX-NEXT: ret +; CHECKRV64IZFINXZDINX-LABEL: fcmps_ord: +; CHECKRV64IZFINXZDINX: # %bb.0: +; CHECKRV64IZFINXZDINX-NEXT: fle.d a1, a1, a1 +; CHECKRV64IZFINXZDINX-NEXT: fle.d a0, a0, a0 +; CHECKRV64IZFINXZDINX-NEXT: and a0, a0, a1 +; CHECKRV64IZFINXZDINX-NEXT: ret +; CHECKIZFINXZDINX-LABEL: fcmps_ord: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: fle.d a1, a1, a1 +; CHECKIZFINXZDINX-NEXT: fle.d a0, a0, a0 +; CHECKIZFINXZDINX-NEXT: and a0, a0, a1 +; CHECKIZFINXZDINX-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmps.f64(double %a, double %b, metadata !"ord", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 @@ -820,6 +1981,32 @@ ; CHECKIFD-NEXT: xori a0, a0, 1 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcmps_ueq: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: flt.d a4, a0, a2 +; RV32IZFINXZDINX-NEXT: flt.d a0, a2, a0 +; RV32IZFINXZDINX-NEXT: or a0, a0, a4 +; RV32IZFINXZDINX-NEXT: xori a0, a0, 1 +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcmps_ueq: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: flt.d a2, a0, a1 +; RV64IZFINXZDINX-NEXT: flt.d a0, a1, a0 +; RV64IZFINXZDINX-NEXT: or a0, a0, a2 +; RV64IZFINXZDINX-NEXT: xori a0, a0, 1 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcmps_ueq: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -32 @@ -873,6 +2060,35 @@ ; RV64I-NEXT: ld s2, 0(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 32 ; RV64I-NEXT: ret +; CHECKRVZDINX-LABEL: fcmps_ueq: +; CHECKRVZDINX: # %bb.0: +; CHECKRVZDINX-NEXT: addi sp, sp, -16 +; CHECKRVZDINX-NEXT: sw a2, 8(sp) +; CHECKRVZDINX-NEXT: sw a3, 12(sp) +; CHECKRVZDINX-NEXT: ld a2, 8(sp) +; CHECKRVZDINX-NEXT: sw a0, 8(sp) +; CHECKRVZDINX-NEXT: sw a1, 12(sp) +; CHECKRVZDINX-NEXT: ld a0, 8(sp) +; CHECKRVZDINX-NEXT: flt.d a4, a0, a2 +; CHECKRVZDINX-NEXT: flt.d a0, a2, a0 +; CHECKRVZDINX-NEXT: or a0, a0, a4 +; CHECKRVZDINX-NEXT: xori a0, a0, 1 +; CHECKRVZDINX-NEXT: addi sp, sp, 16 +; CHECKRVZDINX-NEXT: ret +; CHECKRV64IZFINXZDINX-LABEL: fcmps_ueq: +; CHECKRV64IZFINXZDINX: # %bb.0: +; CHECKRV64IZFINXZDINX-NEXT: flt.d a2, a0, a1 +; CHECKRV64IZFINXZDINX-NEXT: flt.d a0, a1, a0 +; CHECKRV64IZFINXZDINX-NEXT: or a0, a0, a2 +; CHECKRV64IZFINXZDINX-NEXT: xori a0, a0, 1 +; CHECKRV64IZFINXZDINX-NEXT: ret +; CHECKIZFINXZDINX-LABEL: fcmps_ueq: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: flt.d a2, a0, a1 +; CHECKIZFINXZDINX-NEXT: flt.d a0, a1, a0 +; CHECKIZFINXZDINX-NEXT: or a0, a0, a2 +; CHECKIZFINXZDINX-NEXT: xori a0, a0, 1 +; CHECKIZFINXZDINX-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmps.f64(double %a, double %b, metadata !"ueq", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 @@ -885,6 +2101,28 @@ ; CHECKIFD-NEXT: xori a0, a0, 1 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcmps_ugt: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fle.d a0, a0, a2 +; RV32IZFINXZDINX-NEXT: xori a0, a0, 1 +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcmps_ugt: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fle.d a0, a0, a1 +; RV64IZFINXZDINX-NEXT: xori a0, a0, 1 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcmps_ugt: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -904,6 +2142,29 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKRVZDINX-LABEL: fcmps_ugt: +; CHECKRVZDINX: # %bb.0: +; CHECKRVZDINX-NEXT: addi sp, sp, -16 +; CHECKRVZDINX-NEXT: sw a2, 8(sp) +; CHECKRVZDINX-NEXT: sw a3, 12(sp) +; CHECKRVZDINX-NEXT: ld a2, 8(sp) +; CHECKRVZDINX-NEXT: sw a0, 8(sp) +; CHECKRVZDINX-NEXT: sw a1, 12(sp) +; CHECKRVZDINX-NEXT: ld a0, 8(sp) +; CHECKRVZDINX-NEXT: fle.d a0, a0, a2 +; CHECKRVZDINX-NEXT: xori a0, a0, 1 +; CHECKRVZDINX-NEXT: addi sp, sp, 16 +; CHECKRVZDINX-NEXT: ret +; CHECKRV64IZFINXZDINX-LABEL: fcmps_ugt: +; CHECKRV64IZFINXZDINX: # %bb.0: +; CHECKRV64IZFINXZDINX-NEXT: fle.d a0, a0, a1 +; CHECKRV64IZFINXZDINX-NEXT: xori a0, a0, 1 +; CHECKRV64IZFINXZDINX-NEXT: ret +; CHECKIZFINXZDINX-LABEL: fcmps_ugt: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: fle.d a0, a0, a1 +; CHECKIZFINXZDINX-NEXT: xori a0, a0, 1 +; CHECKIZFINXZDINX-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmps.f64(double %a, double %b, metadata !"ugt", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 @@ -916,6 +2177,28 @@ ; CHECKIFD-NEXT: xori a0, a0, 1 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcmps_uge: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: flt.d a0, a0, a2 +; RV32IZFINXZDINX-NEXT: xori a0, a0, 1 +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcmps_uge: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: flt.d a0, a0, a1 +; RV64IZFINXZDINX-NEXT: xori a0, a0, 1 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcmps_uge: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -937,6 +2220,29 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKRVZDINX-LABEL: fcmps_uge: +; CHECKRVZDINX: # %bb.0: +; CHECKRVZDINX-NEXT: addi sp, sp, -16 +; CHECKRVZDINX-NEXT: sw a2, 8(sp) +; CHECKRVZDINX-NEXT: sw a3, 12(sp) +; CHECKRVZDINX-NEXT: ld a2, 8(sp) +; CHECKRVZDINX-NEXT: sw a0, 8(sp) +; CHECKRVZDINX-NEXT: sw a1, 12(sp) +; CHECKRVZDINX-NEXT: ld a0, 8(sp) +; CHECKRVZDINX-NEXT: flt.d a0, a0, a2 +; CHECKRVZDINX-NEXT: xori a0, a0, 1 +; CHECKRVZDINX-NEXT: addi sp, sp, 16 +; CHECKRVZDINX-NEXT: ret +; CHECKRV64IZFINXZDINX-LABEL: fcmps_uge: +; CHECKRV64IZFINXZDINX: # %bb.0: +; CHECKRV64IZFINXZDINX-NEXT: flt.d a0, a0, a1 +; CHECKRV64IZFINXZDINX-NEXT: xori a0, a0, 1 +; CHECKRV64IZFINXZDINX-NEXT: ret +; CHECKIZFINXZDINX-LABEL: fcmps_uge: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: flt.d a0, a0, a1 +; CHECKIZFINXZDINX-NEXT: xori a0, a0, 1 +; CHECKIZFINXZDINX-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmps.f64(double %a, double %b, metadata !"uge", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 @@ -949,6 +2255,28 @@ ; CHECKIFD-NEXT: xori a0, a0, 1 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcmps_ult: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: fle.d a0, a2, a0 +; RV32IZFINXZDINX-NEXT: xori a0, a0, 1 +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcmps_ult: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fle.d a0, a1, a0 +; RV64IZFINXZDINX-NEXT: xori a0, a0, 1 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcmps_ult: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -968,6 +2296,29 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKRVZDINX-LABEL: fcmps_ult: +; CHECKRVZDINX: # %bb.0: +; CHECKRVZDINX-NEXT: addi sp, sp, -16 +; CHECKRVZDINX-NEXT: sw a0, 8(sp) +; CHECKRVZDINX-NEXT: sw a1, 12(sp) +; CHECKRVZDINX-NEXT: ld a0, 8(sp) +; CHECKRVZDINX-NEXT: sw a2, 8(sp) +; CHECKRVZDINX-NEXT: sw a3, 12(sp) +; CHECKRVZDINX-NEXT: ld a2, 8(sp) +; CHECKRVZDINX-NEXT: fle.d a0, a2, a0 +; CHECKRVZDINX-NEXT: xori a0, a0, 1 +; CHECKRVZDINX-NEXT: addi sp, sp, 16 +; CHECKRVZDINX-NEXT: ret +; CHECKRV64IZFINXZDINX-LABEL: fcmps_ult: +; CHECKRV64IZFINXZDINX: # %bb.0: +; CHECKRV64IZFINXZDINX-NEXT: fle.d a0, a1, a0 +; CHECKRV64IZFINXZDINX-NEXT: xori a0, a0, 1 +; CHECKRV64IZFINXZDINX-NEXT: ret +; CHECKIZFINXZDINX-LABEL: fcmps_ult: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: fle.d a0, a1, a0 +; CHECKIZFINXZDINX-NEXT: xori a0, a0, 1 +; CHECKIZFINXZDINX-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmps.f64(double %a, double %b, metadata !"ult", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 @@ -980,6 +2331,28 @@ ; CHECKIFD-NEXT: xori a0, a0, 1 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcmps_ule: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: flt.d a0, a2, a0 +; RV32IZFINXZDINX-NEXT: xori a0, a0, 1 +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcmps_ule: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: flt.d a0, a1, a0 +; RV64IZFINXZDINX-NEXT: xori a0, a0, 1 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcmps_ule: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -999,6 +2372,29 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKRVZDINX-LABEL: fcmps_ule: +; CHECKRVZDINX: # %bb.0: +; CHECKRVZDINX-NEXT: addi sp, sp, -16 +; CHECKRVZDINX-NEXT: sw a0, 8(sp) +; CHECKRVZDINX-NEXT: sw a1, 12(sp) +; CHECKRVZDINX-NEXT: ld a0, 8(sp) +; CHECKRVZDINX-NEXT: sw a2, 8(sp) +; CHECKRVZDINX-NEXT: sw a3, 12(sp) +; CHECKRVZDINX-NEXT: ld a2, 8(sp) +; CHECKRVZDINX-NEXT: flt.d a0, a2, a0 +; CHECKRVZDINX-NEXT: xori a0, a0, 1 +; CHECKRVZDINX-NEXT: addi sp, sp, 16 +; CHECKRVZDINX-NEXT: ret +; CHECKRV64IZFINXZDINX-LABEL: fcmps_ule: +; CHECKRV64IZFINXZDINX: # %bb.0: +; CHECKRV64IZFINXZDINX-NEXT: flt.d a0, a1, a0 +; CHECKRV64IZFINXZDINX-NEXT: xori a0, a0, 1 +; CHECKRV64IZFINXZDINX-NEXT: ret +; CHECKIZFINXZDINX-LABEL: fcmps_ule: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: flt.d a0, a1, a0 +; CHECKIZFINXZDINX-NEXT: xori a0, a0, 1 +; CHECKIZFINXZDINX-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmps.f64(double %a, double %b, metadata !"ule", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 @@ -1013,6 +2409,32 @@ ; CHECKIFD-NEXT: xori a0, a0, 1 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcmps_une: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: fle.d a4, a2, a0 +; RV32IZFINXZDINX-NEXT: fle.d a0, a0, a2 +; RV32IZFINXZDINX-NEXT: and a0, a0, a4 +; RV32IZFINXZDINX-NEXT: xori a0, a0, 1 +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcmps_une: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fle.d a2, a1, a0 +; RV64IZFINXZDINX-NEXT: fle.d a0, a0, a1 +; RV64IZFINXZDINX-NEXT: and a0, a0, a2 +; RV64IZFINXZDINX-NEXT: xori a0, a0, 1 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcmps_une: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -1032,6 +2454,35 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKRVZDINX-LABEL: fcmps_une: +; CHECKRVZDINX: # %bb.0: +; CHECKRVZDINX-NEXT: addi sp, sp, -16 +; CHECKRVZDINX-NEXT: sw a0, 8(sp) +; CHECKRVZDINX-NEXT: sw a1, 12(sp) +; CHECKRVZDINX-NEXT: ld a0, 8(sp) +; CHECKRVZDINX-NEXT: sw a2, 8(sp) +; CHECKRVZDINX-NEXT: sw a3, 12(sp) +; CHECKRVZDINX-NEXT: ld a2, 8(sp) +; CHECKRVZDINX-NEXT: fle.d a4, a2, a0 +; CHECKRVZDINX-NEXT: fle.d a0, a0, a2 +; CHECKRVZDINX-NEXT: and a0, a0, a4 +; CHECKRVZDINX-NEXT: xori a0, a0, 1 +; CHECKRVZDINX-NEXT: addi sp, sp, 16 +; CHECKRVZDINX-NEXT: ret +; CHECKRV64IZFINXZDINX-LABEL: fcmps_une: +; CHECKRV64IZFINXZDINX: # %bb.0: +; CHECKRV64IZFINXZDINX-NEXT: fle.d a2, a1, a0 +; CHECKRV64IZFINXZDINX-NEXT: fle.d a0, a0, a1 +; CHECKRV64IZFINXZDINX-NEXT: and a0, a0, a2 +; CHECKRV64IZFINXZDINX-NEXT: xori a0, a0, 1 +; CHECKRV64IZFINXZDINX-NEXT: ret +; CHECKIZFINXZDINX-LABEL: fcmps_une: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: fle.d a2, a1, a0 +; CHECKIZFINXZDINX-NEXT: fle.d a0, a0, a1 +; CHECKIZFINXZDINX-NEXT: and a0, a0, a2 +; CHECKIZFINXZDINX-NEXT: xori a0, a0, 1 +; CHECKIZFINXZDINX-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmps.f64(double %a, double %b, metadata !"une", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 @@ -1046,6 +2497,32 @@ ; CHECKIFD-NEXT: xori a0, a0, 1 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fcmps_uno: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: fle.d a2, a2, a2 +; RV32IZFINXZDINX-NEXT: fle.d a0, a0, a0 +; RV32IZFINXZDINX-NEXT: and a0, a0, a2 +; RV32IZFINXZDINX-NEXT: xori a0, a0, 1 +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fcmps_uno: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fle.d a1, a1, a1 +; RV64IZFINXZDINX-NEXT: fle.d a0, a0, a0 +; RV64IZFINXZDINX-NEXT: and a0, a0, a1 +; RV64IZFINXZDINX-NEXT: xori a0, a0, 1 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcmps_uno: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -1065,6 +2542,35 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKRVZDINX-LABEL: fcmps_uno: +; CHECKRVZDINX: # %bb.0: +; CHECKRVZDINX-NEXT: addi sp, sp, -16 +; CHECKRVZDINX-NEXT: sw a0, 8(sp) +; CHECKRVZDINX-NEXT: sw a1, 12(sp) +; CHECKRVZDINX-NEXT: ld a0, 8(sp) +; CHECKRVZDINX-NEXT: sw a2, 8(sp) +; CHECKRVZDINX-NEXT: sw a3, 12(sp) +; CHECKRVZDINX-NEXT: ld a2, 8(sp) +; CHECKRVZDINX-NEXT: fle.d a2, a2, a2 +; CHECKRVZDINX-NEXT: fle.d a0, a0, a0 +; CHECKRVZDINX-NEXT: and a0, a0, a2 +; CHECKRVZDINX-NEXT: xori a0, a0, 1 +; CHECKRVZDINX-NEXT: addi sp, sp, 16 +; CHECKRVZDINX-NEXT: ret +; CHECKRV64IZFINXZDINX-LABEL: fcmps_uno: +; CHECKRV64IZFINXZDINX: # %bb.0: +; CHECKRV64IZFINXZDINX-NEXT: fle.d a1, a1, a1 +; CHECKRV64IZFINXZDINX-NEXT: fle.d a0, a0, a0 +; CHECKRV64IZFINXZDINX-NEXT: and a0, a0, a1 +; CHECKRV64IZFINXZDINX-NEXT: xori a0, a0, 1 +; CHECKRV64IZFINXZDINX-NEXT: ret +; CHECKIZFINXZDINX-LABEL: fcmps_uno: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: fle.d a1, a1, a1 +; CHECKIZFINXZDINX-NEXT: fle.d a0, a0, a0 +; CHECKIZFINXZDINX-NEXT: and a0, a0, a1 +; CHECKIZFINXZDINX-NEXT: xori a0, a0, 1 +; CHECKIZFINXZDINX-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmps.f64(double %a, double %b, metadata !"uno", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 diff --git a/llvm/test/CodeGen/RISCV/double-fcmp.ll b/llvm/test/CodeGen/RISCV/double-fcmp.ll --- a/llvm/test/CodeGen/RISCV/double-fcmp.ll +++ b/llvm/test/CodeGen/RISCV/double-fcmp.ll @@ -3,6 +3,10 @@ ; RUN: -target-abi=ilp32d | FileCheck -check-prefix=CHECKIFD %s ; RUN: llc -mtriple=riscv64 -mattr=+d -verify-machineinstrs < %s \ ; RUN: -target-abi=lp64d | FileCheck -check-prefix=CHECKIFD %s +; RUN: llc -mtriple=riscv32 -mattr=+zdinx -verify-machineinstrs < %s \ +; RUN: -target-abi=ilp32 | FileCheck -check-prefix=CHECKIZFINXZDINX %s +; RUN: llc -mtriple=riscv64 -mattr=+zdinx -verify-machineinstrs < %s \ +; RUN: -target-abi=lp64 | FileCheck -check-prefix=CHECKIZFINXZDINX %s ; RUN: llc -mtriple=riscv32 -verify-machineinstrs < %s \ ; RUN: | FileCheck -check-prefix=RV32I %s ; RUN: llc -mtriple=riscv64 -verify-machineinstrs < %s \ @@ -14,6 +18,11 @@ ; CHECKIFD-NEXT: li a0, 0 ; CHECKIFD-NEXT: ret ; +; CHECKIZFINXZDINX-LABEL: fcmp_false: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: li a0, 0 +; CHECKIZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcmp_false: ; RV32I: # %bb.0: ; RV32I-NEXT: li a0, 0 @@ -541,6 +550,11 @@ ; CHECKIFD-NEXT: li a0, 1 ; CHECKIFD-NEXT: ret ; +; CHECKIZFINXZDINX-LABEL: fcmp_true: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: li a0, 1 +; CHECKIZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fcmp_true: ; RV32I: # %bb.0: ; RV32I-NEXT: li a0, 1 diff --git a/llvm/test/CodeGen/RISCV/double-frem.ll b/llvm/test/CodeGen/RISCV/double-frem.ll --- a/llvm/test/CodeGen/RISCV/double-frem.ll +++ b/llvm/test/CodeGen/RISCV/double-frem.ll @@ -3,6 +3,10 @@ ; RUN: | FileCheck -check-prefix=RV32IFD %s ; RUN: llc -mtriple=riscv64 -mattr=+d -verify-machineinstrs < %s \ ; RUN: | FileCheck -check-prefix=RV64IFD %s +; RUN: llc -mtriple=riscv32 -mattr=+zdinx -verify-machineinstrs < %s \ +; RUN: | FileCheck -check-prefix=RV32IZFINXZDINX %s +; RUN: llc -mtriple=riscv64 -mattr=+zdinx -verify-machineinstrs < %s \ +; RUN: | FileCheck -check-prefix=RV64IZFINXZDINX %s define double @frem_f64(double %a, double %b) nounwind { ; RV32IFD-LABEL: frem_f64: @@ -12,6 +16,24 @@ ; RV64IFD-LABEL: frem_f64: ; RV64IFD: # %bb.0: ; RV64IFD-NEXT: tail fmod@plt +; +; RV32IZFINXZDINX-LABEL: frem_f64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: call fmod@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: frem_f64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV64IZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: call fmod@plt +; RV64IZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV64IZFINXZDINX-NEXT: ret %1 = frem double %a, %b ret double %1 } diff --git a/llvm/test/CodeGen/RISCV/double-imm.ll b/llvm/test/CodeGen/RISCV/double-imm.ll --- a/llvm/test/CodeGen/RISCV/double-imm.ll +++ b/llvm/test/CodeGen/RISCV/double-imm.ll @@ -3,6 +3,10 @@ ; RUN: -target-abi=ilp32d | FileCheck %s ; RUN: llc -mtriple=riscv64 -mattr=+d -verify-machineinstrs < %s \ ; RUN: -target-abi=lp64d | FileCheck %s +; RUN: llc -mtriple=riscv32 -mattr=+zdinx -verify-machineinstrs < %s \ +; RUN: -target-abi=ilp32 | FileCheck --check-prefix=CHECKRV32ZDINX %s +; RUN: llc -mtriple=riscv64 -mattr=+zdinx -verify-machineinstrs < %s \ +; RUN: -target-abi=lp64 | FileCheck --check-prefix=CHECKRV64ZDINX %s define double @double_imm() nounwind { ; CHECK-LABEL: double_imm: @@ -10,6 +14,25 @@ ; CHECK-NEXT: lui a0, %hi(.LCPI0_0) ; CHECK-NEXT: fld fa0, %lo(.LCPI0_0)(a0) ; CHECK-NEXT: ret +; +; CHECKRV32ZDINX-LABEL: double_imm: +; CHECKRV32ZDINX: # %bb.0: +; CHECKRV32ZDINX-NEXT: lui a0, 345155 +; CHECKRV32ZDINX-NEXT: addi a0, a0, -744 +; CHECKRV32ZDINX-NEXT: lui a1, 262290 +; CHECKRV32ZDINX-NEXT: addi a1, a1, 507 +; CHECKRV32ZDINX-NEXT: ret +; +; CHECKRV64ZDINX-LABEL: double_imm: +; CHECKRV64ZDINX: # %bb.0: +; CHECKRV64ZDINX-NEXT: lui a0, %hi(.LCPI0_0) +; CHECKRV64ZDINX-NEXT: ld a0, %lo(.LCPI0_0)(a0) +; CHECKRV64ZDINX-NEXT: ret +; CHECKZDINX-LABEL: double_imm: +; CHECKZDINX: # %bb.0: +; CHECKZDINX-NEXT: lui a0, %hi(.LCPI0_0) +; CHECKZDINX-NEXT: ld a0, %lo(.LCPI0_0)(a0) +; CHECKZDINX-NEXT: ret ret double 3.1415926535897931159979634685441851615905761718750 } @@ -20,6 +43,38 @@ ; CHECK-NEXT: fld ft0, %lo(.LCPI1_0)(a0) ; CHECK-NEXT: fadd.d fa0, fa0, ft0 ; CHECK-NEXT: ret +; +; CHECKRV32ZDINX-LABEL: double_imm_op: +; CHECKRV32ZDINX: # %bb.0: +; CHECKRV32ZDINX-NEXT: addi sp, sp, -16 +; CHECKRV32ZDINX-NEXT: sw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: sw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: lw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: lw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: lui a2, %hi(.LCPI1_0) +; CHECKRV32ZDINX-NEXT: lw a2, %lo(.LCPI1_0)(a2) +; CHECKRV32ZDINX-NEXT: lw a3, %lo(.LCPI1_0+4)(a2) +; CHECKRV32ZDINX-NEXT: fadd.d a0, a0, a2 +; CHECKRV32ZDINX-NEXT: sw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: sw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: lw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: lw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: addi sp, sp, 16 +; CHECKRV32ZDINX-NEXT: ret +; +; CHECKRV64ZDINX-LABEL: double_imm_op: +; CHECKRV64ZDINX: # %bb.0: +; CHECKRV64ZDINX-NEXT: lui a1, %hi(.LCPI1_0) +; CHECKRV64ZDINX-NEXT: addi a1, a1, %lo(.LCPI1_0) +; CHECKRV64ZDINX-NEXT: ld a1, 0(a1) +; CHECKRV64ZDINX-NEXT: fadd.d a0, a0, a1 +; CHECKRV64ZDINX-NEXT: ret +; CHECKZDINX-LABEL: double_imm_op: +; CHECKZDINX: # %bb.0: +; CHECKZDINX-NEXT: lui a1, %hi(.LCPI1_0) +; CHECKZDINX-NEXT: ld a1, %lo(.LCPI1_0)(a1) +; CHECKZDINX-NEXT: fadd.d a0, a0, a1 +; CHECKZDINX-NEXT: ret %1 = fadd double %a, 1.0 ret double %1 } diff --git a/llvm/test/CodeGen/RISCV/double-intrinsics-strict.ll b/llvm/test/CodeGen/RISCV/double-intrinsics-strict.ll --- a/llvm/test/CodeGen/RISCV/double-intrinsics-strict.ll +++ b/llvm/test/CodeGen/RISCV/double-intrinsics-strict.ll @@ -5,6 +5,12 @@ ; RUN: sed 's/iXLen/i64/g' %s | llc -mtriple=riscv64 -mattr=+d \ ; RUN: -verify-machineinstrs -disable-strictnode-mutation -target-abi=lp64d \ ; RUN: | FileCheck -check-prefixes=CHECKIFD,RV64IFD %s +; RUN: sed 's/iXLen/i32/g' %s | llc -mtriple=riscv32 -mattr=+zdinx \ +; RUN: -verify-machineinstrs -disable-strictnode-mutation -target-abi=ilp32 \ +; RUN: | FileCheck -check-prefix=RV32IZFINXZDINX %s +; RUN: sed 's/iXLen/i64/g' %s | llc -mtriple=riscv64 -mattr=+zdinx \ +; RUN: -verify-machineinstrs -disable-strictnode-mutation -target-abi=lp64 \ +; RUN: | FileCheck -check-prefix=RV64IZFINXZDINX %s ; RUN: sed 's/iXLen/i32/g' %s | llc -mtriple=riscv32 \ ; RUN: -verify-machineinstrs -disable-strictnode-mutation \ ; RUN: | FileCheck -check-prefix=RV32I %s @@ -20,6 +26,26 @@ ; CHECKIFD-NEXT: fsqrt.d fa0, fa0 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: sqrt_f64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fsqrt.d a0, a0 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: sqrt_f64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fsqrt.d a0, a0 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: sqrt_f64: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -37,6 +63,10 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKIZFINXZDINX-LABEL: sqrt_f64: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: fsqrt.d a0, a0 +; CHECKIZFINXZDINX-NEXT: ret %1 = call double @llvm.experimental.constrained.sqrt.f64(double %a, metadata !"round.dynamic", metadata !"fpexcept.strict") strictfp ret double %1 } @@ -63,6 +93,25 @@ ; RV64IFD-NEXT: addi sp, sp, 16 ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: powi_f64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: call __powidf2@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: powi_f64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV64IZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: sext.w a1, a1 +; RV64IZFINXZDINX-NEXT: call __powidf2@plt +; RV64IZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: powi_f64: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -81,6 +130,15 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKIZFINXZDINX-LABEL: powi_f64: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: addi sp, sp, -16 +; CHECKIZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; CHECKIZFINXZDINX-NEXT: sext.w a1, a1 +; CHECKIZFINXZDINX-NEXT: call __powidf2@plt +; CHECKIZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; CHECKIZFINXZDINX-NEXT: addi sp, sp, 16 +; CHECKIZFINXZDINX-NEXT: ret %1 = call double @llvm.experimental.constrained.powi.f64.i32(double %a, i32 %b, metadata !"round.dynamic", metadata !"fpexcept.strict") strictfp ret double %1 } @@ -106,6 +164,24 @@ ; RV64IFD-NEXT: addi sp, sp, 16 ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: sin_f64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: call sin@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: sin_f64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV64IZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: call sin@plt +; RV64IZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: sin_f64: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -123,6 +199,14 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKIZFINXZDINX-LABEL: sin_f64: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: addi sp, sp, -16 +; CHECKIZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; CHECKIZFINXZDINX-NEXT: call sin@plt +; CHECKIZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; CHECKIZFINXZDINX-NEXT: addi sp, sp, 16 +; CHECKIZFINXZDINX-NEXT: ret %1 = call double @llvm.experimental.constrained.sin.f64(double %a, metadata !"round.dynamic", metadata !"fpexcept.strict") strictfp ret double %1 } @@ -148,6 +232,24 @@ ; RV64IFD-NEXT: addi sp, sp, 16 ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: cos_f64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: call cos@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: cos_f64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV64IZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: call cos@plt +; RV64IZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: cos_f64: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -165,6 +267,14 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKIZFINXZDINX-LABEL: cos_f64: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: addi sp, sp, -16 +; CHECKIZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; CHECKIZFINXZDINX-NEXT: call cos@plt +; CHECKIZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; CHECKIZFINXZDINX-NEXT: addi sp, sp, 16 +; CHECKIZFINXZDINX-NEXT: ret %1 = call double @llvm.experimental.constrained.cos.f64(double %a, metadata !"round.dynamic", metadata !"fpexcept.strict") strictfp ret double %1 } @@ -207,6 +317,59 @@ ; RV64IFD-NEXT: addi sp, sp, 32 ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: sincos_f64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -32 +; RV32IZFINXZDINX-NEXT: sw ra, 28(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: sw s0, 24(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: sw s1, 20(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: mv s0, a1 +; RV32IZFINXZDINX-NEXT: mv s1, a0 +; RV32IZFINXZDINX-NEXT: call sin@plt +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 0(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 4(sp) +; RV32IZFINXZDINX-NEXT: mv a0, s1 +; RV32IZFINXZDINX-NEXT: mv a1, s0 +; RV32IZFINXZDINX-NEXT: call cos@plt +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 0(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 4(sp) +; RV32IZFINXZDINX-NEXT: fadd.d a0, a2, a0 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw ra, 28(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: lw s0, 24(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: lw s1, 20(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 32 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: sincos_f64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: addi sp, sp, -32 +; RV64IZFINXZDINX-NEXT: sd ra, 24(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: sd s0, 16(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: sd s1, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: mv s0, a0 +; RV64IZFINXZDINX-NEXT: call sin@plt +; RV64IZFINXZDINX-NEXT: mv s1, a0 +; RV64IZFINXZDINX-NEXT: mv a0, s0 +; RV64IZFINXZDINX-NEXT: call cos@plt +; RV64IZFINXZDINX-NEXT: fadd.d a0, s1, a0 +; RV64IZFINXZDINX-NEXT: ld ra, 24(sp) # 8-byte Folded Reload +; RV64IZFINXZDINX-NEXT: ld s0, 16(sp) # 8-byte Folded Reload +; RV64IZFINXZDINX-NEXT: ld s1, 8(sp) # 8-byte Folded Reload +; RV64IZFINXZDINX-NEXT: addi sp, sp, 32 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: sincos_f64: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -32 @@ -255,6 +418,23 @@ ; RV64I-NEXT: ld s1, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 32 ; RV64I-NEXT: ret +; CHECKIZFINXZDINX-LABEL: sincos_f64: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: addi sp, sp, -32 +; CHECKIZFINXZDINX-NEXT: sd ra, 24(sp) # 8-byte Folded Spill +; CHECKIZFINXZDINX-NEXT: sd s0, 16(sp) # 8-byte Folded Spill +; CHECKIZFINXZDINX-NEXT: sd s1, 8(sp) # 8-byte Folded Spill +; CHECKIZFINXZDINX-NEXT: mv s0, a0 +; CHECKIZFINXZDINX-NEXT: call sin@plt +; CHECKIZFINXZDINX-NEXT: mv s1, a0 +; CHECKIZFINXZDINX-NEXT: mv a0, s0 +; CHECKIZFINXZDINX-NEXT: call cos@plt +; CHECKIZFINXZDINX-NEXT: fadd.d a0, s1, a0 +; CHECKIZFINXZDINX-NEXT: ld ra, 24(sp) # 8-byte Folded Reload +; CHECKIZFINXZDINX-NEXT: ld s0, 16(sp) # 8-byte Folded Reload +; CHECKIZFINXZDINX-NEXT: ld s1, 8(sp) # 8-byte Folded Reload +; CHECKIZFINXZDINX-NEXT: addi sp, sp, 32 +; CHECKIZFINXZDINX-NEXT: ret %1 = call double @llvm.experimental.constrained.sin.f64(double %a, metadata !"round.dynamic", metadata !"fpexcept.strict") strictfp %2 = call double @llvm.experimental.constrained.cos.f64(double %a, metadata !"round.dynamic", metadata !"fpexcept.strict") strictfp %3 = fadd double %1, %2 @@ -282,6 +462,24 @@ ; RV64IFD-NEXT: addi sp, sp, 16 ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: pow_f64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: call pow@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: pow_f64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV64IZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: call pow@plt +; RV64IZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: pow_f64: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -299,6 +497,14 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKIZFINXZDINX-LABEL: pow_f64: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: addi sp, sp, -16 +; CHECKIZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; CHECKIZFINXZDINX-NEXT: call pow@plt +; CHECKIZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; CHECKIZFINXZDINX-NEXT: addi sp, sp, 16 +; CHECKIZFINXZDINX-NEXT: ret %1 = call double @llvm.experimental.constrained.pow.f64(double %a, double %b, metadata !"round.dynamic", metadata !"fpexcept.strict") strictfp ret double %1 } @@ -324,6 +530,24 @@ ; RV64IFD-NEXT: addi sp, sp, 16 ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: exp_f64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: call exp@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: exp_f64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV64IZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: call exp@plt +; RV64IZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: exp_f64: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -341,6 +565,14 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKIZFINXZDINX-LABEL: exp_f64: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: addi sp, sp, -16 +; CHECKIZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; CHECKIZFINXZDINX-NEXT: call exp@plt +; CHECKIZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; CHECKIZFINXZDINX-NEXT: addi sp, sp, 16 +; CHECKIZFINXZDINX-NEXT: ret %1 = call double @llvm.experimental.constrained.exp.f64(double %a, metadata !"round.dynamic", metadata !"fpexcept.strict") strictfp ret double %1 } @@ -366,6 +598,24 @@ ; RV64IFD-NEXT: addi sp, sp, 16 ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: exp2_f64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: call exp2@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: exp2_f64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV64IZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: call exp2@plt +; RV64IZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: exp2_f64: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -383,6 +633,14 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKIZFINXZDINX-LABEL: exp2_f64: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: addi sp, sp, -16 +; CHECKIZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; CHECKIZFINXZDINX-NEXT: call exp2@plt +; CHECKIZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; CHECKIZFINXZDINX-NEXT: addi sp, sp, 16 +; CHECKIZFINXZDINX-NEXT: ret %1 = call double @llvm.experimental.constrained.exp2.f64(double %a, metadata !"round.dynamic", metadata !"fpexcept.strict") strictfp ret double %1 } @@ -408,6 +666,24 @@ ; RV64IFD-NEXT: addi sp, sp, 16 ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: log_f64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: call log@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: log_f64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV64IZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: call log@plt +; RV64IZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: log_f64: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -425,6 +701,14 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKIZFINXZDINX-LABEL: log_f64: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: addi sp, sp, -16 +; CHECKIZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; CHECKIZFINXZDINX-NEXT: call log@plt +; CHECKIZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; CHECKIZFINXZDINX-NEXT: addi sp, sp, 16 +; CHECKIZFINXZDINX-NEXT: ret %1 = call double @llvm.experimental.constrained.log.f64(double %a, metadata !"round.dynamic", metadata !"fpexcept.strict") strictfp ret double %1 } @@ -450,6 +734,24 @@ ; RV64IFD-NEXT: addi sp, sp, 16 ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: log10_f64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: call log10@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: log10_f64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV64IZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: call log10@plt +; RV64IZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: log10_f64: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -467,6 +769,14 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKIZFINXZDINX-LABEL: log10_f64: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: addi sp, sp, -16 +; CHECKIZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; CHECKIZFINXZDINX-NEXT: call log10@plt +; CHECKIZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; CHECKIZFINXZDINX-NEXT: addi sp, sp, 16 +; CHECKIZFINXZDINX-NEXT: ret %1 = call double @llvm.experimental.constrained.log10.f64(double %a, metadata !"round.dynamic", metadata !"fpexcept.strict") strictfp ret double %1 } @@ -492,6 +802,24 @@ ; RV64IFD-NEXT: addi sp, sp, 16 ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: log2_f64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: call log2@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: log2_f64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV64IZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: call log2@plt +; RV64IZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: log2_f64: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -509,6 +837,14 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKIZFINXZDINX-LABEL: log2_f64: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: addi sp, sp, -16 +; CHECKIZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; CHECKIZFINXZDINX-NEXT: call log2@plt +; CHECKIZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; CHECKIZFINXZDINX-NEXT: addi sp, sp, 16 +; CHECKIZFINXZDINX-NEXT: ret %1 = call double @llvm.experimental.constrained.log2.f64(double %a, metadata !"round.dynamic", metadata !"fpexcept.strict") strictfp ret double %1 } @@ -521,6 +857,34 @@ ; CHECKIFD-NEXT: fmadd.d fa0, fa0, fa1, fa2 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fma_f64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fmadd.d a0, a0, a2, a4 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fma_f64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fmadd.d a0, a0, a1, a2 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fma_f64: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -538,6 +902,10 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKIZFINXZDINX-LABEL: fma_f64: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: fmadd.d a0, a0, a1, a2 +; CHECKIZFINXZDINX-NEXT: ret %1 = call double @llvm.experimental.constrained.fma.f64(double %a, double %b, double %c, metadata !"round.dynamic", metadata !"fpexcept.strict") strictfp ret double %1 } @@ -550,6 +918,34 @@ ; CHECKIFD-NEXT: fmadd.d fa0, fa0, fa1, fa2 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fmuladd_f64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fmadd.d a0, a0, a2, a4 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fmuladd_f64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fmadd.d a0, a0, a1, a2 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fmuladd_f64: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -581,6 +977,10 @@ ; RV64I-NEXT: ld s0, 0(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKIZFINXZDINX-LABEL: fmuladd_f64: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: fmadd.d a0, a0, a1, a2 +; CHECKIZFINXZDINX-NEXT: ret %1 = call double @llvm.experimental.constrained.fmuladd.f64(double %a, double %b, double %c, metadata !"round.dynamic", metadata !"fpexcept.strict") strictfp ret double %1 } @@ -606,6 +1006,24 @@ ; RV64IFD-NEXT: addi sp, sp, 16 ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: minnum_f64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: call fmin@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: minnum_f64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV64IZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: call fmin@plt +; RV64IZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: minnum_f64: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -623,6 +1041,14 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKIZFINXZDINX-LABEL: minnum_f64: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: addi sp, sp, -16 +; CHECKIZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; CHECKIZFINXZDINX-NEXT: call fmin@plt +; CHECKIZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; CHECKIZFINXZDINX-NEXT: addi sp, sp, 16 +; CHECKIZFINXZDINX-NEXT: ret %1 = call double @llvm.experimental.constrained.minnum.f64(double %a, double %b, metadata !"fpexcept.strict") strictfp ret double %1 } @@ -648,6 +1074,24 @@ ; RV64IFD-NEXT: addi sp, sp, 16 ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: maxnum_f64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: call fmax@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: maxnum_f64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV64IZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: call fmax@plt +; RV64IZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: maxnum_f64: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -665,6 +1109,14 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKIZFINXZDINX-LABEL: maxnum_f64: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: addi sp, sp, -16 +; CHECKIZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; CHECKIZFINXZDINX-NEXT: call fmax@plt +; CHECKIZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; CHECKIZFINXZDINX-NEXT: addi sp, sp, 16 +; CHECKIZFINXZDINX-NEXT: ret %1 = call double @llvm.experimental.constrained.maxnum.f64(double %a, double %b, metadata !"fpexcept.strict") strictfp ret double %1 } @@ -707,6 +1159,24 @@ ; RV64IFD-NEXT: addi sp, sp, 16 ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: floor_f64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: call floor@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: floor_f64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV64IZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: call floor@plt +; RV64IZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: floor_f64: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -724,6 +1194,14 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKIZFINXZDINX-LABEL: floor_f64: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: addi sp, sp, -16 +; CHECKIZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; CHECKIZFINXZDINX-NEXT: call floor@plt +; CHECKIZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; CHECKIZFINXZDINX-NEXT: addi sp, sp, 16 +; CHECKIZFINXZDINX-NEXT: ret %1 = call double @llvm.experimental.constrained.floor.f64(double %a, metadata !"fpexcept.strict") strictfp ret double %1 } @@ -749,6 +1227,24 @@ ; RV64IFD-NEXT: addi sp, sp, 16 ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: ceil_f64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: call ceil@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: ceil_f64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV64IZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: call ceil@plt +; RV64IZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: ceil_f64: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -766,6 +1262,14 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKIZFINXZDINX-LABEL: ceil_f64: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: addi sp, sp, -16 +; CHECKIZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; CHECKIZFINXZDINX-NEXT: call ceil@plt +; CHECKIZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; CHECKIZFINXZDINX-NEXT: addi sp, sp, 16 +; CHECKIZFINXZDINX-NEXT: ret %1 = call double @llvm.experimental.constrained.ceil.f64(double %a, metadata !"fpexcept.strict") strictfp ret double %1 } @@ -791,6 +1295,24 @@ ; RV64IFD-NEXT: addi sp, sp, 16 ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: trunc_f64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: call trunc@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: trunc_f64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV64IZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: call trunc@plt +; RV64IZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: trunc_f64: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -808,6 +1330,14 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKIZFINXZDINX-LABEL: trunc_f64: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: addi sp, sp, -16 +; CHECKIZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; CHECKIZFINXZDINX-NEXT: call trunc@plt +; CHECKIZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; CHECKIZFINXZDINX-NEXT: addi sp, sp, 16 +; CHECKIZFINXZDINX-NEXT: ret %1 = call double @llvm.experimental.constrained.trunc.f64(double %a, metadata !"fpexcept.strict") strictfp ret double %1 } @@ -833,6 +1363,24 @@ ; RV64IFD-NEXT: addi sp, sp, 16 ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: rint_f64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: call rint@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: rint_f64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV64IZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: call rint@plt +; RV64IZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: rint_f64: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -850,6 +1398,14 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKIZFINXZDINX-LABEL: rint_f64: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: addi sp, sp, -16 +; CHECKIZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; CHECKIZFINXZDINX-NEXT: call rint@plt +; CHECKIZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; CHECKIZFINXZDINX-NEXT: addi sp, sp, 16 +; CHECKIZFINXZDINX-NEXT: ret %1 = call double @llvm.experimental.constrained.rint.f64(double %a, metadata !"round.dynamic", metadata !"fpexcept.strict") strictfp ret double %1 } @@ -875,6 +1431,24 @@ ; RV64IFD-NEXT: addi sp, sp, 16 ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: nearbyint_f64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: call nearbyint@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: nearbyint_f64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV64IZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: call nearbyint@plt +; RV64IZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: nearbyint_f64: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -892,6 +1466,14 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKIZFINXZDINX-LABEL: nearbyint_f64: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: addi sp, sp, -16 +; CHECKIZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; CHECKIZFINXZDINX-NEXT: call nearbyint@plt +; CHECKIZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; CHECKIZFINXZDINX-NEXT: addi sp, sp, 16 +; CHECKIZFINXZDINX-NEXT: ret %1 = call double @llvm.experimental.constrained.nearbyint.f64(double %a, metadata !"round.dynamic", metadata !"fpexcept.strict") strictfp ret double %1 } @@ -917,6 +1499,24 @@ ; RV64IFD-NEXT: addi sp, sp, 16 ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: round_f64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: call round@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: round_f64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV64IZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: call round@plt +; RV64IZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: round_f64: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -934,6 +1534,14 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKIZFINXZDINX-LABEL: round_f64: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: addi sp, sp, -16 +; CHECKIZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; CHECKIZFINXZDINX-NEXT: call round@plt +; CHECKIZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; CHECKIZFINXZDINX-NEXT: addi sp, sp, 16 +; CHECKIZFINXZDINX-NEXT: ret %1 = call double @llvm.experimental.constrained.round.f64(double %a, metadata !"fpexcept.strict") strictfp ret double %1 } @@ -959,6 +1567,24 @@ ; RV64IFD-NEXT: addi sp, sp, 16 ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: roundeven_f64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: call roundeven@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: roundeven_f64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV64IZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: call roundeven@plt +; RV64IZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: roundeven_f64: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -976,6 +1602,14 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKIZFINXZDINX-LABEL: roundeven_f64: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: addi sp, sp, -16 +; CHECKIZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; CHECKIZFINXZDINX-NEXT: call roundeven@plt +; CHECKIZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; CHECKIZFINXZDINX-NEXT: addi sp, sp, 16 +; CHECKIZFINXZDINX-NEXT: ret %1 = call double @llvm.experimental.constrained.roundeven.f64(double %a, metadata !"fpexcept.strict") strictfp ret double %1 } @@ -993,6 +1627,22 @@ ; RV64IFD-NEXT: fcvt.l.d a0, fa0 ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: lrint_f64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.w.d a0, a0 +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: lrint_f64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.l.d a0, a0 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: lrint_f64: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -1010,6 +1660,10 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKIZFINXZDINX-LABEL: lrint_f64: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: fcvt.l.d a0, a0 +; CHECKIZFINXZDINX-NEXT: ret %1 = call iXLen @llvm.experimental.constrained.lrint.iXLen.f64(double %a, metadata !"round.dynamic", metadata !"fpexcept.strict") strictfp ret iXLen %1 } @@ -1027,6 +1681,22 @@ ; RV64IFD-NEXT: fcvt.l.d a0, fa0, rmm ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: lround_f64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.w.d a0, a0, rmm +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: lround_f64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.l.d a0, a0, rmm +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: lround_f64: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -1044,6 +1714,10 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKIZFINXZDINX-LABEL: lround_f64: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: fcvt.l.d a0, a0, rmm +; CHECKIZFINXZDINX-NEXT: ret %1 = call iXLen @llvm.experimental.constrained.lround.iXLen.f64(double %a, metadata !"fpexcept.strict") strictfp ret iXLen %1 } @@ -1065,6 +1739,20 @@ ; RV64IFD-NEXT: fcvt.l.d a0, fa0 ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: llrint_f64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: call llrint@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: llrint_f64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.l.d a0, a0 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: llrint_f64: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -1082,6 +1770,10 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKIZFINXZDINX-LABEL: llrint_f64: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: fcvt.l.d a0, a0 +; CHECKIZFINXZDINX-NEXT: ret %1 = call i64 @llvm.experimental.constrained.llrint.i64.f64(double %a, metadata !"round.dynamic", metadata !"fpexcept.strict") strictfp ret i64 %1 } @@ -1103,6 +1795,20 @@ ; RV64IFD-NEXT: fcvt.l.d a0, fa0, rmm ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: llround_f64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: call llround@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: llround_f64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.l.d a0, a0, rmm +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: llround_f64: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -1120,6 +1826,10 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKIZFINXZDINX-LABEL: llround_f64: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: fcvt.l.d a0, a0, rmm +; CHECKIZFINXZDINX-NEXT: ret %1 = call i64 @llvm.experimental.constrained.llround.i64.f64(double %a, metadata !"fpexcept.strict") strictfp ret i64 %1 } 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 @@ -5,6 +5,12 @@ ; RUN: sed 's/iXLen/i64/g' %s | llc -mtriple=riscv64 -mattr=+d \ ; RUN: -verify-machineinstrs -target-abi=lp64d \ ; RUN: | FileCheck -check-prefixes=CHECKIFD,RV64IFD %s +; RUN: sed 's/iXLen/i32/g' %s | llc -mtriple=riscv32 -mattr=+zdinx \ +; RUN: -verify-machineinstrs -target-abi=ilp32 \ +; RUN: | FileCheck -check-prefix=RV32IZFINXZDINX %s +; RUN: sed 's/iXLen/i64/g' %s | llc -mtriple=riscv64 -mattr=+zdinx \ +; RUN: -verify-machineinstrs -target-abi=lp64 \ +; RUN: | FileCheck -check-prefix=RV64IZFINXZDINX %s ; RUN: sed 's/iXLen/i32/g' %s | llc -mtriple=riscv32 \ ; RUN: -verify-machineinstrs | FileCheck -check-prefix=RV32I %s ; RUN: sed 's/iXLen/i64/g' %s | llc -mtriple=riscv64 \ @@ -18,6 +24,26 @@ ; CHECKIFD-NEXT: fsqrt.d fa0, fa0 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: sqrt_f64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fsqrt.d a0, a0 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: sqrt_f64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fsqrt.d a0, a0 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: sqrt_f64: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -35,6 +61,10 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKIZFINXZDINX-LABEL: sqrt_f64: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: fsqrt.d a0, a0 +; CHECKIZFINXZDINX-NEXT: ret %1 = call double @llvm.sqrt.f64(double %a) ret double %1 } @@ -56,6 +86,25 @@ ; RV64IFD-NEXT: addi sp, sp, 16 ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: powi_f64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: call __powidf2@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: powi_f64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV64IZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: sext.w a1, a1 +; RV64IZFINXZDINX-NEXT: call __powidf2@plt +; RV64IZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: powi_f64: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -74,6 +123,15 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKIZFINXZDINX-LABEL: powi_f64: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: addi sp, sp, -16 +; CHECKIZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; CHECKIZFINXZDINX-NEXT: sext.w a1, a1 +; CHECKIZFINXZDINX-NEXT: call __powidf2@plt +; CHECKIZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; CHECKIZFINXZDINX-NEXT: addi sp, sp, 16 +; CHECKIZFINXZDINX-NEXT: ret %1 = call double @llvm.powi.f64.i32(double %a, i32 %b) ret double %1 } @@ -85,6 +143,24 @@ ; CHECKIFD: # %bb.0: ; CHECKIFD-NEXT: tail sin@plt ; +; RV32IZFINXZDINX-LABEL: sin_f64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: call sin@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: sin_f64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV64IZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: call sin@plt +; RV64IZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: sin_f64: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -102,6 +178,14 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKIZFINXZDINX-LABEL: sin_f64: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: addi sp, sp, -16 +; CHECKIZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; CHECKIZFINXZDINX-NEXT: call sin@plt +; CHECKIZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; CHECKIZFINXZDINX-NEXT: addi sp, sp, 16 +; CHECKIZFINXZDINX-NEXT: ret %1 = call double @llvm.sin.f64(double %a) ret double %1 } @@ -113,6 +197,24 @@ ; CHECKIFD: # %bb.0: ; CHECKIFD-NEXT: tail cos@plt ; +; RV32IZFINXZDINX-LABEL: cos_f64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: call cos@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: cos_f64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV64IZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: call cos@plt +; RV64IZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: cos_f64: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -130,6 +232,14 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKIZFINXZDINX-LABEL: cos_f64: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: addi sp, sp, -16 +; CHECKIZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; CHECKIZFINXZDINX-NEXT: call cos@plt +; CHECKIZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; CHECKIZFINXZDINX-NEXT: addi sp, sp, 16 +; CHECKIZFINXZDINX-NEXT: ret %1 = call double @llvm.cos.f64(double %a) ret double %1 } @@ -172,6 +282,59 @@ ; RV64IFD-NEXT: addi sp, sp, 32 ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: sincos_f64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -32 +; RV32IZFINXZDINX-NEXT: sw ra, 28(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: sw s0, 24(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: sw s1, 20(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: mv s0, a1 +; RV32IZFINXZDINX-NEXT: mv s1, a0 +; RV32IZFINXZDINX-NEXT: call sin@plt +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 0(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 4(sp) +; RV32IZFINXZDINX-NEXT: mv a0, s1 +; RV32IZFINXZDINX-NEXT: mv a1, s0 +; RV32IZFINXZDINX-NEXT: call cos@plt +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 0(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 4(sp) +; RV32IZFINXZDINX-NEXT: fadd.d a0, a2, a0 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw ra, 28(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: lw s0, 24(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: lw s1, 20(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 32 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: sincos_f64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: addi sp, sp, -32 +; RV64IZFINXZDINX-NEXT: sd ra, 24(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: sd s0, 16(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: sd s1, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: mv s0, a0 +; RV64IZFINXZDINX-NEXT: call sin@plt +; RV64IZFINXZDINX-NEXT: mv s1, a0 +; RV64IZFINXZDINX-NEXT: mv a0, s0 +; RV64IZFINXZDINX-NEXT: call cos@plt +; RV64IZFINXZDINX-NEXT: fadd.d a0, s1, a0 +; RV64IZFINXZDINX-NEXT: ld ra, 24(sp) # 8-byte Folded Reload +; RV64IZFINXZDINX-NEXT: ld s0, 16(sp) # 8-byte Folded Reload +; RV64IZFINXZDINX-NEXT: ld s1, 8(sp) # 8-byte Folded Reload +; RV64IZFINXZDINX-NEXT: addi sp, sp, 32 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: sincos_f64: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -32 @@ -220,6 +383,23 @@ ; RV64I-NEXT: ld s1, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 32 ; RV64I-NEXT: ret +; CHECKIZFINXZDINX-LABEL: sincos_f64: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: addi sp, sp, -32 +; CHECKIZFINXZDINX-NEXT: sd ra, 24(sp) # 8-byte Folded Spill +; CHECKIZFINXZDINX-NEXT: sd s0, 16(sp) # 8-byte Folded Spill +; CHECKIZFINXZDINX-NEXT: sd s1, 8(sp) # 8-byte Folded Spill +; CHECKIZFINXZDINX-NEXT: mv s0, a0 +; CHECKIZFINXZDINX-NEXT: call sin@plt +; CHECKIZFINXZDINX-NEXT: mv s1, a0 +; CHECKIZFINXZDINX-NEXT: mv a0, s0 +; CHECKIZFINXZDINX-NEXT: call cos@plt +; CHECKIZFINXZDINX-NEXT: fadd.d a0, s1, a0 +; CHECKIZFINXZDINX-NEXT: ld ra, 24(sp) # 8-byte Folded Reload +; CHECKIZFINXZDINX-NEXT: ld s0, 16(sp) # 8-byte Folded Reload +; CHECKIZFINXZDINX-NEXT: ld s1, 8(sp) # 8-byte Folded Reload +; CHECKIZFINXZDINX-NEXT: addi sp, sp, 32 +; CHECKIZFINXZDINX-NEXT: ret %1 = call double @llvm.sin.f64(double %a) %2 = call double @llvm.cos.f64(double %a) %3 = fadd double %1, %2 @@ -233,6 +413,24 @@ ; CHECKIFD: # %bb.0: ; CHECKIFD-NEXT: tail pow@plt ; +; RV32IZFINXZDINX-LABEL: pow_f64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: call pow@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: pow_f64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV64IZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: call pow@plt +; RV64IZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: pow_f64: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -250,6 +448,14 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKIZFINXZDINX-LABEL: pow_f64: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: addi sp, sp, -16 +; CHECKIZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; CHECKIZFINXZDINX-NEXT: call pow@plt +; CHECKIZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; CHECKIZFINXZDINX-NEXT: addi sp, sp, 16 +; CHECKIZFINXZDINX-NEXT: ret %1 = call double @llvm.pow.f64(double %a, double %b) ret double %1 } @@ -261,6 +467,24 @@ ; CHECKIFD: # %bb.0: ; CHECKIFD-NEXT: tail exp@plt ; +; RV32IZFINXZDINX-LABEL: exp_f64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: call exp@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: exp_f64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV64IZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: call exp@plt +; RV64IZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: exp_f64: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -278,6 +502,14 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKIZFINXZDINX-LABEL: exp_f64: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: addi sp, sp, -16 +; CHECKIZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; CHECKIZFINXZDINX-NEXT: call exp@plt +; CHECKIZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; CHECKIZFINXZDINX-NEXT: addi sp, sp, 16 +; CHECKIZFINXZDINX-NEXT: ret %1 = call double @llvm.exp.f64(double %a) ret double %1 } @@ -289,6 +521,24 @@ ; CHECKIFD: # %bb.0: ; CHECKIFD-NEXT: tail exp2@plt ; +; RV32IZFINXZDINX-LABEL: exp2_f64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: call exp2@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: exp2_f64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV64IZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: call exp2@plt +; RV64IZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: exp2_f64: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -306,6 +556,14 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKIZFINXZDINX-LABEL: exp2_f64: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: addi sp, sp, -16 +; CHECKIZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; CHECKIZFINXZDINX-NEXT: call exp2@plt +; CHECKIZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; CHECKIZFINXZDINX-NEXT: addi sp, sp, 16 +; CHECKIZFINXZDINX-NEXT: ret %1 = call double @llvm.exp2.f64(double %a) ret double %1 } @@ -317,6 +575,24 @@ ; CHECKIFD: # %bb.0: ; CHECKIFD-NEXT: tail log@plt ; +; RV32IZFINXZDINX-LABEL: log_f64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: call log@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: log_f64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV64IZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: call log@plt +; RV64IZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: log_f64: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -334,6 +610,14 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKIZFINXZDINX-LABEL: log_f64: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: addi sp, sp, -16 +; CHECKIZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; CHECKIZFINXZDINX-NEXT: call log@plt +; CHECKIZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; CHECKIZFINXZDINX-NEXT: addi sp, sp, 16 +; CHECKIZFINXZDINX-NEXT: ret %1 = call double @llvm.log.f64(double %a) ret double %1 } @@ -345,6 +629,24 @@ ; CHECKIFD: # %bb.0: ; CHECKIFD-NEXT: tail log10@plt ; +; RV32IZFINXZDINX-LABEL: log10_f64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: call log10@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: log10_f64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV64IZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: call log10@plt +; RV64IZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: log10_f64: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -362,6 +664,14 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKIZFINXZDINX-LABEL: log10_f64: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: addi sp, sp, -16 +; CHECKIZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; CHECKIZFINXZDINX-NEXT: call log10@plt +; CHECKIZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; CHECKIZFINXZDINX-NEXT: addi sp, sp, 16 +; CHECKIZFINXZDINX-NEXT: ret %1 = call double @llvm.log10.f64(double %a) ret double %1 } @@ -373,6 +683,24 @@ ; CHECKIFD: # %bb.0: ; CHECKIFD-NEXT: tail log2@plt ; +; RV32IZFINXZDINX-LABEL: log2_f64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: call log2@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: log2_f64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV64IZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: call log2@plt +; RV64IZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: log2_f64: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -390,6 +718,14 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKIZFINXZDINX-LABEL: log2_f64: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: addi sp, sp, -16 +; CHECKIZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; CHECKIZFINXZDINX-NEXT: call log2@plt +; CHECKIZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; CHECKIZFINXZDINX-NEXT: addi sp, sp, 16 +; CHECKIZFINXZDINX-NEXT: ret %1 = call double @llvm.log2.f64(double %a) ret double %1 } @@ -402,6 +738,34 @@ ; CHECKIFD-NEXT: fmadd.d fa0, fa0, fa1, fa2 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fma_f64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fmadd.d a0, a0, a2, a4 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fma_f64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fmadd.d a0, a0, a1, a2 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fma_f64: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -419,6 +783,10 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKIZFINXZDINX-LABEL: fma_f64: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: fmadd.d a0, a0, a1, a2 +; CHECKIZFINXZDINX-NEXT: ret %1 = call double @llvm.fma.f64(double %a, double %b, double %c) ret double %1 } @@ -431,6 +799,34 @@ ; CHECKIFD-NEXT: fmadd.d fa0, fa0, fa1, fa2 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fmuladd_f64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fmadd.d a0, a0, a2, a4 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fmuladd_f64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fmadd.d a0, a0, a1, a2 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fmuladd_f64: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -462,6 +858,10 @@ ; RV64I-NEXT: ld s0, 0(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKIZFINXZDINX-LABEL: fmuladd_f64: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: fmadd.d a0, a0, a1, a2 +; CHECKIZFINXZDINX-NEXT: ret %1 = call double @llvm.fmuladd.f64(double %a, double %b, double %c) ret double %1 } @@ -474,6 +874,18 @@ ; CHECKIFD-NEXT: fabs.d fa0, fa0 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: fabs_f64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: slli a1, a1, 1 +; RV32IZFINXZDINX-NEXT: srli a1, a1, 1 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fabs_f64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: slli a0, a0, 1 +; RV64IZFINXZDINX-NEXT: srli a0, a0, 1 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: fabs_f64: ; RV32I: # %bb.0: ; RV32I-NEXT: slli a1, a1, 1 @@ -485,6 +897,11 @@ ; RV64I-NEXT: slli a0, a0, 1 ; RV64I-NEXT: srli a0, a0, 1 ; RV64I-NEXT: ret +; CHECKIZFINXZDINX-LABEL: fabs_f64: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: slli a0, a0, 1 +; CHECKIZFINXZDINX-NEXT: srli a0, a0, 1 +; CHECKIZFINXZDINX-NEXT: ret %1 = call double @llvm.fabs.f64(double %a) ret double %1 } @@ -497,6 +914,30 @@ ; CHECKIFD-NEXT: fmin.d fa0, fa0, fa1 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: minnum_f64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fmin.d a0, a0, a2 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: minnum_f64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fmin.d a0, a0, a1 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: minnum_f64: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -514,6 +955,10 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKIZFINXZDINX-LABEL: minnum_f64: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: fmin.d a0, a0, a1 +; CHECKIZFINXZDINX-NEXT: ret %1 = call double @llvm.minnum.f64(double %a, double %b) ret double %1 } @@ -526,6 +971,30 @@ ; CHECKIFD-NEXT: fmax.d fa0, fa0, fa1 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: maxnum_f64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fmax.d a0, a0, a2 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: maxnum_f64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fmax.d a0, a0, a1 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: maxnum_f64: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -543,6 +1012,10 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKIZFINXZDINX-LABEL: maxnum_f64: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: fmax.d a0, a0, a1 +; CHECKIZFINXZDINX-NEXT: ret %1 = call double @llvm.maxnum.f64(double %a, double %b) ret double %1 } @@ -572,6 +1045,30 @@ ; CHECKIFD-NEXT: fsgnj.d fa0, fa0, fa1 ; CHECKIFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: copysign_f64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fsgnj.d a0, a0, a2 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: copysign_f64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fsgnj.d a0, a0, a1 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: copysign_f64: ; RV32I: # %bb.0: ; RV32I-NEXT: lui a2, 524288 @@ -589,6 +1086,10 @@ ; RV64I-NEXT: srli a0, a0, 1 ; RV64I-NEXT: or a0, a0, a1 ; RV64I-NEXT: ret +; CHECKIZFINXZDINX-LABEL: copysign_f64: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: fsgnj.d a0, a0, a1 +; CHECKIZFINXZDINX-NEXT: ret %1 = call double @llvm.copysign.f64(double %a, double %b) ret double %1 } @@ -600,6 +1101,24 @@ ; CHECKIFD: # %bb.0: ; CHECKIFD-NEXT: tail floor@plt ; +; RV32IZFINXZDINX-LABEL: floor_f64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: call floor@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: floor_f64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV64IZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: call floor@plt +; RV64IZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: floor_f64: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -617,6 +1136,14 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKIZFINXZDINX-LABEL: floor_f64: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: addi sp, sp, -16 +; CHECKIZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; CHECKIZFINXZDINX-NEXT: call floor@plt +; CHECKIZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; CHECKIZFINXZDINX-NEXT: addi sp, sp, 16 +; CHECKIZFINXZDINX-NEXT: ret %1 = call double @llvm.floor.f64(double %a) ret double %1 } @@ -628,6 +1155,24 @@ ; CHECKIFD: # %bb.0: ; CHECKIFD-NEXT: tail ceil@plt ; +; RV32IZFINXZDINX-LABEL: ceil_f64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: call ceil@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: ceil_f64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV64IZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: call ceil@plt +; RV64IZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: ceil_f64: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -645,6 +1190,14 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKIZFINXZDINX-LABEL: ceil_f64: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: addi sp, sp, -16 +; CHECKIZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; CHECKIZFINXZDINX-NEXT: call ceil@plt +; CHECKIZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; CHECKIZFINXZDINX-NEXT: addi sp, sp, 16 +; CHECKIZFINXZDINX-NEXT: ret %1 = call double @llvm.ceil.f64(double %a) ret double %1 } @@ -656,6 +1209,24 @@ ; CHECKIFD: # %bb.0: ; CHECKIFD-NEXT: tail trunc@plt ; +; RV32IZFINXZDINX-LABEL: trunc_f64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: call trunc@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: trunc_f64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV64IZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: call trunc@plt +; RV64IZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: trunc_f64: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -673,6 +1244,14 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKIZFINXZDINX-LABEL: trunc_f64: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: addi sp, sp, -16 +; CHECKIZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; CHECKIZFINXZDINX-NEXT: call trunc@plt +; CHECKIZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; CHECKIZFINXZDINX-NEXT: addi sp, sp, 16 +; CHECKIZFINXZDINX-NEXT: ret %1 = call double @llvm.trunc.f64(double %a) ret double %1 } @@ -684,6 +1263,24 @@ ; CHECKIFD: # %bb.0: ; CHECKIFD-NEXT: tail rint@plt ; +; RV32IZFINXZDINX-LABEL: rint_f64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: call rint@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: rint_f64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV64IZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: call rint@plt +; RV64IZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: rint_f64: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -701,6 +1298,14 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKIZFINXZDINX-LABEL: rint_f64: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: addi sp, sp, -16 +; CHECKIZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; CHECKIZFINXZDINX-NEXT: call rint@plt +; CHECKIZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; CHECKIZFINXZDINX-NEXT: addi sp, sp, 16 +; CHECKIZFINXZDINX-NEXT: ret %1 = call double @llvm.rint.f64(double %a) ret double %1 } @@ -712,6 +1317,24 @@ ; CHECKIFD: # %bb.0: ; CHECKIFD-NEXT: tail nearbyint@plt ; +; RV32IZFINXZDINX-LABEL: nearbyint_f64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: call nearbyint@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: nearbyint_f64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV64IZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: call nearbyint@plt +; RV64IZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: nearbyint_f64: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -729,6 +1352,14 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKIZFINXZDINX-LABEL: nearbyint_f64: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: addi sp, sp, -16 +; CHECKIZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; CHECKIZFINXZDINX-NEXT: call nearbyint@plt +; CHECKIZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; CHECKIZFINXZDINX-NEXT: addi sp, sp, 16 +; CHECKIZFINXZDINX-NEXT: ret %1 = call double @llvm.nearbyint.f64(double %a) ret double %1 } @@ -740,6 +1371,24 @@ ; CHECKIFD: # %bb.0: ; CHECKIFD-NEXT: tail round@plt ; +; RV32IZFINXZDINX-LABEL: round_f64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: call round@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: round_f64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV64IZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: call round@plt +; RV64IZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: round_f64: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -757,6 +1406,14 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKIZFINXZDINX-LABEL: round_f64: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: addi sp, sp, -16 +; CHECKIZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; CHECKIZFINXZDINX-NEXT: call round@plt +; CHECKIZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; CHECKIZFINXZDINX-NEXT: addi sp, sp, 16 +; CHECKIZFINXZDINX-NEXT: ret %1 = call double @llvm.round.f64(double %a) ret double %1 } @@ -768,6 +1425,24 @@ ; CHECKIFD: # %bb.0: ; CHECKIFD-NEXT: tail roundeven@plt ; +; RV32IZFINXZDINX-LABEL: roundeven_f64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: call roundeven@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: roundeven_f64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV64IZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: call roundeven@plt +; RV64IZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: roundeven_f64: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -785,6 +1460,14 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKIZFINXZDINX-LABEL: roundeven_f64: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: addi sp, sp, -16 +; CHECKIZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; CHECKIZFINXZDINX-NEXT: call roundeven@plt +; CHECKIZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; CHECKIZFINXZDINX-NEXT: addi sp, sp, 16 +; CHECKIZFINXZDINX-NEXT: ret %1 = call double @llvm.roundeven.f64(double %a) ret double %1 } @@ -802,6 +1485,22 @@ ; RV64IFD-NEXT: fcvt.l.d a0, fa0 ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: lrint_f64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.w.d a0, a0 +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: lrint_f64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.l.d a0, a0 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: lrint_f64: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -819,6 +1518,10 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKIZFINXZDINX-LABEL: lrint_f64: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: fcvt.l.d a0, a0 +; CHECKIZFINXZDINX-NEXT: ret %1 = call iXLen @llvm.lrint.iXLen.f64(double %a) ret iXLen %1 } @@ -836,6 +1539,22 @@ ; RV64IFD-NEXT: fcvt.l.d a0, fa0, rmm ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: lround_f64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.w.d a0, a0, rmm +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: lround_f64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.l.d a0, a0, rmm +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: lround_f64: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -853,6 +1572,10 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKIZFINXZDINX-LABEL: lround_f64: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: fcvt.l.d a0, a0, rmm +; CHECKIZFINXZDINX-NEXT: ret %1 = call iXLen @llvm.lround.iXLen.f64(double %a) ret iXLen %1 } @@ -874,6 +1597,20 @@ ; RV64IFD-NEXT: fcvt.l.d a0, fa0 ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: llrint_f64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: call llrint@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: llrint_f64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.l.d a0, a0 +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: llrint_f64: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -891,6 +1628,10 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKIZFINXZDINX-LABEL: llrint_f64: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: fcvt.l.d a0, a0 +; CHECKIZFINXZDINX-NEXT: ret %1 = call i64 @llvm.llrint.i64.f64(double %a) ret i64 %1 } @@ -912,6 +1653,20 @@ ; RV64IFD-NEXT: fcvt.l.d a0, fa0, rmm ; RV64IFD-NEXT: ret ; +; RV32IZFINXZDINX-LABEL: llround_f64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: call llround@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: llround_f64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.l.d a0, a0, rmm +; RV64IZFINXZDINX-NEXT: ret +; ; RV32I-LABEL: llround_f64: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -929,6 +1684,10 @@ ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-NEXT: addi sp, sp, 16 ; RV64I-NEXT: ret +; CHECKIZFINXZDINX-LABEL: llround_f64: +; CHECKIZFINXZDINX: # %bb.0: +; CHECKIZFINXZDINX-NEXT: fcvt.l.d a0, a0, rmm +; CHECKIZFINXZDINX-NEXT: ret %1 = call i64 @llvm.llround.i64.f64(double %a) ret i64 %1 } diff --git a/llvm/test/CodeGen/RISCV/double-isnan.ll b/llvm/test/CodeGen/RISCV/double-isnan.ll --- a/llvm/test/CodeGen/RISCV/double-isnan.ll +++ b/llvm/test/CodeGen/RISCV/double-isnan.ll @@ -3,6 +3,11 @@ ; RUN: < %s | FileCheck %s ; RUN: llc -mtriple=riscv64 -mattr=+d -target-abi lp64d -verify-machineinstrs \ ; RUN: < %s | FileCheck %s +; RUN: llc -mtriple=riscv32 -mattr=+zdinx -target-abi ilp32 -verify-machineinstrs \ +; RUN: < %s | FileCheck --check-prefix=CHECKRV32ZDINX %s +; RUN: llc -mtriple=riscv64 -mattr=+zdinx -target-abi lp64 -verify-machineinstrs \ +; RUN: < %s | FileCheck --check-prefix=CHECKRV64ZDINX %s + define zeroext i1 @double_is_nan(double %a) nounwind { ; CHECK-LABEL: double_is_nan: @@ -10,6 +15,24 @@ ; CHECK-NEXT: feq.d a0, fa0, fa0 ; CHECK-NEXT: xori a0, a0, 1 ; CHECK-NEXT: ret +; +; CHECKRV32ZDINX-LABEL: double_is_nan: +; CHECKRV32ZDINX: # %bb.0: +; CHECKRV32ZDINX-NEXT: addi sp, sp, -16 +; CHECKRV32ZDINX-NEXT: sw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: sw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: lw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: lw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: feq.d a0, a0, a0 +; CHECKRV32ZDINX-NEXT: xori a0, a0, 1 +; CHECKRV32ZDINX-NEXT: addi sp, sp, 16 +; CHECKRV32ZDINX-NEXT: ret +; +; CHECKRV64ZDINX-LABEL: double_is_nan: +; CHECKRV64ZDINX: # %bb.0: +; CHECKRV64ZDINX-NEXT: feq.d a0, a0, a0 +; CHECKRV64ZDINX-NEXT: xori a0, a0, 1 +; CHECKRV64ZDINX-NEXT: ret %1 = fcmp uno double %a, 0.000000e+00 ret i1 %1 } @@ -19,6 +42,22 @@ ; CHECK: # %bb.0: ; CHECK-NEXT: feq.d a0, fa0, fa0 ; CHECK-NEXT: ret +; +; CHECKRV32ZDINX-LABEL: double_not_nan: +; CHECKRV32ZDINX: # %bb.0: +; CHECKRV32ZDINX-NEXT: addi sp, sp, -16 +; CHECKRV32ZDINX-NEXT: sw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: sw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: lw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: lw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: feq.d a0, a0, a0 +; CHECKRV32ZDINX-NEXT: addi sp, sp, 16 +; CHECKRV32ZDINX-NEXT: ret +; +; CHECKRV64ZDINX-LABEL: double_not_nan: +; CHECKRV64ZDINX: # %bb.0: +; CHECKRV64ZDINX-NEXT: feq.d a0, a0, a0 +; CHECKRV64ZDINX-NEXT: ret %1 = fcmp ord double %a, 0.000000e+00 ret i1 %1 } diff --git a/llvm/test/CodeGen/RISCV/double-mem.ll b/llvm/test/CodeGen/RISCV/double-mem.ll --- a/llvm/test/CodeGen/RISCV/double-mem.ll +++ b/llvm/test/CodeGen/RISCV/double-mem.ll @@ -3,6 +3,10 @@ ; RUN: -target-abi=ilp32d | FileCheck -check-prefixes=CHECKIFD,RV32IFD %s ; RUN: llc -mtriple=riscv64 -mattr=+d -verify-machineinstrs < %s \ ; RUN: -target-abi=lp64d | FileCheck -check-prefixes=CHECKIFD,RV64IFD %s +; RUN: llc -mtriple=riscv32 -mattr=+zdinx -verify-machineinstrs < %s \ +; RUN: -target-abi=ilp32 | FileCheck -check-prefixes=RV32IZFINXZDINX %s +; RUN: llc -mtriple=riscv64 -mattr=+zdinx -verify-machineinstrs < %s \ +; RUN: -target-abi=lp64 | FileCheck -check-prefixes=RV64IZFINXZDINX %s define dso_local double @fld(double *%a) nounwind { ; CHECKIFD-LABEL: fld: @@ -11,6 +15,29 @@ ; CHECKIFD-NEXT: fld ft1, 24(a0) ; CHECKIFD-NEXT: fadd.d fa0, ft0, ft1 ; CHECKIFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: fld: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: lw a2, 0(a0) +; RV32IZFINXZDINX-NEXT: lw a3, 4(a0) +; RV32IZFINXZDINX-NEXT: lw a0, 24(a0) +; RV32IZFINXZDINX-NEXT: lw a1, 28(a0) +; RV32IZFINXZDINX-NEXT: fadd.d a0, a2, a0 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fld: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: ld a1, 0(a0) +; RV64IZFINXZDINX-NEXT: addi a0, a0, 24 +; RV64IZFINXZDINX-NEXT: ld a0, 0(a0) +; RV64IZFINXZDINX-NEXT: fadd.d a0, a1, a0 +; RV64IZFINXZDINX-NEXT: ret %1 = load double, double* %a %2 = getelementptr double, double* %a, i32 3 %3 = load double, double* %2 @@ -27,6 +54,33 @@ ; CHECKIFD-NEXT: fsd ft0, 0(a0) ; CHECKIFD-NEXT: fsd ft0, 64(a0) ; CHECKIFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: fsd: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a3, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a4, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a2, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: fadd.d a2, a2, a4 +; RV32IZFINXZDINX-NEXT: sw a2, 0(a0) +; RV32IZFINXZDINX-NEXT: sw a3, 4(a0) +; RV32IZFINXZDINX-NEXT: sw a2, 64(a0) +; RV32IZFINXZDINX-NEXT: sw a3, 68(a0) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fsd: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fadd.d a1, a1, a2 +; RV64IZFINXZDINX-NEXT: sd a1, 0(a0) +; RV64IZFINXZDINX-NEXT: addi a0, a0, 64 +; RV64IZFINXZDINX-NEXT: sd a1, 0(a0) +; RV64IZFINXZDINX-NEXT: ret ; Use %b and %c in an FP op to ensure floating point registers are used, even ; for the soft float ABI %1 = fadd double %b, %c @@ -50,6 +104,47 @@ ; CHECKIFD-NEXT: fld ft0, 72(a1) ; CHECKIFD-NEXT: fsd fa0, 72(a1) ; CHECKIFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: fld_fsd_global: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fadd.d a0, a0, a2 +; RV32IZFINXZDINX-NEXT: lui a2, %hi(G) +; RV32IZFINXZDINX-NEXT: lw a4, %lo(G)(a2) +; RV32IZFINXZDINX-NEXT: lw a5, %lo(G+4)(a2) +; RV32IZFINXZDINX-NEXT: addi a3, a2, %lo(G) +; RV32IZFINXZDINX-NEXT: sw a0, %lo(G)(a2) +; RV32IZFINXZDINX-NEXT: sw a1, %lo(G+4)(a2) +; RV32IZFINXZDINX-NEXT: lw a4, 72(a3) +; RV32IZFINXZDINX-NEXT: lw a5, 76(a3) +; RV32IZFINXZDINX-NEXT: sw a0, 72(a3) +; RV32IZFINXZDINX-NEXT: sw a1, 76(a3) +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fld_fsd_global: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fadd.d a0, a0, a1 +; RV64IZFINXZDINX-NEXT: lui a1, %hi(G) +; RV64IZFINXZDINX-NEXT: addi a1, a1, %lo(G) +; RV64IZFINXZDINX-NEXT: ld a2, 0(a1) +; RV64IZFINXZDINX-NEXT: sd a0, 0(a1) +; RV64IZFINXZDINX-NEXT: addi a1, a1, 72 +; RV64IZFINXZDINX-NEXT: ld a2, 0(a1) +; RV64IZFINXZDINX-NEXT: sd a0, 0(a1) +; RV64IZFINXZDINX-NEXT: ret ; Use %a and %b in an FP op to ensure floating point registers are used, even ; for the soft float ABI %1 = fadd double %a, %b @@ -79,6 +174,36 @@ ; RV64IFD-NEXT: fadd.d fa0, fa0, ft0 ; RV64IFD-NEXT: fsd fa0, -273(a0) ; RV64IFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: fld_fsd_constant: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lui a2, 912092 +; RV32IZFINXZDINX-NEXT: lw a4, -273(a2) +; RV32IZFINXZDINX-NEXT: lw a5, -269(a2) +; RV32IZFINXZDINX-NEXT: fadd.d a0, a0, a4 +; RV32IZFINXZDINX-NEXT: sw a0, -273(a2) +; RV32IZFINXZDINX-NEXT: sw a1, -269(a2) +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fld_fsd_constant: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: lui a1, 228023 +; RV64IZFINXZDINX-NEXT: slli a1, a1, 2 +; RV64IZFINXZDINX-NEXT: addi a1, a1, -273 +; RV64IZFINXZDINX-NEXT: ld a2, 0(a1) +; RV64IZFINXZDINX-NEXT: fadd.d a0, a0, a2 +; RV64IZFINXZDINX-NEXT: sd a0, 0(a1) +; RV64IZFINXZDINX-NEXT: ret %1 = inttoptr i32 3735928559 to double* %2 = load volatile double, double* %1 %3 = fadd double %a, %2 @@ -118,6 +243,49 @@ ; RV64IFD-NEXT: fld fs0, 16(sp) # 8-byte Folded Reload ; RV64IFD-NEXT: addi sp, sp, 32 ; RV64IFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: fld_stack: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -32 +; RV32IZFINXZDINX-NEXT: sw ra, 28(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 0(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 4(sp) +; RV32IZFINXZDINX-NEXT: addi a0, sp, 16 +; RV32IZFINXZDINX-NEXT: call notdead@plt +; RV32IZFINXZDINX-NEXT: lw a0, 16(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 20(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 0(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 4(sp) +; RV32IZFINXZDINX-NEXT: fadd.d a0, a0, a2 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw ra, 28(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 32 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fld_stack: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: addi sp, sp, -32 +; RV64IZFINXZDINX-NEXT: sd ra, 24(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: sd s0, 16(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: sd s1, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: mv s0, a0 +; RV64IZFINXZDINX-NEXT: mv a0, sp +; RV64IZFINXZDINX-NEXT: mv s1, sp +; RV64IZFINXZDINX-NEXT: call notdead@plt +; RV64IZFINXZDINX-NEXT: ld a0, 0(s1) +; RV64IZFINXZDINX-NEXT: fadd.d a0, a0, s0 +; RV64IZFINXZDINX-NEXT: ld ra, 24(sp) # 8-byte Folded Reload +; RV64IZFINXZDINX-NEXT: ld s0, 16(sp) # 8-byte Folded Reload +; RV64IZFINXZDINX-NEXT: ld s1, 8(sp) # 8-byte Folded Reload +; RV64IZFINXZDINX-NEXT: addi sp, sp, 32 +; RV64IZFINXZDINX-NEXT: ret %1 = alloca double, align 8 %2 = bitcast double* %1 to i8* call void @notdead(i8* %2) @@ -150,6 +318,40 @@ ; RV64IFD-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64IFD-NEXT: addi sp, sp, 16 ; RV64IFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: fsd_stack: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -32 +; RV32IZFINXZDINX-NEXT: sw ra, 28(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: sw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fadd.d a0, a0, a2 +; RV32IZFINXZDINX-NEXT: sw a0, 16(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 20(sp) +; RV32IZFINXZDINX-NEXT: addi a0, sp, 16 +; RV32IZFINXZDINX-NEXT: call notdead@plt +; RV32IZFINXZDINX-NEXT: lw ra, 28(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 32 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fsd_stack: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV64IZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: fadd.d a0, a0, a1 +; RV64IZFINXZDINX-NEXT: mv a1, sp +; RV64IZFINXZDINX-NEXT: sd a0, 0(a1) +; RV64IZFINXZDINX-NEXT: mv a0, sp +; RV64IZFINXZDINX-NEXT: call notdead@plt +; RV64IZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV64IZFINXZDINX-NEXT: ret %1 = fadd double %a, %b ; force store from FPR64 %2 = alloca double, align 8 store double %1, double* %2 @@ -165,6 +367,24 @@ ; CHECKIFD-NEXT: fcvt.s.d ft0, fa0 ; CHECKIFD-NEXT: fsw ft0, 0(a0) ; CHECKIFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: fsd_trunc: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw a1, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a2, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.s.d a1, a2 +; RV32IZFINXZDINX-NEXT: sw a1, 0(a0) +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: fsd_trunc: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.s.d a1, a1 +; RV64IZFINXZDINX-NEXT: sw a1, 0(a0) +; RV64IZFINXZDINX-NEXT: ret %1 = fptrunc double %b to float store float %1, float* %a, align 4 ret void diff --git a/llvm/test/CodeGen/RISCV/double-previous-failure.ll b/llvm/test/CodeGen/RISCV/double-previous-failure.ll --- a/llvm/test/CodeGen/RISCV/double-previous-failure.ll +++ b/llvm/test/CodeGen/RISCV/double-previous-failure.ll @@ -1,11 +1,17 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py ; RUN: llc -mtriple=riscv32 -mattr=+d -target-abi=ilp32 -verify-machineinstrs < %s \ ; RUN: | FileCheck -check-prefix=RV32IFD %s +; RUN: llc -mtriple=riscv32 -mattr=+zdinx -target-abi=ilp32 -verify-machineinstrs < %s \ +; RUN: | FileCheck -check-prefix=RV32IZFINXZDINX %s define double @test(double %a) nounwind { ; RV32IFD-LABEL: test: ; RV32IFD: # %bb.0: ; RV32IFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: test: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: ret ret double %a } @@ -35,6 +41,32 @@ ; RV32IFD-NEXT: call abort@plt ; RV32IFD-NEXT: .LBB1_2: # %if.end ; RV32IFD-NEXT: call exit@plt +; +; RV32IZFINXZDINX-LABEL: main: +; RV32IZFINXZDINX: # %bb.0: # %entry +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: lui a1, 262144 +; RV32IZFINXZDINX-NEXT: li a0, 0 +; RV32IZFINXZDINX-NEXT: call test@plt +; RV32IZFINXZDINX-NEXT: sw a0, 0(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 4(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 0(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 4(sp) +; RV32IZFINXZDINX-NEXT: lui a2, %hi(.LCPI1_0) +; RV32IZFINXZDINX-NEXT: lw a2, %lo(.LCPI1_0)(a2) +; RV32IZFINXZDINX-NEXT: lw a3, %lo(.LCPI1_0+4)(a2) +; RV32IZFINXZDINX-NEXT: lui a4, %hi(.LCPI1_1) +; RV32IZFINXZDINX-NEXT: lw a4, %lo(.LCPI1_1)(a4) +; RV32IZFINXZDINX-NEXT: lw a5, %lo(.LCPI1_1+4)(a4) +; RV32IZFINXZDINX-NEXT: flt.d a2, a0, a2 +; RV32IZFINXZDINX-NEXT: flt.d a0, a4, a0 +; RV32IZFINXZDINX-NEXT: or a0, a2, a0 +; RV32IZFINXZDINX-NEXT: beqz a0, .LBB1_2 +; RV32IZFINXZDINX-NEXT: # %bb.1: # %if.then +; RV32IZFINXZDINX-NEXT: call abort@plt +; RV32IZFINXZDINX-NEXT: .LBB1_2: # %if.end +; RV32IZFINXZDINX-NEXT: call exit@plt entry: %call = call double @test(double 2.000000e+00) %cmp = fcmp olt double %call, 2.400000e-01 diff --git a/llvm/test/CodeGen/RISCV/double-round-conv-sat.ll b/llvm/test/CodeGen/RISCV/double-round-conv-sat.ll --- a/llvm/test/CodeGen/RISCV/double-round-conv-sat.ll +++ b/llvm/test/CodeGen/RISCV/double-round-conv-sat.ll @@ -3,6 +3,10 @@ ; RUN: -target-abi=ilp32d | FileCheck -check-prefixes=CHECKIFD,RV32IFD %s ; RUN: llc -mtriple=riscv64 -mattr=+d -verify-machineinstrs < %s \ ; RUN: -target-abi=lp64d | FileCheck -check-prefixes=CHECKIFD,RV64IFD %s +; RUN: llc -mtriple=riscv32 -mattr=+zdinx -verify-machineinstrs < %s \ +; RUN: -target-abi=ilp32 | FileCheck -check-prefixes=RV32IZFINXZDINX %s +; RUN: llc -mtriple=riscv64 -mattr=+zdinx -verify-machineinstrs < %s \ +; RUN: -target-abi=lp64 | FileCheck -check-prefixes=RV64IZFINXZDINX %s define signext i32 @test_floor_si32(double %x) { ; CHECKIFD-LABEL: test_floor_si32: @@ -13,6 +17,36 @@ ; CHECKIFD-NEXT: fcvt.w.d a0, fa0, rdn ; CHECKIFD-NEXT: .LBB0_2: ; CHECKIFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: test_floor_si32: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: feq.d a2, a0, a0 +; RV32IZFINXZDINX-NEXT: bnez a2, .LBB0_2 +; RV32IZFINXZDINX-NEXT: # %bb.1: +; RV32IZFINXZDINX-NEXT: li a0, 0 +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; RV32IZFINXZDINX-NEXT: .LBB0_2: +; RV32IZFINXZDINX-NEXT: fcvt.w.d a0, a0, rdn +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_floor_si32: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: feq.d a1, a0, a0 +; RV64IZFINXZDINX-NEXT: bnez a1, .LBB0_2 +; RV64IZFINXZDINX-NEXT: # %bb.1: +; RV64IZFINXZDINX-NEXT: li a0, 0 +; RV64IZFINXZDINX-NEXT: ret +; RV64IZFINXZDINX-NEXT: .LBB0_2: +; RV64IZFINXZDINX-NEXT: fcvt.w.d a0, a0, rdn +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.floor.f64(double %x) %b = call i32 @llvm.fptosi.sat.i32.f64(double %a) ret i32 %b @@ -70,6 +104,68 @@ ; RV64IFD-NEXT: fcvt.l.d a0, fa0, rdn ; RV64IFD-NEXT: .LBB1_2: ; RV64IFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: test_floor_si64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -32 +; RV32IZFINXZDINX-NEXT: sw ra, 28(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: sw s0, 24(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: call floor@plt +; RV32IZFINXZDINX-NEXT: sw a0, 16(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 20(sp) +; RV32IZFINXZDINX-NEXT: lw a4, 16(sp) +; RV32IZFINXZDINX-NEXT: lw a5, 20(sp) +; RV32IZFINXZDINX-NEXT: lui a2, %hi(.LCPI1_0) +; RV32IZFINXZDINX-NEXT: lw a2, %lo(.LCPI1_0)(a2) +; RV32IZFINXZDINX-NEXT: lw a3, %lo(.LCPI1_0+4)(a2) +; RV32IZFINXZDINX-NEXT: sw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: fle.d s0, a2, a4 +; RV32IZFINXZDINX-NEXT: call __fixdfdi@plt +; RV32IZFINXZDINX-NEXT: lui a3, 524288 +; RV32IZFINXZDINX-NEXT: bnez s0, .LBB1_2 +; RV32IZFINXZDINX-NEXT: # %bb.1: +; RV32IZFINXZDINX-NEXT: lui a1, 524288 +; RV32IZFINXZDINX-NEXT: .LBB1_2: +; RV32IZFINXZDINX-NEXT: lui a2, %hi(.LCPI1_1) +; RV32IZFINXZDINX-NEXT: lw a4, %lo(.LCPI1_1)(a2) +; RV32IZFINXZDINX-NEXT: lw a5, %lo(.LCPI1_1+4)(a2) +; RV32IZFINXZDINX-NEXT: lw a6, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a7, 12(sp) +; RV32IZFINXZDINX-NEXT: flt.d a2, a4, a6 +; RV32IZFINXZDINX-NEXT: mv a4, a6 +; RV32IZFINXZDINX-NEXT: beqz a2, .LBB1_4 +; RV32IZFINXZDINX-NEXT: # %bb.3: +; RV32IZFINXZDINX-NEXT: addi a1, a3, -1 +; RV32IZFINXZDINX-NEXT: .LBB1_4: +; RV32IZFINXZDINX-NEXT: feq.d a3, a4, a4 +; RV32IZFINXZDINX-NEXT: bnez a3, .LBB1_6 +; RV32IZFINXZDINX-NEXT: # %bb.5: +; RV32IZFINXZDINX-NEXT: li a1, 0 +; RV32IZFINXZDINX-NEXT: li a0, 0 +; RV32IZFINXZDINX-NEXT: j .LBB1_7 +; RV32IZFINXZDINX-NEXT: .LBB1_6: +; RV32IZFINXZDINX-NEXT: neg a3, s0 +; RV32IZFINXZDINX-NEXT: and a0, a3, a0 +; RV32IZFINXZDINX-NEXT: seqz a2, a2 +; RV32IZFINXZDINX-NEXT: addi a2, a2, -1 +; RV32IZFINXZDINX-NEXT: or a0, a0, a2 +; RV32IZFINXZDINX-NEXT: .LBB1_7: +; RV32IZFINXZDINX-NEXT: lw ra, 28(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: lw s0, 24(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 32 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_floor_si64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: feq.d a1, a0, a0 +; RV64IZFINXZDINX-NEXT: bnez a1, .LBB1_2 +; RV64IZFINXZDINX-NEXT: # %bb.1: +; RV64IZFINXZDINX-NEXT: li a0, 0 +; RV64IZFINXZDINX-NEXT: ret +; RV64IZFINXZDINX-NEXT: .LBB1_2: +; RV64IZFINXZDINX-NEXT: fcvt.l.d a0, a0, rdn +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.floor.f64(double %x) %b = call i64 @llvm.fptosi.sat.i64.f64(double %a) ret i64 %b @@ -84,6 +180,36 @@ ; CHECKIFD-NEXT: fcvt.wu.d a0, fa0, rdn ; CHECKIFD-NEXT: .LBB2_2: ; CHECKIFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: test_floor_ui32: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: feq.d a2, a0, a0 +; RV32IZFINXZDINX-NEXT: bnez a2, .LBB2_2 +; RV32IZFINXZDINX-NEXT: # %bb.1: +; RV32IZFINXZDINX-NEXT: li a0, 0 +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; RV32IZFINXZDINX-NEXT: .LBB2_2: +; RV32IZFINXZDINX-NEXT: fcvt.wu.d a0, a0, rdn +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_floor_ui32: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: feq.d a1, a0, a0 +; RV64IZFINXZDINX-NEXT: bnez a1, .LBB2_2 +; RV64IZFINXZDINX-NEXT: # %bb.1: +; RV64IZFINXZDINX-NEXT: li a0, 0 +; RV64IZFINXZDINX-NEXT: ret +; RV64IZFINXZDINX-NEXT: .LBB2_2: +; RV64IZFINXZDINX-NEXT: fcvt.wu.d a0, a0, rdn +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.floor.f64(double %x) %b = call i32 @llvm.fptoui.sat.i32.f64(double %a) ret i32 %b @@ -125,6 +251,50 @@ ; RV64IFD-NEXT: fcvt.lu.d a0, fa0, rdn ; RV64IFD-NEXT: .LBB3_2: ; RV64IFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: test_floor_ui64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -32 +; RV32IZFINXZDINX-NEXT: sw ra, 28(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: sw s0, 24(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: call floor@plt +; RV32IZFINXZDINX-NEXT: sw a0, 16(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 20(sp) +; RV32IZFINXZDINX-NEXT: lw a4, 16(sp) +; RV32IZFINXZDINX-NEXT: lw a5, 20(sp) +; RV32IZFINXZDINX-NEXT: sw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.d.w a2, zero +; RV32IZFINXZDINX-NEXT: fle.d a2, a2, a4 +; RV32IZFINXZDINX-NEXT: neg s0, a2 +; RV32IZFINXZDINX-NEXT: call __fixunsdfdi@plt +; RV32IZFINXZDINX-NEXT: lui a2, %hi(.LCPI3_0) +; RV32IZFINXZDINX-NEXT: lw a2, %lo(.LCPI3_0)(a2) +; RV32IZFINXZDINX-NEXT: lw a3, %lo(.LCPI3_0+4)(a2) +; RV32IZFINXZDINX-NEXT: and a0, s0, a0 +; RV32IZFINXZDINX-NEXT: lw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: flt.d a2, a2, a4 +; RV32IZFINXZDINX-NEXT: seqz a2, a2 +; RV32IZFINXZDINX-NEXT: addi a2, a2, -1 +; RV32IZFINXZDINX-NEXT: or a0, a0, a2 +; RV32IZFINXZDINX-NEXT: and a1, s0, a1 +; RV32IZFINXZDINX-NEXT: or a1, a1, a2 +; RV32IZFINXZDINX-NEXT: lw ra, 28(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: lw s0, 24(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 32 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_floor_ui64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: feq.d a1, a0, a0 +; RV64IZFINXZDINX-NEXT: bnez a1, .LBB3_2 +; RV64IZFINXZDINX-NEXT: # %bb.1: +; RV64IZFINXZDINX-NEXT: li a0, 0 +; RV64IZFINXZDINX-NEXT: ret +; RV64IZFINXZDINX-NEXT: .LBB3_2: +; RV64IZFINXZDINX-NEXT: fcvt.lu.d a0, a0, rdn +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.floor.f64(double %x) %b = call i64 @llvm.fptoui.sat.i64.f64(double %a) ret i64 %b @@ -139,6 +309,36 @@ ; CHECKIFD-NEXT: fcvt.w.d a0, fa0, rup ; CHECKIFD-NEXT: .LBB4_2: ; CHECKIFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: test_ceil_si32: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: feq.d a2, a0, a0 +; RV32IZFINXZDINX-NEXT: bnez a2, .LBB4_2 +; RV32IZFINXZDINX-NEXT: # %bb.1: +; RV32IZFINXZDINX-NEXT: li a0, 0 +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; RV32IZFINXZDINX-NEXT: .LBB4_2: +; RV32IZFINXZDINX-NEXT: fcvt.w.d a0, a0, rup +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_ceil_si32: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: feq.d a1, a0, a0 +; RV64IZFINXZDINX-NEXT: bnez a1, .LBB4_2 +; RV64IZFINXZDINX-NEXT: # %bb.1: +; RV64IZFINXZDINX-NEXT: li a0, 0 +; RV64IZFINXZDINX-NEXT: ret +; RV64IZFINXZDINX-NEXT: .LBB4_2: +; RV64IZFINXZDINX-NEXT: fcvt.w.d a0, a0, rup +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.ceil.f64(double %x) %b = call i32 @llvm.fptosi.sat.i32.f64(double %a) ret i32 %b @@ -196,6 +396,68 @@ ; RV64IFD-NEXT: fcvt.l.d a0, fa0, rup ; RV64IFD-NEXT: .LBB5_2: ; RV64IFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: test_ceil_si64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -32 +; RV32IZFINXZDINX-NEXT: sw ra, 28(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: sw s0, 24(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: call ceil@plt +; RV32IZFINXZDINX-NEXT: sw a0, 16(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 20(sp) +; RV32IZFINXZDINX-NEXT: lw a4, 16(sp) +; RV32IZFINXZDINX-NEXT: lw a5, 20(sp) +; RV32IZFINXZDINX-NEXT: lui a2, %hi(.LCPI5_0) +; RV32IZFINXZDINX-NEXT: lw a2, %lo(.LCPI5_0)(a2) +; RV32IZFINXZDINX-NEXT: lw a3, %lo(.LCPI5_0+4)(a2) +; RV32IZFINXZDINX-NEXT: sw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: fle.d s0, a2, a4 +; RV32IZFINXZDINX-NEXT: call __fixdfdi@plt +; RV32IZFINXZDINX-NEXT: lui a3, 524288 +; RV32IZFINXZDINX-NEXT: bnez s0, .LBB5_2 +; RV32IZFINXZDINX-NEXT: # %bb.1: +; RV32IZFINXZDINX-NEXT: lui a1, 524288 +; RV32IZFINXZDINX-NEXT: .LBB5_2: +; RV32IZFINXZDINX-NEXT: lui a2, %hi(.LCPI5_1) +; RV32IZFINXZDINX-NEXT: lw a4, %lo(.LCPI5_1)(a2) +; RV32IZFINXZDINX-NEXT: lw a5, %lo(.LCPI5_1+4)(a2) +; RV32IZFINXZDINX-NEXT: lw a6, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a7, 12(sp) +; RV32IZFINXZDINX-NEXT: flt.d a2, a4, a6 +; RV32IZFINXZDINX-NEXT: mv a4, a6 +; RV32IZFINXZDINX-NEXT: beqz a2, .LBB5_4 +; RV32IZFINXZDINX-NEXT: # %bb.3: +; RV32IZFINXZDINX-NEXT: addi a1, a3, -1 +; RV32IZFINXZDINX-NEXT: .LBB5_4: +; RV32IZFINXZDINX-NEXT: feq.d a3, a4, a4 +; RV32IZFINXZDINX-NEXT: bnez a3, .LBB5_6 +; RV32IZFINXZDINX-NEXT: # %bb.5: +; RV32IZFINXZDINX-NEXT: li a1, 0 +; RV32IZFINXZDINX-NEXT: li a0, 0 +; RV32IZFINXZDINX-NEXT: j .LBB5_7 +; RV32IZFINXZDINX-NEXT: .LBB5_6: +; RV32IZFINXZDINX-NEXT: neg a3, s0 +; RV32IZFINXZDINX-NEXT: and a0, a3, a0 +; RV32IZFINXZDINX-NEXT: seqz a2, a2 +; RV32IZFINXZDINX-NEXT: addi a2, a2, -1 +; RV32IZFINXZDINX-NEXT: or a0, a0, a2 +; RV32IZFINXZDINX-NEXT: .LBB5_7: +; RV32IZFINXZDINX-NEXT: lw ra, 28(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: lw s0, 24(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 32 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_ceil_si64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: feq.d a1, a0, a0 +; RV64IZFINXZDINX-NEXT: bnez a1, .LBB5_2 +; RV64IZFINXZDINX-NEXT: # %bb.1: +; RV64IZFINXZDINX-NEXT: li a0, 0 +; RV64IZFINXZDINX-NEXT: ret +; RV64IZFINXZDINX-NEXT: .LBB5_2: +; RV64IZFINXZDINX-NEXT: fcvt.l.d a0, a0, rup +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.ceil.f64(double %x) %b = call i64 @llvm.fptosi.sat.i64.f64(double %a) ret i64 %b @@ -210,6 +472,36 @@ ; CHECKIFD-NEXT: fcvt.wu.d a0, fa0, rup ; CHECKIFD-NEXT: .LBB6_2: ; CHECKIFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: test_ceil_ui32: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: feq.d a2, a0, a0 +; RV32IZFINXZDINX-NEXT: bnez a2, .LBB6_2 +; RV32IZFINXZDINX-NEXT: # %bb.1: +; RV32IZFINXZDINX-NEXT: li a0, 0 +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; RV32IZFINXZDINX-NEXT: .LBB6_2: +; RV32IZFINXZDINX-NEXT: fcvt.wu.d a0, a0, rup +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_ceil_ui32: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: feq.d a1, a0, a0 +; RV64IZFINXZDINX-NEXT: bnez a1, .LBB6_2 +; RV64IZFINXZDINX-NEXT: # %bb.1: +; RV64IZFINXZDINX-NEXT: li a0, 0 +; RV64IZFINXZDINX-NEXT: ret +; RV64IZFINXZDINX-NEXT: .LBB6_2: +; RV64IZFINXZDINX-NEXT: fcvt.wu.d a0, a0, rup +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.ceil.f64(double %x) %b = call i32 @llvm.fptoui.sat.i32.f64(double %a) ret i32 %b @@ -251,6 +543,50 @@ ; RV64IFD-NEXT: fcvt.lu.d a0, fa0, rup ; RV64IFD-NEXT: .LBB7_2: ; RV64IFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: test_ceil_ui64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -32 +; RV32IZFINXZDINX-NEXT: sw ra, 28(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: sw s0, 24(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: call ceil@plt +; RV32IZFINXZDINX-NEXT: sw a0, 16(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 20(sp) +; RV32IZFINXZDINX-NEXT: lw a4, 16(sp) +; RV32IZFINXZDINX-NEXT: lw a5, 20(sp) +; RV32IZFINXZDINX-NEXT: sw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.d.w a2, zero +; RV32IZFINXZDINX-NEXT: fle.d a2, a2, a4 +; RV32IZFINXZDINX-NEXT: neg s0, a2 +; RV32IZFINXZDINX-NEXT: call __fixunsdfdi@plt +; RV32IZFINXZDINX-NEXT: lui a2, %hi(.LCPI7_0) +; RV32IZFINXZDINX-NEXT: lw a2, %lo(.LCPI7_0)(a2) +; RV32IZFINXZDINX-NEXT: lw a3, %lo(.LCPI7_0+4)(a2) +; RV32IZFINXZDINX-NEXT: and a0, s0, a0 +; RV32IZFINXZDINX-NEXT: lw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: flt.d a2, a2, a4 +; RV32IZFINXZDINX-NEXT: seqz a2, a2 +; RV32IZFINXZDINX-NEXT: addi a2, a2, -1 +; RV32IZFINXZDINX-NEXT: or a0, a0, a2 +; RV32IZFINXZDINX-NEXT: and a1, s0, a1 +; RV32IZFINXZDINX-NEXT: or a1, a1, a2 +; RV32IZFINXZDINX-NEXT: lw ra, 28(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: lw s0, 24(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 32 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_ceil_ui64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: feq.d a1, a0, a0 +; RV64IZFINXZDINX-NEXT: bnez a1, .LBB7_2 +; RV64IZFINXZDINX-NEXT: # %bb.1: +; RV64IZFINXZDINX-NEXT: li a0, 0 +; RV64IZFINXZDINX-NEXT: ret +; RV64IZFINXZDINX-NEXT: .LBB7_2: +; RV64IZFINXZDINX-NEXT: fcvt.lu.d a0, a0, rup +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.ceil.f64(double %x) %b = call i64 @llvm.fptoui.sat.i64.f64(double %a) ret i64 %b @@ -265,6 +601,36 @@ ; CHECKIFD-NEXT: fcvt.w.d a0, fa0, rtz ; CHECKIFD-NEXT: .LBB8_2: ; CHECKIFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: test_trunc_si32: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: feq.d a2, a0, a0 +; RV32IZFINXZDINX-NEXT: bnez a2, .LBB8_2 +; RV32IZFINXZDINX-NEXT: # %bb.1: +; RV32IZFINXZDINX-NEXT: li a0, 0 +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; RV32IZFINXZDINX-NEXT: .LBB8_2: +; RV32IZFINXZDINX-NEXT: fcvt.w.d a0, a0, rtz +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_trunc_si32: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: feq.d a1, a0, a0 +; RV64IZFINXZDINX-NEXT: bnez a1, .LBB8_2 +; RV64IZFINXZDINX-NEXT: # %bb.1: +; RV64IZFINXZDINX-NEXT: li a0, 0 +; RV64IZFINXZDINX-NEXT: ret +; RV64IZFINXZDINX-NEXT: .LBB8_2: +; RV64IZFINXZDINX-NEXT: fcvt.w.d a0, a0, rtz +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.trunc.f64(double %x) %b = call i32 @llvm.fptosi.sat.i32.f64(double %a) ret i32 %b @@ -322,6 +688,68 @@ ; RV64IFD-NEXT: fcvt.l.d a0, fa0, rtz ; RV64IFD-NEXT: .LBB9_2: ; RV64IFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: test_trunc_si64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -32 +; RV32IZFINXZDINX-NEXT: sw ra, 28(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: sw s0, 24(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: call trunc@plt +; RV32IZFINXZDINX-NEXT: sw a0, 16(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 20(sp) +; RV32IZFINXZDINX-NEXT: lw a4, 16(sp) +; RV32IZFINXZDINX-NEXT: lw a5, 20(sp) +; RV32IZFINXZDINX-NEXT: lui a2, %hi(.LCPI9_0) +; RV32IZFINXZDINX-NEXT: lw a2, %lo(.LCPI9_0)(a2) +; RV32IZFINXZDINX-NEXT: lw a3, %lo(.LCPI9_0+4)(a2) +; RV32IZFINXZDINX-NEXT: sw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: fle.d s0, a2, a4 +; RV32IZFINXZDINX-NEXT: call __fixdfdi@plt +; RV32IZFINXZDINX-NEXT: lui a3, 524288 +; RV32IZFINXZDINX-NEXT: bnez s0, .LBB9_2 +; RV32IZFINXZDINX-NEXT: # %bb.1: +; RV32IZFINXZDINX-NEXT: lui a1, 524288 +; RV32IZFINXZDINX-NEXT: .LBB9_2: +; RV32IZFINXZDINX-NEXT: lui a2, %hi(.LCPI9_1) +; RV32IZFINXZDINX-NEXT: lw a4, %lo(.LCPI9_1)(a2) +; RV32IZFINXZDINX-NEXT: lw a5, %lo(.LCPI9_1+4)(a2) +; RV32IZFINXZDINX-NEXT: lw a6, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a7, 12(sp) +; RV32IZFINXZDINX-NEXT: flt.d a2, a4, a6 +; RV32IZFINXZDINX-NEXT: mv a4, a6 +; RV32IZFINXZDINX-NEXT: beqz a2, .LBB9_4 +; RV32IZFINXZDINX-NEXT: # %bb.3: +; RV32IZFINXZDINX-NEXT: addi a1, a3, -1 +; RV32IZFINXZDINX-NEXT: .LBB9_4: +; RV32IZFINXZDINX-NEXT: feq.d a3, a4, a4 +; RV32IZFINXZDINX-NEXT: bnez a3, .LBB9_6 +; RV32IZFINXZDINX-NEXT: # %bb.5: +; RV32IZFINXZDINX-NEXT: li a1, 0 +; RV32IZFINXZDINX-NEXT: li a0, 0 +; RV32IZFINXZDINX-NEXT: j .LBB9_7 +; RV32IZFINXZDINX-NEXT: .LBB9_6: +; RV32IZFINXZDINX-NEXT: neg a3, s0 +; RV32IZFINXZDINX-NEXT: and a0, a3, a0 +; RV32IZFINXZDINX-NEXT: seqz a2, a2 +; RV32IZFINXZDINX-NEXT: addi a2, a2, -1 +; RV32IZFINXZDINX-NEXT: or a0, a0, a2 +; RV32IZFINXZDINX-NEXT: .LBB9_7: +; RV32IZFINXZDINX-NEXT: lw ra, 28(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: lw s0, 24(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 32 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_trunc_si64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: feq.d a1, a0, a0 +; RV64IZFINXZDINX-NEXT: bnez a1, .LBB9_2 +; RV64IZFINXZDINX-NEXT: # %bb.1: +; RV64IZFINXZDINX-NEXT: li a0, 0 +; RV64IZFINXZDINX-NEXT: ret +; RV64IZFINXZDINX-NEXT: .LBB9_2: +; RV64IZFINXZDINX-NEXT: fcvt.l.d a0, a0, rtz +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.trunc.f64(double %x) %b = call i64 @llvm.fptosi.sat.i64.f64(double %a) ret i64 %b @@ -336,6 +764,36 @@ ; CHECKIFD-NEXT: fcvt.wu.d a0, fa0, rtz ; CHECKIFD-NEXT: .LBB10_2: ; CHECKIFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: test_trunc_ui32: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: feq.d a2, a0, a0 +; RV32IZFINXZDINX-NEXT: bnez a2, .LBB10_2 +; RV32IZFINXZDINX-NEXT: # %bb.1: +; RV32IZFINXZDINX-NEXT: li a0, 0 +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; RV32IZFINXZDINX-NEXT: .LBB10_2: +; RV32IZFINXZDINX-NEXT: fcvt.wu.d a0, a0, rtz +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_trunc_ui32: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: feq.d a1, a0, a0 +; RV64IZFINXZDINX-NEXT: bnez a1, .LBB10_2 +; RV64IZFINXZDINX-NEXT: # %bb.1: +; RV64IZFINXZDINX-NEXT: li a0, 0 +; RV64IZFINXZDINX-NEXT: ret +; RV64IZFINXZDINX-NEXT: .LBB10_2: +; RV64IZFINXZDINX-NEXT: fcvt.wu.d a0, a0, rtz +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.trunc.f64(double %x) %b = call i32 @llvm.fptoui.sat.i32.f64(double %a) ret i32 %b @@ -377,6 +835,50 @@ ; RV64IFD-NEXT: fcvt.lu.d a0, fa0, rtz ; RV64IFD-NEXT: .LBB11_2: ; RV64IFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: test_trunc_ui64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -32 +; RV32IZFINXZDINX-NEXT: sw ra, 28(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: sw s0, 24(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: call trunc@plt +; RV32IZFINXZDINX-NEXT: sw a0, 16(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 20(sp) +; RV32IZFINXZDINX-NEXT: lw a4, 16(sp) +; RV32IZFINXZDINX-NEXT: lw a5, 20(sp) +; RV32IZFINXZDINX-NEXT: sw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.d.w a2, zero +; RV32IZFINXZDINX-NEXT: fle.d a2, a2, a4 +; RV32IZFINXZDINX-NEXT: neg s0, a2 +; RV32IZFINXZDINX-NEXT: call __fixunsdfdi@plt +; RV32IZFINXZDINX-NEXT: lui a2, %hi(.LCPI11_0) +; RV32IZFINXZDINX-NEXT: lw a2, %lo(.LCPI11_0)(a2) +; RV32IZFINXZDINX-NEXT: lw a3, %lo(.LCPI11_0+4)(a2) +; RV32IZFINXZDINX-NEXT: and a0, s0, a0 +; RV32IZFINXZDINX-NEXT: lw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: flt.d a2, a2, a4 +; RV32IZFINXZDINX-NEXT: seqz a2, a2 +; RV32IZFINXZDINX-NEXT: addi a2, a2, -1 +; RV32IZFINXZDINX-NEXT: or a0, a0, a2 +; RV32IZFINXZDINX-NEXT: and a1, s0, a1 +; RV32IZFINXZDINX-NEXT: or a1, a1, a2 +; RV32IZFINXZDINX-NEXT: lw ra, 28(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: lw s0, 24(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 32 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_trunc_ui64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: feq.d a1, a0, a0 +; RV64IZFINXZDINX-NEXT: bnez a1, .LBB11_2 +; RV64IZFINXZDINX-NEXT: # %bb.1: +; RV64IZFINXZDINX-NEXT: li a0, 0 +; RV64IZFINXZDINX-NEXT: ret +; RV64IZFINXZDINX-NEXT: .LBB11_2: +; RV64IZFINXZDINX-NEXT: fcvt.lu.d a0, a0, rtz +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.trunc.f64(double %x) %b = call i64 @llvm.fptoui.sat.i64.f64(double %a) ret i64 %b @@ -391,6 +893,36 @@ ; CHECKIFD-NEXT: fcvt.w.d a0, fa0, rmm ; CHECKIFD-NEXT: .LBB12_2: ; CHECKIFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: test_round_si32: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: feq.d a2, a0, a0 +; RV32IZFINXZDINX-NEXT: bnez a2, .LBB12_2 +; RV32IZFINXZDINX-NEXT: # %bb.1: +; RV32IZFINXZDINX-NEXT: li a0, 0 +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; RV32IZFINXZDINX-NEXT: .LBB12_2: +; RV32IZFINXZDINX-NEXT: fcvt.w.d a0, a0, rmm +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_round_si32: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: feq.d a1, a0, a0 +; RV64IZFINXZDINX-NEXT: bnez a1, .LBB12_2 +; RV64IZFINXZDINX-NEXT: # %bb.1: +; RV64IZFINXZDINX-NEXT: li a0, 0 +; RV64IZFINXZDINX-NEXT: ret +; RV64IZFINXZDINX-NEXT: .LBB12_2: +; RV64IZFINXZDINX-NEXT: fcvt.w.d a0, a0, rmm +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.round.f64(double %x) %b = call i32 @llvm.fptosi.sat.i32.f64(double %a) ret i32 %b @@ -448,6 +980,68 @@ ; RV64IFD-NEXT: fcvt.l.d a0, fa0, rmm ; RV64IFD-NEXT: .LBB13_2: ; RV64IFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: test_round_si64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -32 +; RV32IZFINXZDINX-NEXT: sw ra, 28(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: sw s0, 24(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: call round@plt +; RV32IZFINXZDINX-NEXT: sw a0, 16(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 20(sp) +; RV32IZFINXZDINX-NEXT: lw a4, 16(sp) +; RV32IZFINXZDINX-NEXT: lw a5, 20(sp) +; RV32IZFINXZDINX-NEXT: lui a2, %hi(.LCPI13_0) +; RV32IZFINXZDINX-NEXT: lw a2, %lo(.LCPI13_0)(a2) +; RV32IZFINXZDINX-NEXT: lw a3, %lo(.LCPI13_0+4)(a2) +; RV32IZFINXZDINX-NEXT: sw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: fle.d s0, a2, a4 +; RV32IZFINXZDINX-NEXT: call __fixdfdi@plt +; RV32IZFINXZDINX-NEXT: lui a3, 524288 +; RV32IZFINXZDINX-NEXT: bnez s0, .LBB13_2 +; RV32IZFINXZDINX-NEXT: # %bb.1: +; RV32IZFINXZDINX-NEXT: lui a1, 524288 +; RV32IZFINXZDINX-NEXT: .LBB13_2: +; RV32IZFINXZDINX-NEXT: lui a2, %hi(.LCPI13_1) +; RV32IZFINXZDINX-NEXT: lw a4, %lo(.LCPI13_1)(a2) +; RV32IZFINXZDINX-NEXT: lw a5, %lo(.LCPI13_1+4)(a2) +; RV32IZFINXZDINX-NEXT: lw a6, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a7, 12(sp) +; RV32IZFINXZDINX-NEXT: flt.d a2, a4, a6 +; RV32IZFINXZDINX-NEXT: mv a4, a6 +; RV32IZFINXZDINX-NEXT: beqz a2, .LBB13_4 +; RV32IZFINXZDINX-NEXT: # %bb.3: +; RV32IZFINXZDINX-NEXT: addi a1, a3, -1 +; RV32IZFINXZDINX-NEXT: .LBB13_4: +; RV32IZFINXZDINX-NEXT: feq.d a3, a4, a4 +; RV32IZFINXZDINX-NEXT: bnez a3, .LBB13_6 +; RV32IZFINXZDINX-NEXT: # %bb.5: +; RV32IZFINXZDINX-NEXT: li a1, 0 +; RV32IZFINXZDINX-NEXT: li a0, 0 +; RV32IZFINXZDINX-NEXT: j .LBB13_7 +; RV32IZFINXZDINX-NEXT: .LBB13_6: +; RV32IZFINXZDINX-NEXT: neg a3, s0 +; RV32IZFINXZDINX-NEXT: and a0, a3, a0 +; RV32IZFINXZDINX-NEXT: seqz a2, a2 +; RV32IZFINXZDINX-NEXT: addi a2, a2, -1 +; RV32IZFINXZDINX-NEXT: or a0, a0, a2 +; RV32IZFINXZDINX-NEXT: .LBB13_7: +; RV32IZFINXZDINX-NEXT: lw ra, 28(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: lw s0, 24(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 32 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_round_si64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: feq.d a1, a0, a0 +; RV64IZFINXZDINX-NEXT: bnez a1, .LBB13_2 +; RV64IZFINXZDINX-NEXT: # %bb.1: +; RV64IZFINXZDINX-NEXT: li a0, 0 +; RV64IZFINXZDINX-NEXT: ret +; RV64IZFINXZDINX-NEXT: .LBB13_2: +; RV64IZFINXZDINX-NEXT: fcvt.l.d a0, a0, rmm +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.round.f64(double %x) %b = call i64 @llvm.fptosi.sat.i64.f64(double %a) ret i64 %b @@ -462,6 +1056,36 @@ ; CHECKIFD-NEXT: fcvt.wu.d a0, fa0, rmm ; CHECKIFD-NEXT: .LBB14_2: ; CHECKIFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: test_round_ui32: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: feq.d a2, a0, a0 +; RV32IZFINXZDINX-NEXT: bnez a2, .LBB14_2 +; RV32IZFINXZDINX-NEXT: # %bb.1: +; RV32IZFINXZDINX-NEXT: li a0, 0 +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; RV32IZFINXZDINX-NEXT: .LBB14_2: +; RV32IZFINXZDINX-NEXT: fcvt.wu.d a0, a0, rmm +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_round_ui32: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: feq.d a1, a0, a0 +; RV64IZFINXZDINX-NEXT: bnez a1, .LBB14_2 +; RV64IZFINXZDINX-NEXT: # %bb.1: +; RV64IZFINXZDINX-NEXT: li a0, 0 +; RV64IZFINXZDINX-NEXT: ret +; RV64IZFINXZDINX-NEXT: .LBB14_2: +; RV64IZFINXZDINX-NEXT: fcvt.wu.d a0, a0, rmm +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.round.f64(double %x) %b = call i32 @llvm.fptoui.sat.i32.f64(double %a) ret i32 %b @@ -503,6 +1127,50 @@ ; RV64IFD-NEXT: fcvt.lu.d a0, fa0, rmm ; RV64IFD-NEXT: .LBB15_2: ; RV64IFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: test_round_ui64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -32 +; RV32IZFINXZDINX-NEXT: sw ra, 28(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: sw s0, 24(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: call round@plt +; RV32IZFINXZDINX-NEXT: sw a0, 16(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 20(sp) +; RV32IZFINXZDINX-NEXT: lw a4, 16(sp) +; RV32IZFINXZDINX-NEXT: lw a5, 20(sp) +; RV32IZFINXZDINX-NEXT: sw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.d.w a2, zero +; RV32IZFINXZDINX-NEXT: fle.d a2, a2, a4 +; RV32IZFINXZDINX-NEXT: neg s0, a2 +; RV32IZFINXZDINX-NEXT: call __fixunsdfdi@plt +; RV32IZFINXZDINX-NEXT: lui a2, %hi(.LCPI15_0) +; RV32IZFINXZDINX-NEXT: lw a2, %lo(.LCPI15_0)(a2) +; RV32IZFINXZDINX-NEXT: lw a3, %lo(.LCPI15_0+4)(a2) +; RV32IZFINXZDINX-NEXT: and a0, s0, a0 +; RV32IZFINXZDINX-NEXT: lw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: flt.d a2, a2, a4 +; RV32IZFINXZDINX-NEXT: seqz a2, a2 +; RV32IZFINXZDINX-NEXT: addi a2, a2, -1 +; RV32IZFINXZDINX-NEXT: or a0, a0, a2 +; RV32IZFINXZDINX-NEXT: and a1, s0, a1 +; RV32IZFINXZDINX-NEXT: or a1, a1, a2 +; RV32IZFINXZDINX-NEXT: lw ra, 28(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: lw s0, 24(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 32 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_round_ui64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: feq.d a1, a0, a0 +; RV64IZFINXZDINX-NEXT: bnez a1, .LBB15_2 +; RV64IZFINXZDINX-NEXT: # %bb.1: +; RV64IZFINXZDINX-NEXT: li a0, 0 +; RV64IZFINXZDINX-NEXT: ret +; RV64IZFINXZDINX-NEXT: .LBB15_2: +; RV64IZFINXZDINX-NEXT: fcvt.lu.d a0, a0, rmm +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.round.f64(double %x) %b = call i64 @llvm.fptoui.sat.i64.f64(double %a) ret i64 %b @@ -517,6 +1185,36 @@ ; CHECKIFD-NEXT: fcvt.w.d a0, fa0, rne ; CHECKIFD-NEXT: .LBB16_2: ; CHECKIFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: test_roundeven_si32: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: feq.d a2, a0, a0 +; RV32IZFINXZDINX-NEXT: bnez a2, .LBB16_2 +; RV32IZFINXZDINX-NEXT: # %bb.1: +; RV32IZFINXZDINX-NEXT: li a0, 0 +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; RV32IZFINXZDINX-NEXT: .LBB16_2: +; RV32IZFINXZDINX-NEXT: fcvt.w.d a0, a0, rne +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_roundeven_si32: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: feq.d a1, a0, a0 +; RV64IZFINXZDINX-NEXT: bnez a1, .LBB16_2 +; RV64IZFINXZDINX-NEXT: # %bb.1: +; RV64IZFINXZDINX-NEXT: li a0, 0 +; RV64IZFINXZDINX-NEXT: ret +; RV64IZFINXZDINX-NEXT: .LBB16_2: +; RV64IZFINXZDINX-NEXT: fcvt.w.d a0, a0, rne +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.roundeven.f64(double %x) %b = call i32 @llvm.fptosi.sat.i32.f64(double %a) ret i32 %b @@ -574,6 +1272,68 @@ ; RV64IFD-NEXT: fcvt.l.d a0, fa0, rne ; RV64IFD-NEXT: .LBB17_2: ; RV64IFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: test_roundeven_si64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -32 +; RV32IZFINXZDINX-NEXT: sw ra, 28(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: sw s0, 24(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: call roundeven@plt +; RV32IZFINXZDINX-NEXT: sw a0, 16(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 20(sp) +; RV32IZFINXZDINX-NEXT: lw a4, 16(sp) +; RV32IZFINXZDINX-NEXT: lw a5, 20(sp) +; RV32IZFINXZDINX-NEXT: lui a2, %hi(.LCPI17_0) +; RV32IZFINXZDINX-NEXT: lw a2, %lo(.LCPI17_0)(a2) +; RV32IZFINXZDINX-NEXT: lw a3, %lo(.LCPI17_0+4)(a2) +; RV32IZFINXZDINX-NEXT: sw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: fle.d s0, a2, a4 +; RV32IZFINXZDINX-NEXT: call __fixdfdi@plt +; RV32IZFINXZDINX-NEXT: lui a3, 524288 +; RV32IZFINXZDINX-NEXT: bnez s0, .LBB17_2 +; RV32IZFINXZDINX-NEXT: # %bb.1: +; RV32IZFINXZDINX-NEXT: lui a1, 524288 +; RV32IZFINXZDINX-NEXT: .LBB17_2: +; RV32IZFINXZDINX-NEXT: lui a2, %hi(.LCPI17_1) +; RV32IZFINXZDINX-NEXT: lw a4, %lo(.LCPI17_1)(a2) +; RV32IZFINXZDINX-NEXT: lw a5, %lo(.LCPI17_1+4)(a2) +; RV32IZFINXZDINX-NEXT: lw a6, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a7, 12(sp) +; RV32IZFINXZDINX-NEXT: flt.d a2, a4, a6 +; RV32IZFINXZDINX-NEXT: mv a4, a6 +; RV32IZFINXZDINX-NEXT: beqz a2, .LBB17_4 +; RV32IZFINXZDINX-NEXT: # %bb.3: +; RV32IZFINXZDINX-NEXT: addi a1, a3, -1 +; RV32IZFINXZDINX-NEXT: .LBB17_4: +; RV32IZFINXZDINX-NEXT: feq.d a3, a4, a4 +; RV32IZFINXZDINX-NEXT: bnez a3, .LBB17_6 +; RV32IZFINXZDINX-NEXT: # %bb.5: +; RV32IZFINXZDINX-NEXT: li a1, 0 +; RV32IZFINXZDINX-NEXT: li a0, 0 +; RV32IZFINXZDINX-NEXT: j .LBB17_7 +; RV32IZFINXZDINX-NEXT: .LBB17_6: +; RV32IZFINXZDINX-NEXT: neg a3, s0 +; RV32IZFINXZDINX-NEXT: and a0, a3, a0 +; RV32IZFINXZDINX-NEXT: seqz a2, a2 +; RV32IZFINXZDINX-NEXT: addi a2, a2, -1 +; RV32IZFINXZDINX-NEXT: or a0, a0, a2 +; RV32IZFINXZDINX-NEXT: .LBB17_7: +; RV32IZFINXZDINX-NEXT: lw ra, 28(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: lw s0, 24(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 32 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_roundeven_si64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: feq.d a1, a0, a0 +; RV64IZFINXZDINX-NEXT: bnez a1, .LBB17_2 +; RV64IZFINXZDINX-NEXT: # %bb.1: +; RV64IZFINXZDINX-NEXT: li a0, 0 +; RV64IZFINXZDINX-NEXT: ret +; RV64IZFINXZDINX-NEXT: .LBB17_2: +; RV64IZFINXZDINX-NEXT: fcvt.l.d a0, a0, rne +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.roundeven.f64(double %x) %b = call i64 @llvm.fptosi.sat.i64.f64(double %a) ret i64 %b @@ -588,6 +1348,36 @@ ; CHECKIFD-NEXT: fcvt.wu.d a0, fa0, rne ; CHECKIFD-NEXT: .LBB18_2: ; CHECKIFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: test_roundeven_ui32: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: feq.d a2, a0, a0 +; RV32IZFINXZDINX-NEXT: bnez a2, .LBB18_2 +; RV32IZFINXZDINX-NEXT: # %bb.1: +; RV32IZFINXZDINX-NEXT: li a0, 0 +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; RV32IZFINXZDINX-NEXT: .LBB18_2: +; RV32IZFINXZDINX-NEXT: fcvt.wu.d a0, a0, rne +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_roundeven_ui32: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: feq.d a1, a0, a0 +; RV64IZFINXZDINX-NEXT: bnez a1, .LBB18_2 +; RV64IZFINXZDINX-NEXT: # %bb.1: +; RV64IZFINXZDINX-NEXT: li a0, 0 +; RV64IZFINXZDINX-NEXT: ret +; RV64IZFINXZDINX-NEXT: .LBB18_2: +; RV64IZFINXZDINX-NEXT: fcvt.wu.d a0, a0, rne +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.roundeven.f64(double %x) %b = call i32 @llvm.fptoui.sat.i32.f64(double %a) ret i32 %b @@ -629,6 +1419,50 @@ ; RV64IFD-NEXT: fcvt.lu.d a0, fa0, rne ; RV64IFD-NEXT: .LBB19_2: ; RV64IFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: test_roundeven_ui64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -32 +; RV32IZFINXZDINX-NEXT: sw ra, 28(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: sw s0, 24(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: call roundeven@plt +; RV32IZFINXZDINX-NEXT: sw a0, 16(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 20(sp) +; RV32IZFINXZDINX-NEXT: lw a4, 16(sp) +; RV32IZFINXZDINX-NEXT: lw a5, 20(sp) +; RV32IZFINXZDINX-NEXT: sw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.d.w a2, zero +; RV32IZFINXZDINX-NEXT: fle.d a2, a2, a4 +; RV32IZFINXZDINX-NEXT: neg s0, a2 +; RV32IZFINXZDINX-NEXT: call __fixunsdfdi@plt +; RV32IZFINXZDINX-NEXT: lui a2, %hi(.LCPI19_0) +; RV32IZFINXZDINX-NEXT: lw a2, %lo(.LCPI19_0)(a2) +; RV32IZFINXZDINX-NEXT: lw a3, %lo(.LCPI19_0+4)(a2) +; RV32IZFINXZDINX-NEXT: and a0, s0, a0 +; RV32IZFINXZDINX-NEXT: lw a4, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a5, 12(sp) +; RV32IZFINXZDINX-NEXT: flt.d a2, a2, a4 +; RV32IZFINXZDINX-NEXT: seqz a2, a2 +; RV32IZFINXZDINX-NEXT: addi a2, a2, -1 +; RV32IZFINXZDINX-NEXT: or a0, a0, a2 +; RV32IZFINXZDINX-NEXT: and a1, s0, a1 +; RV32IZFINXZDINX-NEXT: or a1, a1, a2 +; RV32IZFINXZDINX-NEXT: lw ra, 28(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: lw s0, 24(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 32 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_roundeven_ui64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: feq.d a1, a0, a0 +; RV64IZFINXZDINX-NEXT: bnez a1, .LBB19_2 +; RV64IZFINXZDINX-NEXT: # %bb.1: +; RV64IZFINXZDINX-NEXT: li a0, 0 +; RV64IZFINXZDINX-NEXT: ret +; RV64IZFINXZDINX-NEXT: .LBB19_2: +; RV64IZFINXZDINX-NEXT: fcvt.lu.d a0, a0, rne +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.roundeven.f64(double %x) %b = call i64 @llvm.fptoui.sat.i64.f64(double %a) ret i64 %b diff --git a/llvm/test/CodeGen/RISCV/double-round-conv.ll b/llvm/test/CodeGen/RISCV/double-round-conv.ll --- a/llvm/test/CodeGen/RISCV/double-round-conv.ll +++ b/llvm/test/CodeGen/RISCV/double-round-conv.ll @@ -3,6 +3,10 @@ ; RUN: -target-abi=ilp32d | FileCheck -check-prefixes=CHECKIFD,RV32IFD %s ; RUN: llc -mtriple=riscv64 -mattr=+d -verify-machineinstrs < %s \ ; RUN: -target-abi=lp64d | FileCheck -check-prefixes=CHECKIFD,RV64IFD %s +; RUN: llc -mtriple=riscv32 -mattr=+zdinx -verify-machineinstrs < %s \ +; RUN: -target-abi=ilp32 | FileCheck -check-prefixes=RV32IZFINXZDINX %s +; RUN: llc -mtriple=riscv64 -mattr=+zdinx -verify-machineinstrs < %s \ +; RUN: -target-abi=lp64 | FileCheck -check-prefixes=RV64IZFINXZDINX %s define signext i8 @test_floor_si8(double %x) { ; RV32IFD-LABEL: test_floor_si8: @@ -14,6 +18,23 @@ ; RV64IFD: # %bb.0: ; RV64IFD-NEXT: fcvt.l.d a0, fa0, rdn ; RV64IFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: test_floor_si8: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.w.d a0, a0, rdn +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_floor_si8: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.l.d a0, a0, rdn +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.floor.f64(double %x) %b = fptosi double %a to i8 ret i8 %b @@ -29,6 +50,23 @@ ; RV64IFD: # %bb.0: ; RV64IFD-NEXT: fcvt.l.d a0, fa0, rdn ; RV64IFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: test_floor_si16: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.w.d a0, a0, rdn +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_floor_si16: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.l.d a0, a0, rdn +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.floor.f64(double %x) %b = fptosi double %a to i16 ret i16 %b @@ -39,6 +77,23 @@ ; CHECKIFD: # %bb.0: ; CHECKIFD-NEXT: fcvt.w.d a0, fa0, rdn ; CHECKIFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: test_floor_si32: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.w.d a0, a0, rdn +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_floor_si32: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.w.d a0, a0, rdn +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.floor.f64(double %x) %b = fptosi double %a to i32 ret i32 %b @@ -61,6 +116,23 @@ ; RV64IFD: # %bb.0: ; RV64IFD-NEXT: fcvt.l.d a0, fa0, rdn ; RV64IFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: test_floor_si64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: .cfi_offset ra, -4 +; RV32IZFINXZDINX-NEXT: call floor@plt +; RV32IZFINXZDINX-NEXT: call __fixdfdi@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_floor_si64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.l.d a0, a0, rdn +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.floor.f64(double %x) %b = fptosi double %a to i64 ret i64 %b @@ -76,6 +148,23 @@ ; RV64IFD: # %bb.0: ; RV64IFD-NEXT: fcvt.lu.d a0, fa0, rdn ; RV64IFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: test_floor_ui8: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.wu.d a0, a0, rdn +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_floor_ui8: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.lu.d a0, a0, rdn +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.floor.f64(double %x) %b = fptoui double %a to i8 ret i8 %b @@ -91,6 +180,23 @@ ; RV64IFD: # %bb.0: ; RV64IFD-NEXT: fcvt.lu.d a0, fa0, rdn ; RV64IFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: test_floor_ui16: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.wu.d a0, a0, rdn +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_floor_ui16: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.lu.d a0, a0, rdn +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.floor.f64(double %x) %b = fptoui double %a to i16 ret i16 %b @@ -101,6 +207,23 @@ ; CHECKIFD: # %bb.0: ; CHECKIFD-NEXT: fcvt.wu.d a0, fa0, rdn ; CHECKIFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: test_floor_ui32: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.wu.d a0, a0, rdn +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_floor_ui32: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.wu.d a0, a0, rdn +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.floor.f64(double %x) %b = fptoui double %a to i32 ret i32 %b @@ -123,6 +246,23 @@ ; RV64IFD: # %bb.0: ; RV64IFD-NEXT: fcvt.lu.d a0, fa0, rdn ; RV64IFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: test_floor_ui64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: .cfi_offset ra, -4 +; RV32IZFINXZDINX-NEXT: call floor@plt +; RV32IZFINXZDINX-NEXT: call __fixunsdfdi@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_floor_ui64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.lu.d a0, a0, rdn +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.floor.f64(double %x) %b = fptoui double %a to i64 ret i64 %b @@ -138,6 +278,23 @@ ; RV64IFD: # %bb.0: ; RV64IFD-NEXT: fcvt.l.d a0, fa0, rup ; RV64IFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: test_ceil_si8: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.w.d a0, a0, rup +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_ceil_si8: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.l.d a0, a0, rup +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.ceil.f64(double %x) %b = fptosi double %a to i8 ret i8 %b @@ -153,6 +310,23 @@ ; RV64IFD: # %bb.0: ; RV64IFD-NEXT: fcvt.l.d a0, fa0, rup ; RV64IFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: test_ceil_si16: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.w.d a0, a0, rup +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_ceil_si16: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.l.d a0, a0, rup +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.ceil.f64(double %x) %b = fptosi double %a to i16 ret i16 %b @@ -163,6 +337,23 @@ ; CHECKIFD: # %bb.0: ; CHECKIFD-NEXT: fcvt.w.d a0, fa0, rup ; CHECKIFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: test_ceil_si32: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.w.d a0, a0, rup +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_ceil_si32: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.w.d a0, a0, rup +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.ceil.f64(double %x) %b = fptosi double %a to i32 ret i32 %b @@ -185,6 +376,23 @@ ; RV64IFD: # %bb.0: ; RV64IFD-NEXT: fcvt.l.d a0, fa0, rup ; RV64IFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: test_ceil_si64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: .cfi_offset ra, -4 +; RV32IZFINXZDINX-NEXT: call ceil@plt +; RV32IZFINXZDINX-NEXT: call __fixdfdi@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_ceil_si64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.l.d a0, a0, rup +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.ceil.f64(double %x) %b = fptosi double %a to i64 ret i64 %b @@ -200,6 +408,23 @@ ; RV64IFD: # %bb.0: ; RV64IFD-NEXT: fcvt.lu.d a0, fa0, rup ; RV64IFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: test_ceil_ui8: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.wu.d a0, a0, rup +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_ceil_ui8: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.lu.d a0, a0, rup +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.ceil.f64(double %x) %b = fptoui double %a to i8 ret i8 %b @@ -215,6 +440,23 @@ ; RV64IFD: # %bb.0: ; RV64IFD-NEXT: fcvt.lu.d a0, fa0, rup ; RV64IFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: test_ceil_ui16: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.wu.d a0, a0, rup +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_ceil_ui16: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.lu.d a0, a0, rup +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.ceil.f64(double %x) %b = fptoui double %a to i16 ret i16 %b @@ -225,6 +467,23 @@ ; CHECKIFD: # %bb.0: ; CHECKIFD-NEXT: fcvt.wu.d a0, fa0, rup ; CHECKIFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: test_ceil_ui32: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.wu.d a0, a0, rup +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_ceil_ui32: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.wu.d a0, a0, rup +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.ceil.f64(double %x) %b = fptoui double %a to i32 ret i32 %b @@ -247,6 +506,23 @@ ; RV64IFD: # %bb.0: ; RV64IFD-NEXT: fcvt.lu.d a0, fa0, rup ; RV64IFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: test_ceil_ui64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: .cfi_offset ra, -4 +; RV32IZFINXZDINX-NEXT: call ceil@plt +; RV32IZFINXZDINX-NEXT: call __fixunsdfdi@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_ceil_ui64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.lu.d a0, a0, rup +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.ceil.f64(double %x) %b = fptoui double %a to i64 ret i64 %b @@ -262,6 +538,23 @@ ; RV64IFD: # %bb.0: ; RV64IFD-NEXT: fcvt.l.d a0, fa0, rtz ; RV64IFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: test_trunc_si8: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.w.d a0, a0, rtz +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_trunc_si8: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.l.d a0, a0, rtz +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.trunc.f64(double %x) %b = fptosi double %a to i8 ret i8 %b @@ -277,6 +570,23 @@ ; RV64IFD: # %bb.0: ; RV64IFD-NEXT: fcvt.l.d a0, fa0, rtz ; RV64IFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: test_trunc_si16: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.w.d a0, a0, rtz +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_trunc_si16: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.l.d a0, a0, rtz +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.trunc.f64(double %x) %b = fptosi double %a to i16 ret i16 %b @@ -287,6 +597,23 @@ ; CHECKIFD: # %bb.0: ; CHECKIFD-NEXT: fcvt.w.d a0, fa0, rtz ; CHECKIFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: test_trunc_si32: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.w.d a0, a0, rtz +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_trunc_si32: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.w.d a0, a0, rtz +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.trunc.f64(double %x) %b = fptosi double %a to i32 ret i32 %b @@ -309,6 +636,23 @@ ; RV64IFD: # %bb.0: ; RV64IFD-NEXT: fcvt.l.d a0, fa0, rtz ; RV64IFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: test_trunc_si64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: .cfi_offset ra, -4 +; RV32IZFINXZDINX-NEXT: call trunc@plt +; RV32IZFINXZDINX-NEXT: call __fixdfdi@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_trunc_si64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.l.d a0, a0, rtz +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.trunc.f64(double %x) %b = fptosi double %a to i64 ret i64 %b @@ -324,6 +668,23 @@ ; RV64IFD: # %bb.0: ; RV64IFD-NEXT: fcvt.lu.d a0, fa0, rtz ; RV64IFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: test_trunc_ui8: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.wu.d a0, a0, rtz +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_trunc_ui8: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.lu.d a0, a0, rtz +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.trunc.f64(double %x) %b = fptoui double %a to i8 ret i8 %b @@ -339,6 +700,23 @@ ; RV64IFD: # %bb.0: ; RV64IFD-NEXT: fcvt.lu.d a0, fa0, rtz ; RV64IFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: test_trunc_ui16: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.wu.d a0, a0, rtz +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_trunc_ui16: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.lu.d a0, a0, rtz +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.trunc.f64(double %x) %b = fptoui double %a to i16 ret i16 %b @@ -349,6 +727,23 @@ ; CHECKIFD: # %bb.0: ; CHECKIFD-NEXT: fcvt.wu.d a0, fa0, rtz ; CHECKIFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: test_trunc_ui32: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.wu.d a0, a0, rtz +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_trunc_ui32: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.wu.d a0, a0, rtz +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.trunc.f64(double %x) %b = fptoui double %a to i32 ret i32 %b @@ -371,6 +766,23 @@ ; RV64IFD: # %bb.0: ; RV64IFD-NEXT: fcvt.lu.d a0, fa0, rtz ; RV64IFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: test_trunc_ui64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: .cfi_offset ra, -4 +; RV32IZFINXZDINX-NEXT: call trunc@plt +; RV32IZFINXZDINX-NEXT: call __fixunsdfdi@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_trunc_ui64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.lu.d a0, a0, rtz +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.trunc.f64(double %x) %b = fptoui double %a to i64 ret i64 %b @@ -386,6 +798,23 @@ ; RV64IFD: # %bb.0: ; RV64IFD-NEXT: fcvt.l.d a0, fa0, rmm ; RV64IFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: test_round_si8: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.w.d a0, a0, rmm +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_round_si8: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.l.d a0, a0, rmm +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.round.f64(double %x) %b = fptosi double %a to i8 ret i8 %b @@ -401,6 +830,23 @@ ; RV64IFD: # %bb.0: ; RV64IFD-NEXT: fcvt.l.d a0, fa0, rmm ; RV64IFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: test_round_si16: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.w.d a0, a0, rmm +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_round_si16: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.l.d a0, a0, rmm +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.round.f64(double %x) %b = fptosi double %a to i16 ret i16 %b @@ -411,6 +857,23 @@ ; CHECKIFD: # %bb.0: ; CHECKIFD-NEXT: fcvt.w.d a0, fa0, rmm ; CHECKIFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: test_round_si32: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.w.d a0, a0, rmm +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_round_si32: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.w.d a0, a0, rmm +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.round.f64(double %x) %b = fptosi double %a to i32 ret i32 %b @@ -433,6 +896,23 @@ ; RV64IFD: # %bb.0: ; RV64IFD-NEXT: fcvt.l.d a0, fa0, rmm ; RV64IFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: test_round_si64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: .cfi_offset ra, -4 +; RV32IZFINXZDINX-NEXT: call round@plt +; RV32IZFINXZDINX-NEXT: call __fixdfdi@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_round_si64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.l.d a0, a0, rmm +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.round.f64(double %x) %b = fptosi double %a to i64 ret i64 %b @@ -448,6 +928,23 @@ ; RV64IFD: # %bb.0: ; RV64IFD-NEXT: fcvt.lu.d a0, fa0, rmm ; RV64IFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: test_round_ui8: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.wu.d a0, a0, rmm +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_round_ui8: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.lu.d a0, a0, rmm +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.round.f64(double %x) %b = fptoui double %a to i8 ret i8 %b @@ -463,6 +960,23 @@ ; RV64IFD: # %bb.0: ; RV64IFD-NEXT: fcvt.lu.d a0, fa0, rmm ; RV64IFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: test_round_ui16: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.wu.d a0, a0, rmm +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_round_ui16: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.lu.d a0, a0, rmm +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.round.f64(double %x) %b = fptoui double %a to i16 ret i16 %b @@ -473,6 +987,23 @@ ; CHECKIFD: # %bb.0: ; CHECKIFD-NEXT: fcvt.wu.d a0, fa0, rmm ; CHECKIFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: test_round_ui32: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.wu.d a0, a0, rmm +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_round_ui32: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.wu.d a0, a0, rmm +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.round.f64(double %x) %b = fptoui double %a to i32 ret i32 %b @@ -495,6 +1026,23 @@ ; RV64IFD: # %bb.0: ; RV64IFD-NEXT: fcvt.lu.d a0, fa0, rmm ; RV64IFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: test_round_ui64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: .cfi_offset ra, -4 +; RV32IZFINXZDINX-NEXT: call round@plt +; RV32IZFINXZDINX-NEXT: call __fixunsdfdi@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_round_ui64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.lu.d a0, a0, rmm +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.round.f64(double %x) %b = fptoui double %a to i64 ret i64 %b @@ -510,6 +1058,23 @@ ; RV64IFD: # %bb.0: ; RV64IFD-NEXT: fcvt.l.d a0, fa0, rne ; RV64IFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: test_roundeven_si8: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.w.d a0, a0, rne +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_roundeven_si8: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.l.d a0, a0, rne +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.roundeven.f64(double %x) %b = fptosi double %a to i8 ret i8 %b @@ -525,6 +1090,23 @@ ; RV64IFD: # %bb.0: ; RV64IFD-NEXT: fcvt.l.d a0, fa0, rne ; RV64IFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: test_roundeven_si16: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.w.d a0, a0, rne +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_roundeven_si16: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.l.d a0, a0, rne +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.roundeven.f64(double %x) %b = fptosi double %a to i16 ret i16 %b @@ -535,6 +1117,23 @@ ; CHECKIFD: # %bb.0: ; CHECKIFD-NEXT: fcvt.w.d a0, fa0, rne ; CHECKIFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: test_roundeven_si32: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.w.d a0, a0, rne +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_roundeven_si32: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.w.d a0, a0, rne +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.roundeven.f64(double %x) %b = fptosi double %a to i32 ret i32 %b @@ -557,6 +1156,23 @@ ; RV64IFD: # %bb.0: ; RV64IFD-NEXT: fcvt.l.d a0, fa0, rne ; RV64IFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: test_roundeven_si64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: .cfi_offset ra, -4 +; RV32IZFINXZDINX-NEXT: call roundeven@plt +; RV32IZFINXZDINX-NEXT: call __fixdfdi@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_roundeven_si64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.l.d a0, a0, rne +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.roundeven.f64(double %x) %b = fptosi double %a to i64 ret i64 %b @@ -572,6 +1188,23 @@ ; RV64IFD: # %bb.0: ; RV64IFD-NEXT: fcvt.lu.d a0, fa0, rne ; RV64IFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: test_roundeven_ui8: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.wu.d a0, a0, rne +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_roundeven_ui8: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.lu.d a0, a0, rne +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.roundeven.f64(double %x) %b = fptoui double %a to i8 ret i8 %b @@ -587,6 +1220,23 @@ ; RV64IFD: # %bb.0: ; RV64IFD-NEXT: fcvt.lu.d a0, fa0, rne ; RV64IFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: test_roundeven_ui16: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.wu.d a0, a0, rne +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_roundeven_ui16: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.lu.d a0, a0, rne +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.roundeven.f64(double %x) %b = fptoui double %a to i16 ret i16 %b @@ -597,6 +1247,23 @@ ; CHECKIFD: # %bb.0: ; CHECKIFD-NEXT: fcvt.wu.d a0, fa0, rne ; CHECKIFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: test_roundeven_ui32: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: fcvt.wu.d a0, a0, rne +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_roundeven_ui32: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.wu.d a0, a0, rne +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.roundeven.f64(double %x) %b = fptoui double %a to i32 ret i32 %b @@ -619,6 +1286,23 @@ ; RV64IFD: # %bb.0: ; RV64IFD-NEXT: fcvt.lu.d a0, fa0, rne ; RV64IFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: test_roundeven_ui64: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: .cfi_offset ra, -4 +; RV32IZFINXZDINX-NEXT: call roundeven@plt +; RV32IZFINXZDINX-NEXT: call __fixunsdfdi@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_roundeven_ui64: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: fcvt.lu.d a0, a0, rne +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.roundeven.f64(double %x) %b = fptoui double %a to i64 ret i64 %b @@ -628,6 +1312,28 @@ ; CHECKIFD-LABEL: test_floor_double: ; CHECKIFD: # %bb.0: ; CHECKIFD-NEXT: tail floor@plt +; +; RV32IZFINXZDINX-LABEL: test_floor_double: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: .cfi_offset ra, -4 +; RV32IZFINXZDINX-NEXT: call floor@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_floor_double: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV64IZFINXZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV64IZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: .cfi_offset ra, -8 +; RV64IZFINXZDINX-NEXT: call floor@plt +; RV64IZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.floor.f64(double %x) ret double %a } @@ -636,6 +1342,28 @@ ; CHECKIFD-LABEL: test_ceil_double: ; CHECKIFD: # %bb.0: ; CHECKIFD-NEXT: tail ceil@plt +; +; RV32IZFINXZDINX-LABEL: test_ceil_double: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: .cfi_offset ra, -4 +; RV32IZFINXZDINX-NEXT: call ceil@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_ceil_double: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV64IZFINXZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV64IZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: .cfi_offset ra, -8 +; RV64IZFINXZDINX-NEXT: call ceil@plt +; RV64IZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.ceil.f64(double %x) ret double %a } @@ -644,6 +1372,28 @@ ; CHECKIFD-LABEL: test_trunc_double: ; CHECKIFD: # %bb.0: ; CHECKIFD-NEXT: tail trunc@plt +; +; RV32IZFINXZDINX-LABEL: test_trunc_double: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: .cfi_offset ra, -4 +; RV32IZFINXZDINX-NEXT: call trunc@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_trunc_double: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV64IZFINXZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV64IZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: .cfi_offset ra, -8 +; RV64IZFINXZDINX-NEXT: call trunc@plt +; RV64IZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.trunc.f64(double %x) ret double %a } @@ -652,6 +1402,28 @@ ; CHECKIFD-LABEL: test_round_double: ; CHECKIFD: # %bb.0: ; CHECKIFD-NEXT: tail round@plt +; +; RV32IZFINXZDINX-LABEL: test_round_double: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: .cfi_offset ra, -4 +; RV32IZFINXZDINX-NEXT: call round@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_round_double: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV64IZFINXZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV64IZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: .cfi_offset ra, -8 +; RV64IZFINXZDINX-NEXT: call round@plt +; RV64IZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.round.f64(double %x) ret double %a } @@ -660,6 +1432,28 @@ ; CHECKIFD-LABEL: test_roundeven_double: ; CHECKIFD: # %bb.0: ; CHECKIFD-NEXT: tail roundeven@plt +; +; RV32IZFINXZDINX-LABEL: test_roundeven_double: +; RV32IZFINXZDINX: # %bb.0: +; RV32IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV32IZFINXZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINXZDINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: .cfi_offset ra, -4 +; RV32IZFINXZDINX-NEXT: call roundeven@plt +; RV32IZFINXZDINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: test_roundeven_double: +; RV64IZFINXZDINX: # %bb.0: +; RV64IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV64IZFINXZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV64IZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: .cfi_offset ra, -8 +; RV64IZFINXZDINX-NEXT: call roundeven@plt +; RV64IZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV64IZFINXZDINX-NEXT: ret %a = call double @llvm.roundeven.f64(double %x) ret double %a } diff --git a/llvm/test/CodeGen/RISCV/double-select-fcmp.ll b/llvm/test/CodeGen/RISCV/double-select-fcmp.ll --- a/llvm/test/CodeGen/RISCV/double-select-fcmp.ll +++ b/llvm/test/CodeGen/RISCV/double-select-fcmp.ll @@ -3,12 +3,27 @@ ; RUN: -target-abi=ilp32d | FileCheck %s ; RUN: llc -mtriple=riscv64 -mattr=+d -verify-machineinstrs < %s \ ; RUN: -target-abi=lp64d | FileCheck %s +; RUN: llc -mtriple=riscv32 -mattr=+zdinx -verify-machineinstrs < %s \ +; RUN: -target-abi=ilp32 | FileCheck --check-prefix=CHECKRV32ZDINX %s +; RUN: llc -mtriple=riscv64 -mattr=+zdinx -verify-machineinstrs < %s \ +; RUN: -target-abi=lp64 | FileCheck --check-prefix=CHECKRV64ZDINX %s define double @select_fcmp_false(double %a, double %b) nounwind { ; CHECK-LABEL: select_fcmp_false: ; CHECK: # %bb.0: ; CHECK-NEXT: fmv.d fa0, fa1 ; CHECK-NEXT: ret +; +; CHECKRV32ZDINX-LABEL: select_fcmp_false: +; CHECKRV32ZDINX: # %bb.0: +; CHECKRV32ZDINX-NEXT: mv a1, a3 +; CHECKRV32ZDINX-NEXT: mv a0, a2 +; CHECKRV32ZDINX-NEXT: ret +; +; CHECKRV64ZDINX-LABEL: select_fcmp_false: +; CHECKRV64ZDINX: # %bb.0: +; CHECKRV64ZDINX-NEXT: mv a0, a1 +; CHECKRV64ZDINX-NEXT: ret %1 = fcmp false double %a, %b %2 = select i1 %1, double %a, double %b ret double %2 @@ -23,6 +38,38 @@ ; CHECK-NEXT: fmv.d fa0, fa1 ; CHECK-NEXT: .LBB1_2: ; CHECK-NEXT: ret +; +; CHECKRV32ZDINX-LABEL: select_fcmp_oeq: +; CHECKRV32ZDINX: # %bb.0: +; CHECKRV32ZDINX-NEXT: addi sp, sp, -16 +; CHECKRV32ZDINX-NEXT: sw a2, 8(sp) +; CHECKRV32ZDINX-NEXT: sw a3, 12(sp) +; CHECKRV32ZDINX-NEXT: lw a2, 8(sp) +; CHECKRV32ZDINX-NEXT: lw a3, 12(sp) +; CHECKRV32ZDINX-NEXT: sw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: sw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: lw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: lw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: feq.d a4, a0, a2 +; CHECKRV32ZDINX-NEXT: bnez a4, .LBB1_2 +; CHECKRV32ZDINX-NEXT: # %bb.1: +; CHECKRV32ZDINX-NEXT: mv a0, a2 +; CHECKRV32ZDINX-NEXT: .LBB1_2: +; CHECKRV32ZDINX-NEXT: sw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: sw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: lw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: lw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: addi sp, sp, 16 +; CHECKRV32ZDINX-NEXT: ret +; +; CHECKRV64ZDINX-LABEL: select_fcmp_oeq: +; CHECKRV64ZDINX: # %bb.0: +; CHECKRV64ZDINX-NEXT: feq.d a2, a0, a1 +; CHECKRV64ZDINX-NEXT: bnez a2, .LBB1_2 +; CHECKRV64ZDINX-NEXT: # %bb.1: +; CHECKRV64ZDINX-NEXT: mv a0, a1 +; CHECKRV64ZDINX-NEXT: .LBB1_2: +; CHECKRV64ZDINX-NEXT: ret %1 = fcmp oeq double %a, %b %2 = select i1 %1, double %a, double %b ret double %2 @@ -37,6 +84,38 @@ ; CHECK-NEXT: fmv.d fa0, fa1 ; CHECK-NEXT: .LBB2_2: ; CHECK-NEXT: ret +; +; CHECKRV32ZDINX-LABEL: select_fcmp_ogt: +; CHECKRV32ZDINX: # %bb.0: +; CHECKRV32ZDINX-NEXT: addi sp, sp, -16 +; CHECKRV32ZDINX-NEXT: sw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: sw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: lw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: lw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: sw a2, 8(sp) +; CHECKRV32ZDINX-NEXT: sw a3, 12(sp) +; CHECKRV32ZDINX-NEXT: lw a2, 8(sp) +; CHECKRV32ZDINX-NEXT: lw a3, 12(sp) +; CHECKRV32ZDINX-NEXT: flt.d a4, a2, a0 +; CHECKRV32ZDINX-NEXT: bnez a4, .LBB2_2 +; CHECKRV32ZDINX-NEXT: # %bb.1: +; CHECKRV32ZDINX-NEXT: mv a0, a2 +; CHECKRV32ZDINX-NEXT: .LBB2_2: +; CHECKRV32ZDINX-NEXT: sw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: sw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: lw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: lw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: addi sp, sp, 16 +; CHECKRV32ZDINX-NEXT: ret +; +; CHECKRV64ZDINX-LABEL: select_fcmp_ogt: +; CHECKRV64ZDINX: # %bb.0: +; CHECKRV64ZDINX-NEXT: flt.d a2, a1, a0 +; CHECKRV64ZDINX-NEXT: bnez a2, .LBB2_2 +; CHECKRV64ZDINX-NEXT: # %bb.1: +; CHECKRV64ZDINX-NEXT: mv a0, a1 +; CHECKRV64ZDINX-NEXT: .LBB2_2: +; CHECKRV64ZDINX-NEXT: ret %1 = fcmp ogt double %a, %b %2 = select i1 %1, double %a, double %b ret double %2 @@ -51,6 +130,38 @@ ; CHECK-NEXT: fmv.d fa0, fa1 ; CHECK-NEXT: .LBB3_2: ; CHECK-NEXT: ret +; +; CHECKRV32ZDINX-LABEL: select_fcmp_oge: +; CHECKRV32ZDINX: # %bb.0: +; CHECKRV32ZDINX-NEXT: addi sp, sp, -16 +; CHECKRV32ZDINX-NEXT: sw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: sw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: lw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: lw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: sw a2, 8(sp) +; CHECKRV32ZDINX-NEXT: sw a3, 12(sp) +; CHECKRV32ZDINX-NEXT: lw a2, 8(sp) +; CHECKRV32ZDINX-NEXT: lw a3, 12(sp) +; CHECKRV32ZDINX-NEXT: fle.d a4, a2, a0 +; CHECKRV32ZDINX-NEXT: bnez a4, .LBB3_2 +; CHECKRV32ZDINX-NEXT: # %bb.1: +; CHECKRV32ZDINX-NEXT: mv a0, a2 +; CHECKRV32ZDINX-NEXT: .LBB3_2: +; CHECKRV32ZDINX-NEXT: sw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: sw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: lw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: lw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: addi sp, sp, 16 +; CHECKRV32ZDINX-NEXT: ret +; +; CHECKRV64ZDINX-LABEL: select_fcmp_oge: +; CHECKRV64ZDINX: # %bb.0: +; CHECKRV64ZDINX-NEXT: fle.d a2, a1, a0 +; CHECKRV64ZDINX-NEXT: bnez a2, .LBB3_2 +; CHECKRV64ZDINX-NEXT: # %bb.1: +; CHECKRV64ZDINX-NEXT: mv a0, a1 +; CHECKRV64ZDINX-NEXT: .LBB3_2: +; CHECKRV64ZDINX-NEXT: ret %1 = fcmp oge double %a, %b %2 = select i1 %1, double %a, double %b ret double %2 @@ -65,6 +176,38 @@ ; CHECK-NEXT: fmv.d fa0, fa1 ; CHECK-NEXT: .LBB4_2: ; CHECK-NEXT: ret +; +; CHECKRV32ZDINX-LABEL: select_fcmp_olt: +; CHECKRV32ZDINX: # %bb.0: +; CHECKRV32ZDINX-NEXT: addi sp, sp, -16 +; CHECKRV32ZDINX-NEXT: sw a2, 8(sp) +; CHECKRV32ZDINX-NEXT: sw a3, 12(sp) +; CHECKRV32ZDINX-NEXT: lw a2, 8(sp) +; CHECKRV32ZDINX-NEXT: lw a3, 12(sp) +; CHECKRV32ZDINX-NEXT: sw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: sw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: lw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: lw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: flt.d a4, a0, a2 +; CHECKRV32ZDINX-NEXT: bnez a4, .LBB4_2 +; CHECKRV32ZDINX-NEXT: # %bb.1: +; CHECKRV32ZDINX-NEXT: mv a0, a2 +; CHECKRV32ZDINX-NEXT: .LBB4_2: +; CHECKRV32ZDINX-NEXT: sw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: sw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: lw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: lw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: addi sp, sp, 16 +; CHECKRV32ZDINX-NEXT: ret +; +; CHECKRV64ZDINX-LABEL: select_fcmp_olt: +; CHECKRV64ZDINX: # %bb.0: +; CHECKRV64ZDINX-NEXT: flt.d a2, a0, a1 +; CHECKRV64ZDINX-NEXT: bnez a2, .LBB4_2 +; CHECKRV64ZDINX-NEXT: # %bb.1: +; CHECKRV64ZDINX-NEXT: mv a0, a1 +; CHECKRV64ZDINX-NEXT: .LBB4_2: +; CHECKRV64ZDINX-NEXT: ret %1 = fcmp olt double %a, %b %2 = select i1 %1, double %a, double %b ret double %2 @@ -79,6 +222,38 @@ ; CHECK-NEXT: fmv.d fa0, fa1 ; CHECK-NEXT: .LBB5_2: ; CHECK-NEXT: ret +; +; CHECKRV32ZDINX-LABEL: select_fcmp_ole: +; CHECKRV32ZDINX: # %bb.0: +; CHECKRV32ZDINX-NEXT: addi sp, sp, -16 +; CHECKRV32ZDINX-NEXT: sw a2, 8(sp) +; CHECKRV32ZDINX-NEXT: sw a3, 12(sp) +; CHECKRV32ZDINX-NEXT: lw a2, 8(sp) +; CHECKRV32ZDINX-NEXT: lw a3, 12(sp) +; CHECKRV32ZDINX-NEXT: sw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: sw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: lw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: lw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: fle.d a4, a0, a2 +; CHECKRV32ZDINX-NEXT: bnez a4, .LBB5_2 +; CHECKRV32ZDINX-NEXT: # %bb.1: +; CHECKRV32ZDINX-NEXT: mv a0, a2 +; CHECKRV32ZDINX-NEXT: .LBB5_2: +; CHECKRV32ZDINX-NEXT: sw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: sw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: lw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: lw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: addi sp, sp, 16 +; CHECKRV32ZDINX-NEXT: ret +; +; CHECKRV64ZDINX-LABEL: select_fcmp_ole: +; CHECKRV64ZDINX: # %bb.0: +; CHECKRV64ZDINX-NEXT: fle.d a2, a0, a1 +; CHECKRV64ZDINX-NEXT: bnez a2, .LBB5_2 +; CHECKRV64ZDINX-NEXT: # %bb.1: +; CHECKRV64ZDINX-NEXT: mv a0, a1 +; CHECKRV64ZDINX-NEXT: .LBB5_2: +; CHECKRV64ZDINX-NEXT: ret %1 = fcmp ole double %a, %b %2 = select i1 %1, double %a, double %b ret double %2 @@ -95,6 +270,42 @@ ; CHECK-NEXT: fmv.d fa0, fa1 ; CHECK-NEXT: .LBB6_2: ; CHECK-NEXT: ret +; +; CHECKRV32ZDINX-LABEL: select_fcmp_one: +; CHECKRV32ZDINX: # %bb.0: +; CHECKRV32ZDINX-NEXT: addi sp, sp, -16 +; CHECKRV32ZDINX-NEXT: sw a2, 8(sp) +; CHECKRV32ZDINX-NEXT: sw a3, 12(sp) +; CHECKRV32ZDINX-NEXT: lw a2, 8(sp) +; CHECKRV32ZDINX-NEXT: lw a3, 12(sp) +; CHECKRV32ZDINX-NEXT: sw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: sw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: lw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: lw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: flt.d a4, a0, a2 +; CHECKRV32ZDINX-NEXT: flt.d a5, a2, a0 +; CHECKRV32ZDINX-NEXT: or a4, a5, a4 +; CHECKRV32ZDINX-NEXT: bnez a4, .LBB6_2 +; CHECKRV32ZDINX-NEXT: # %bb.1: +; CHECKRV32ZDINX-NEXT: mv a0, a2 +; CHECKRV32ZDINX-NEXT: .LBB6_2: +; CHECKRV32ZDINX-NEXT: sw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: sw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: lw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: lw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: addi sp, sp, 16 +; CHECKRV32ZDINX-NEXT: ret +; +; CHECKRV64ZDINX-LABEL: select_fcmp_one: +; CHECKRV64ZDINX: # %bb.0: +; CHECKRV64ZDINX-NEXT: flt.d a2, a0, a1 +; CHECKRV64ZDINX-NEXT: flt.d a3, a1, a0 +; CHECKRV64ZDINX-NEXT: or a2, a3, a2 +; CHECKRV64ZDINX-NEXT: bnez a2, .LBB6_2 +; CHECKRV64ZDINX-NEXT: # %bb.1: +; CHECKRV64ZDINX-NEXT: mv a0, a1 +; CHECKRV64ZDINX-NEXT: .LBB6_2: +; CHECKRV64ZDINX-NEXT: ret %1 = fcmp one double %a, %b %2 = select i1 %1, double %a, double %b ret double %2 @@ -111,6 +322,42 @@ ; CHECK-NEXT: fmv.d fa0, fa1 ; CHECK-NEXT: .LBB7_2: ; CHECK-NEXT: ret +; +; CHECKRV32ZDINX-LABEL: select_fcmp_ord: +; CHECKRV32ZDINX: # %bb.0: +; CHECKRV32ZDINX-NEXT: addi sp, sp, -16 +; CHECKRV32ZDINX-NEXT: sw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: sw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: lw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: lw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: sw a2, 8(sp) +; CHECKRV32ZDINX-NEXT: sw a3, 12(sp) +; CHECKRV32ZDINX-NEXT: lw a2, 8(sp) +; CHECKRV32ZDINX-NEXT: lw a3, 12(sp) +; CHECKRV32ZDINX-NEXT: feq.d a4, a2, a2 +; CHECKRV32ZDINX-NEXT: feq.d a5, a0, a0 +; CHECKRV32ZDINX-NEXT: and a4, a5, a4 +; CHECKRV32ZDINX-NEXT: bnez a4, .LBB7_2 +; CHECKRV32ZDINX-NEXT: # %bb.1: +; CHECKRV32ZDINX-NEXT: mv a0, a2 +; CHECKRV32ZDINX-NEXT: .LBB7_2: +; CHECKRV32ZDINX-NEXT: sw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: sw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: lw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: lw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: addi sp, sp, 16 +; CHECKRV32ZDINX-NEXT: ret +; +; CHECKRV64ZDINX-LABEL: select_fcmp_ord: +; CHECKRV64ZDINX: # %bb.0: +; CHECKRV64ZDINX-NEXT: feq.d a2, a1, a1 +; CHECKRV64ZDINX-NEXT: feq.d a3, a0, a0 +; CHECKRV64ZDINX-NEXT: and a2, a3, a2 +; CHECKRV64ZDINX-NEXT: bnez a2, .LBB7_2 +; CHECKRV64ZDINX-NEXT: # %bb.1: +; CHECKRV64ZDINX-NEXT: mv a0, a1 +; CHECKRV64ZDINX-NEXT: .LBB7_2: +; CHECKRV64ZDINX-NEXT: ret %1 = fcmp ord double %a, %b %2 = select i1 %1, double %a, double %b ret double %2 @@ -127,6 +374,42 @@ ; CHECK-NEXT: fmv.d fa0, fa1 ; CHECK-NEXT: .LBB8_2: ; CHECK-NEXT: ret +; +; CHECKRV32ZDINX-LABEL: select_fcmp_ueq: +; CHECKRV32ZDINX: # %bb.0: +; CHECKRV32ZDINX-NEXT: addi sp, sp, -16 +; CHECKRV32ZDINX-NEXT: sw a2, 8(sp) +; CHECKRV32ZDINX-NEXT: sw a3, 12(sp) +; CHECKRV32ZDINX-NEXT: lw a2, 8(sp) +; CHECKRV32ZDINX-NEXT: lw a3, 12(sp) +; CHECKRV32ZDINX-NEXT: sw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: sw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: lw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: lw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: flt.d a4, a0, a2 +; CHECKRV32ZDINX-NEXT: flt.d a5, a2, a0 +; CHECKRV32ZDINX-NEXT: or a4, a5, a4 +; CHECKRV32ZDINX-NEXT: beqz a4, .LBB8_2 +; CHECKRV32ZDINX-NEXT: # %bb.1: +; CHECKRV32ZDINX-NEXT: mv a0, a2 +; CHECKRV32ZDINX-NEXT: .LBB8_2: +; CHECKRV32ZDINX-NEXT: sw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: sw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: lw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: lw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: addi sp, sp, 16 +; CHECKRV32ZDINX-NEXT: ret +; +; CHECKRV64ZDINX-LABEL: select_fcmp_ueq: +; CHECKRV64ZDINX: # %bb.0: +; CHECKRV64ZDINX-NEXT: flt.d a2, a0, a1 +; CHECKRV64ZDINX-NEXT: flt.d a3, a1, a0 +; CHECKRV64ZDINX-NEXT: or a2, a3, a2 +; CHECKRV64ZDINX-NEXT: beqz a2, .LBB8_2 +; CHECKRV64ZDINX-NEXT: # %bb.1: +; CHECKRV64ZDINX-NEXT: mv a0, a1 +; CHECKRV64ZDINX-NEXT: .LBB8_2: +; CHECKRV64ZDINX-NEXT: ret %1 = fcmp ueq double %a, %b %2 = select i1 %1, double %a, double %b ret double %2 @@ -141,6 +424,38 @@ ; CHECK-NEXT: fmv.d fa0, fa1 ; CHECK-NEXT: .LBB9_2: ; CHECK-NEXT: ret +; +; CHECKRV32ZDINX-LABEL: select_fcmp_ugt: +; CHECKRV32ZDINX: # %bb.0: +; CHECKRV32ZDINX-NEXT: addi sp, sp, -16 +; CHECKRV32ZDINX-NEXT: sw a2, 8(sp) +; CHECKRV32ZDINX-NEXT: sw a3, 12(sp) +; CHECKRV32ZDINX-NEXT: lw a2, 8(sp) +; CHECKRV32ZDINX-NEXT: lw a3, 12(sp) +; CHECKRV32ZDINX-NEXT: sw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: sw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: lw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: lw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: fle.d a4, a0, a2 +; CHECKRV32ZDINX-NEXT: beqz a4, .LBB9_2 +; CHECKRV32ZDINX-NEXT: # %bb.1: +; CHECKRV32ZDINX-NEXT: mv a0, a2 +; CHECKRV32ZDINX-NEXT: .LBB9_2: +; CHECKRV32ZDINX-NEXT: sw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: sw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: lw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: lw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: addi sp, sp, 16 +; CHECKRV32ZDINX-NEXT: ret +; +; CHECKRV64ZDINX-LABEL: select_fcmp_ugt: +; CHECKRV64ZDINX: # %bb.0: +; CHECKRV64ZDINX-NEXT: fle.d a2, a0, a1 +; CHECKRV64ZDINX-NEXT: beqz a2, .LBB9_2 +; CHECKRV64ZDINX-NEXT: # %bb.1: +; CHECKRV64ZDINX-NEXT: mv a0, a1 +; CHECKRV64ZDINX-NEXT: .LBB9_2: +; CHECKRV64ZDINX-NEXT: ret %1 = fcmp ugt double %a, %b %2 = select i1 %1, double %a, double %b ret double %2 @@ -155,6 +470,38 @@ ; CHECK-NEXT: fmv.d fa0, fa1 ; CHECK-NEXT: .LBB10_2: ; CHECK-NEXT: ret +; +; CHECKRV32ZDINX-LABEL: select_fcmp_uge: +; CHECKRV32ZDINX: # %bb.0: +; CHECKRV32ZDINX-NEXT: addi sp, sp, -16 +; CHECKRV32ZDINX-NEXT: sw a2, 8(sp) +; CHECKRV32ZDINX-NEXT: sw a3, 12(sp) +; CHECKRV32ZDINX-NEXT: lw a2, 8(sp) +; CHECKRV32ZDINX-NEXT: lw a3, 12(sp) +; CHECKRV32ZDINX-NEXT: sw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: sw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: lw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: lw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: flt.d a4, a0, a2 +; CHECKRV32ZDINX-NEXT: beqz a4, .LBB10_2 +; CHECKRV32ZDINX-NEXT: # %bb.1: +; CHECKRV32ZDINX-NEXT: mv a0, a2 +; CHECKRV32ZDINX-NEXT: .LBB10_2: +; CHECKRV32ZDINX-NEXT: sw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: sw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: lw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: lw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: addi sp, sp, 16 +; CHECKRV32ZDINX-NEXT: ret +; +; CHECKRV64ZDINX-LABEL: select_fcmp_uge: +; CHECKRV64ZDINX: # %bb.0: +; CHECKRV64ZDINX-NEXT: flt.d a2, a0, a1 +; CHECKRV64ZDINX-NEXT: beqz a2, .LBB10_2 +; CHECKRV64ZDINX-NEXT: # %bb.1: +; CHECKRV64ZDINX-NEXT: mv a0, a1 +; CHECKRV64ZDINX-NEXT: .LBB10_2: +; CHECKRV64ZDINX-NEXT: ret %1 = fcmp uge double %a, %b %2 = select i1 %1, double %a, double %b ret double %2 @@ -169,6 +516,38 @@ ; CHECK-NEXT: fmv.d fa0, fa1 ; CHECK-NEXT: .LBB11_2: ; CHECK-NEXT: ret +; +; CHECKRV32ZDINX-LABEL: select_fcmp_ult: +; CHECKRV32ZDINX: # %bb.0: +; CHECKRV32ZDINX-NEXT: addi sp, sp, -16 +; CHECKRV32ZDINX-NEXT: sw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: sw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: lw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: lw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: sw a2, 8(sp) +; CHECKRV32ZDINX-NEXT: sw a3, 12(sp) +; CHECKRV32ZDINX-NEXT: lw a2, 8(sp) +; CHECKRV32ZDINX-NEXT: lw a3, 12(sp) +; CHECKRV32ZDINX-NEXT: fle.d a4, a2, a0 +; CHECKRV32ZDINX-NEXT: beqz a4, .LBB11_2 +; CHECKRV32ZDINX-NEXT: # %bb.1: +; CHECKRV32ZDINX-NEXT: mv a0, a2 +; CHECKRV32ZDINX-NEXT: .LBB11_2: +; CHECKRV32ZDINX-NEXT: sw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: sw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: lw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: lw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: addi sp, sp, 16 +; CHECKRV32ZDINX-NEXT: ret +; +; CHECKRV64ZDINX-LABEL: select_fcmp_ult: +; CHECKRV64ZDINX: # %bb.0: +; CHECKRV64ZDINX-NEXT: fle.d a2, a1, a0 +; CHECKRV64ZDINX-NEXT: beqz a2, .LBB11_2 +; CHECKRV64ZDINX-NEXT: # %bb.1: +; CHECKRV64ZDINX-NEXT: mv a0, a1 +; CHECKRV64ZDINX-NEXT: .LBB11_2: +; CHECKRV64ZDINX-NEXT: ret %1 = fcmp ult double %a, %b %2 = select i1 %1, double %a, double %b ret double %2 @@ -183,6 +562,38 @@ ; CHECK-NEXT: fmv.d fa0, fa1 ; CHECK-NEXT: .LBB12_2: ; CHECK-NEXT: ret +; +; CHECKRV32ZDINX-LABEL: select_fcmp_ule: +; CHECKRV32ZDINX: # %bb.0: +; CHECKRV32ZDINX-NEXT: addi sp, sp, -16 +; CHECKRV32ZDINX-NEXT: sw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: sw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: lw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: lw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: sw a2, 8(sp) +; CHECKRV32ZDINX-NEXT: sw a3, 12(sp) +; CHECKRV32ZDINX-NEXT: lw a2, 8(sp) +; CHECKRV32ZDINX-NEXT: lw a3, 12(sp) +; CHECKRV32ZDINX-NEXT: flt.d a4, a2, a0 +; CHECKRV32ZDINX-NEXT: beqz a4, .LBB12_2 +; CHECKRV32ZDINX-NEXT: # %bb.1: +; CHECKRV32ZDINX-NEXT: mv a0, a2 +; CHECKRV32ZDINX-NEXT: .LBB12_2: +; CHECKRV32ZDINX-NEXT: sw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: sw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: lw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: lw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: addi sp, sp, 16 +; CHECKRV32ZDINX-NEXT: ret +; +; CHECKRV64ZDINX-LABEL: select_fcmp_ule: +; CHECKRV64ZDINX: # %bb.0: +; CHECKRV64ZDINX-NEXT: flt.d a2, a1, a0 +; CHECKRV64ZDINX-NEXT: beqz a2, .LBB12_2 +; CHECKRV64ZDINX-NEXT: # %bb.1: +; CHECKRV64ZDINX-NEXT: mv a0, a1 +; CHECKRV64ZDINX-NEXT: .LBB12_2: +; CHECKRV64ZDINX-NEXT: ret %1 = fcmp ule double %a, %b %2 = select i1 %1, double %a, double %b ret double %2 @@ -197,6 +608,38 @@ ; CHECK-NEXT: fmv.d fa0, fa1 ; CHECK-NEXT: .LBB13_2: ; CHECK-NEXT: ret +; +; CHECKRV32ZDINX-LABEL: select_fcmp_une: +; CHECKRV32ZDINX: # %bb.0: +; CHECKRV32ZDINX-NEXT: addi sp, sp, -16 +; CHECKRV32ZDINX-NEXT: sw a2, 8(sp) +; CHECKRV32ZDINX-NEXT: sw a3, 12(sp) +; CHECKRV32ZDINX-NEXT: lw a2, 8(sp) +; CHECKRV32ZDINX-NEXT: lw a3, 12(sp) +; CHECKRV32ZDINX-NEXT: sw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: sw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: lw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: lw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: feq.d a4, a0, a2 +; CHECKRV32ZDINX-NEXT: beqz a4, .LBB13_2 +; CHECKRV32ZDINX-NEXT: # %bb.1: +; CHECKRV32ZDINX-NEXT: mv a0, a2 +; CHECKRV32ZDINX-NEXT: .LBB13_2: +; CHECKRV32ZDINX-NEXT: sw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: sw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: lw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: lw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: addi sp, sp, 16 +; CHECKRV32ZDINX-NEXT: ret +; +; CHECKRV64ZDINX-LABEL: select_fcmp_une: +; CHECKRV64ZDINX: # %bb.0: +; CHECKRV64ZDINX-NEXT: feq.d a2, a0, a1 +; CHECKRV64ZDINX-NEXT: beqz a2, .LBB13_2 +; CHECKRV64ZDINX-NEXT: # %bb.1: +; CHECKRV64ZDINX-NEXT: mv a0, a1 +; CHECKRV64ZDINX-NEXT: .LBB13_2: +; CHECKRV64ZDINX-NEXT: ret %1 = fcmp une double %a, %b %2 = select i1 %1, double %a, double %b ret double %2 @@ -213,6 +656,42 @@ ; CHECK-NEXT: fmv.d fa0, fa1 ; CHECK-NEXT: .LBB14_2: ; CHECK-NEXT: ret +; +; CHECKRV32ZDINX-LABEL: select_fcmp_uno: +; CHECKRV32ZDINX: # %bb.0: +; CHECKRV32ZDINX-NEXT: addi sp, sp, -16 +; CHECKRV32ZDINX-NEXT: sw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: sw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: lw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: lw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: sw a2, 8(sp) +; CHECKRV32ZDINX-NEXT: sw a3, 12(sp) +; CHECKRV32ZDINX-NEXT: lw a2, 8(sp) +; CHECKRV32ZDINX-NEXT: lw a3, 12(sp) +; CHECKRV32ZDINX-NEXT: feq.d a4, a2, a2 +; CHECKRV32ZDINX-NEXT: feq.d a5, a0, a0 +; CHECKRV32ZDINX-NEXT: and a4, a5, a4 +; CHECKRV32ZDINX-NEXT: beqz a4, .LBB14_2 +; CHECKRV32ZDINX-NEXT: # %bb.1: +; CHECKRV32ZDINX-NEXT: mv a0, a2 +; CHECKRV32ZDINX-NEXT: .LBB14_2: +; CHECKRV32ZDINX-NEXT: sw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: sw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: lw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: lw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: addi sp, sp, 16 +; CHECKRV32ZDINX-NEXT: ret +; +; CHECKRV64ZDINX-LABEL: select_fcmp_uno: +; CHECKRV64ZDINX: # %bb.0: +; CHECKRV64ZDINX-NEXT: feq.d a2, a1, a1 +; CHECKRV64ZDINX-NEXT: feq.d a3, a0, a0 +; CHECKRV64ZDINX-NEXT: and a2, a3, a2 +; CHECKRV64ZDINX-NEXT: beqz a2, .LBB14_2 +; CHECKRV64ZDINX-NEXT: # %bb.1: +; CHECKRV64ZDINX-NEXT: mv a0, a1 +; CHECKRV64ZDINX-NEXT: .LBB14_2: +; CHECKRV64ZDINX-NEXT: ret %1 = fcmp uno double %a, %b %2 = select i1 %1, double %a, double %b ret double %2 @@ -222,6 +701,17 @@ ; CHECK-LABEL: select_fcmp_true: ; CHECK: # %bb.0: ; CHECK-NEXT: ret +; +; CHECKRV32ZDINX-LABEL: select_fcmp_true: +; CHECKRV32ZDINX: # %bb.0: +; CHECKRV32ZDINX-NEXT: ret +; +; CHECKRV64ZDINX-LABEL: select_fcmp_true: +; CHECKRV64ZDINX: # %bb.0: +; CHECKRV64ZDINX-NEXT: ret +; CHECKZDINX-LABEL: select_fcmp_true: +; CHECKZDINX: # %bb.0: +; CHECKZDINX-NEXT: ret %1 = fcmp true double %a, %b %2 = select i1 %1, double %a, double %b ret double %2 @@ -237,6 +727,36 @@ ; CHECK-NEXT: mv a0, a1 ; CHECK-NEXT: .LBB16_2: ; CHECK-NEXT: ret +; +; CHECKRV32ZDINX-LABEL: i32_select_fcmp_oeq: +; CHECKRV32ZDINX: # %bb.0: +; CHECKRV32ZDINX-NEXT: addi sp, sp, -16 +; CHECKRV32ZDINX-NEXT: sw a2, 8(sp) +; CHECKRV32ZDINX-NEXT: sw a3, 12(sp) +; CHECKRV32ZDINX-NEXT: lw a2, 8(sp) +; CHECKRV32ZDINX-NEXT: lw a3, 12(sp) +; CHECKRV32ZDINX-NEXT: sw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: sw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: lw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: lw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: feq.d a1, a0, a2 +; CHECKRV32ZDINX-NEXT: mv a0, a4 +; CHECKRV32ZDINX-NEXT: bnez a1, .LBB16_2 +; CHECKRV32ZDINX-NEXT: # %bb.1: +; CHECKRV32ZDINX-NEXT: mv a0, a5 +; CHECKRV32ZDINX-NEXT: .LBB16_2: +; CHECKRV32ZDINX-NEXT: addi sp, sp, 16 +; CHECKRV32ZDINX-NEXT: ret +; +; CHECKRV64ZDINX-LABEL: i32_select_fcmp_oeq: +; CHECKRV64ZDINX: # %bb.0: +; CHECKRV64ZDINX-NEXT: feq.d a1, a0, a1 +; CHECKRV64ZDINX-NEXT: mv a0, a2 +; CHECKRV64ZDINX-NEXT: bnez a1, .LBB16_2 +; CHECKRV64ZDINX-NEXT: # %bb.1: +; CHECKRV64ZDINX-NEXT: mv a0, a3 +; CHECKRV64ZDINX-NEXT: .LBB16_2: +; CHECKRV64ZDINX-NEXT: ret %1 = fcmp oeq double %a, %b %2 = select i1 %1, i32 %c, i32 %d ret i32 %2 @@ -249,6 +769,31 @@ ; CHECK-NEXT: li a1, 2 ; CHECK-NEXT: sub a0, a1, a0 ; CHECK-NEXT: ret +; +; CHECKRV32ZDINX-LABEL: select_fcmp_oeq_1_2: +; CHECKRV32ZDINX: # %bb.0: +; CHECKRV32ZDINX-NEXT: addi sp, sp, -16 +; CHECKRV32ZDINX-NEXT: .cfi_def_cfa_offset 16 +; CHECKRV32ZDINX-NEXT: sw a2, 8(sp) +; CHECKRV32ZDINX-NEXT: sw a3, 12(sp) +; CHECKRV32ZDINX-NEXT: lw a2, 8(sp) +; CHECKRV32ZDINX-NEXT: lw a3, 12(sp) +; CHECKRV32ZDINX-NEXT: sw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: sw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: lw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: lw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: feq.d a0, a0, a2 +; CHECKRV32ZDINX-NEXT: li a1, 2 +; CHECKRV32ZDINX-NEXT: sub a0, a1, a0 +; CHECKRV32ZDINX-NEXT: addi sp, sp, 16 +; CHECKRV32ZDINX-NEXT: ret +; +; CHECKRV64ZDINX-LABEL: select_fcmp_oeq_1_2: +; CHECKRV64ZDINX: # %bb.0: +; CHECKRV64ZDINX-NEXT: feq.d a0, a0, a1 +; CHECKRV64ZDINX-NEXT: li a1, 2 +; CHECKRV64ZDINX-NEXT: sub a0, a1, a0 +; CHECKRV64ZDINX-NEXT: ret %1 = fcmp fast oeq double %a, %b %2 = select i1 %1, i32 1, i32 2 ret i32 %2 @@ -260,6 +805,28 @@ ; CHECK-NEXT: fle.d a0, fa0, fa1 ; CHECK-NEXT: addi a0, a0, -1 ; CHECK-NEXT: ret +; +; CHECKRV32ZDINX-LABEL: select_fcmp_uge_negone_zero: +; CHECKRV32ZDINX: # %bb.0: +; CHECKRV32ZDINX-NEXT: addi sp, sp, -16 +; CHECKRV32ZDINX-NEXT: sw a2, 8(sp) +; CHECKRV32ZDINX-NEXT: sw a3, 12(sp) +; CHECKRV32ZDINX-NEXT: lw a2, 8(sp) +; CHECKRV32ZDINX-NEXT: lw a3, 12(sp) +; CHECKRV32ZDINX-NEXT: sw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: sw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: lw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: lw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: fle.d a0, a0, a2 +; CHECKRV32ZDINX-NEXT: addi a0, a0, -1 +; CHECKRV32ZDINX-NEXT: addi sp, sp, 16 +; CHECKRV32ZDINX-NEXT: ret +; +; CHECKRV64ZDINX-LABEL: select_fcmp_uge_negone_zero: +; CHECKRV64ZDINX: # %bb.0: +; CHECKRV64ZDINX-NEXT: fle.d a0, a0, a1 +; CHECKRV64ZDINX-NEXT: addi a0, a0, -1 +; CHECKRV64ZDINX-NEXT: ret %1 = fcmp ugt double %a, %b %2 = select i1 %1, i32 -1, i32 0 ret i32 %2 @@ -271,6 +838,28 @@ ; CHECK-NEXT: fle.d a0, fa0, fa1 ; CHECK-NEXT: addi a0, a0, 1 ; CHECK-NEXT: ret +; +; CHECKRV32ZDINX-LABEL: select_fcmp_uge_1_2: +; CHECKRV32ZDINX: # %bb.0: +; CHECKRV32ZDINX-NEXT: addi sp, sp, -16 +; CHECKRV32ZDINX-NEXT: sw a2, 8(sp) +; CHECKRV32ZDINX-NEXT: sw a3, 12(sp) +; CHECKRV32ZDINX-NEXT: lw a2, 8(sp) +; CHECKRV32ZDINX-NEXT: lw a3, 12(sp) +; CHECKRV32ZDINX-NEXT: sw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: sw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: lw a0, 8(sp) +; CHECKRV32ZDINX-NEXT: lw a1, 12(sp) +; CHECKRV32ZDINX-NEXT: fle.d a0, a0, a2 +; CHECKRV32ZDINX-NEXT: addi a0, a0, 1 +; CHECKRV32ZDINX-NEXT: addi sp, sp, 16 +; CHECKRV32ZDINX-NEXT: ret +; +; CHECKRV64ZDINX-LABEL: select_fcmp_uge_1_2: +; CHECKRV64ZDINX: # %bb.0: +; CHECKRV64ZDINX-NEXT: fle.d a0, a0, a1 +; CHECKRV64ZDINX-NEXT: addi a0, a0, 1 +; CHECKRV64ZDINX-NEXT: ret %1 = fcmp ugt double %a, %b %2 = select i1 %1, i32 1, i32 2 ret i32 %2 diff --git a/llvm/test/CodeGen/RISCV/double-stack-spill-restore.ll b/llvm/test/CodeGen/RISCV/double-stack-spill-restore.ll --- a/llvm/test/CodeGen/RISCV/double-stack-spill-restore.ll +++ b/llvm/test/CodeGen/RISCV/double-stack-spill-restore.ll @@ -3,6 +3,10 @@ ; RUN: | FileCheck -check-prefix=RV32IFD %s ; RUN: llc -mtriple=riscv64 -mattr=+d -target-abi=lp64 -verify-machineinstrs < %s \ ; RUN: | FileCheck -check-prefix=RV64IFD %s +; RUN: llc -mtriple=riscv32 -mattr=+zdinx -target-abi=ilp32 -verify-machineinstrs < %s \ +; RUN: | FileCheck -check-prefix=RV32IZFINXZDINX %s +; RUN: llc -mtriple=riscv64 -mattr=+zdinx -target-abi=lp64 -verify-machineinstrs < %s \ +; RUN: | FileCheck -check-prefix=RV64IZFINXZDINX %s define double @func(double %d, i32 %n) nounwind { ; RV32IFD-LABEL: func: @@ -52,9 +56,62 @@ ; RV64IFD-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64IFD-NEXT: addi sp, sp, 16 ; RV64IFD-NEXT: ret -; RV64IFD-NEXT: .LBB0_2: # %return -; RV64IFD-NEXT: fmv.x.d a0, ft0 -; RV64IFD-NEXT: ret +; +; RV32IZFINXZDINX-LABEL: func: +; RV32IZFINXZDINX: # %bb.0: # %entry +; RV32IZFINXZDINX-NEXT: addi sp, sp, -32 +; RV32IZFINXZDINX-NEXT: sw ra, 28(sp) # 4-byte Folded Spill +; RV32IZFINXZDINX-NEXT: sw a0, 16(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 20(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 16(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 20(sp) +; RV32IZFINXZDINX-NEXT: beqz a2, .LBB0_2 +; RV32IZFINXZDINX-NEXT: # %bb.1: # %if.else +; RV32IZFINXZDINX-NEXT: addi a2, a2, -1 +; RV32IZFINXZDINX-NEXT: sw a0, 16(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 20(sp) +; RV32IZFINXZDINX-NEXT: sw a0, 8(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 12(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 16(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 20(sp) +; RV32IZFINXZDINX-NEXT: call func@plt +; RV32IZFINXZDINX-NEXT: sw a0, 16(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 20(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 16(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 20(sp) +; RV32IZFINXZDINX-NEXT: lw a2, 8(sp) +; RV32IZFINXZDINX-NEXT: lw a3, 12(sp) +; RV32IZFINXZDINX-NEXT: fadd.d a0, a0, a2 +; RV32IZFINXZDINX-NEXT: .LBB0_2: # %return +; RV32IZFINXZDINX-NEXT: sw a0, 16(sp) +; RV32IZFINXZDINX-NEXT: sw a1, 20(sp) +; RV32IZFINXZDINX-NEXT: lw a0, 16(sp) +; RV32IZFINXZDINX-NEXT: lw a1, 20(sp) +; RV32IZFINXZDINX-NEXT: lw ra, 28(sp) # 4-byte Folded Reload +; RV32IZFINXZDINX-NEXT: addi sp, sp, 32 +; RV32IZFINXZDINX-NEXT: ret +; +; RV64IZFINXZDINX-LABEL: func: +; RV64IZFINXZDINX: # %bb.0: # %entry +; RV64IZFINXZDINX-NEXT: addi sp, sp, -16 +; RV64IZFINXZDINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: sd s0, 0(sp) # 8-byte Folded Spill +; RV64IZFINXZDINX-NEXT: sext.w a2, a1 +; RV64IZFINXZDINX-NEXT: mv s0, a0 +; RV64IZFINXZDINX-NEXT: beqz a2, .LBB0_2 +; RV64IZFINXZDINX-NEXT: # %bb.1: # %if.else +; RV64IZFINXZDINX-NEXT: addiw a1, a1, -1 +; RV64IZFINXZDINX-NEXT: mv a0, s0 +; RV64IZFINXZDINX-NEXT: call func@plt +; RV64IZFINXZDINX-NEXT: fadd.d a0, a0, s0 +; RV64IZFINXZDINX-NEXT: j .LBB0_3 +; RV64IZFINXZDINX-NEXT: .LBB0_2: # %return +; RV64IZFINXZDINX-NEXT: mv a0, s0 +; RV64IZFINXZDINX-NEXT: .LBB0_3: # %return +; RV64IZFINXZDINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINXZDINX-NEXT: ld s0, 0(sp) # 8-byte Folded Reload +; RV64IZFINXZDINX-NEXT: addi sp, sp, 16 +; RV64IZFINXZDINX-NEXT: ret entry: %cmp = icmp eq i32 %n, 0 br i1 %cmp, label %return, label %if.else diff --git a/llvm/test/CodeGen/RISCV/float-arith-strict.ll b/llvm/test/CodeGen/RISCV/float-arith-strict.ll --- a/llvm/test/CodeGen/RISCV/float-arith-strict.ll +++ b/llvm/test/CodeGen/RISCV/float-arith-strict.ll @@ -5,6 +5,12 @@ ; RUN: llc -mtriple=riscv64 -mattr=+f -verify-machineinstrs < %s \ ; RUN: -disable-strictnode-mutation -target-abi=lp64f \ ; RUN: | FileCheck -check-prefixes=CHECKIF,RV64IF %s +; RUN: llc -mtriple=riscv32 -mattr=+zfinx -verify-machineinstrs < %s \ +; RUN: -disable-strictnode-mutation -target-abi=ilp32 \ +; RUN: | FileCheck -check-prefixes=CHECKIZFINX,RV32IZFINX %s +; RUN: llc -mtriple=riscv64 -mattr=+zfinx -verify-machineinstrs < %s \ +; RUN: -disable-strictnode-mutation -target-abi=lp64 \ +; RUN: | FileCheck -check-prefixes=CHECKIZFINX,RV64IZFINX %s ; RUN: llc -mtriple=riscv32 -verify-machineinstrs < %s \ ; RUN: -disable-strictnode-mutation | FileCheck -check-prefix=RV32I %s ; RUN: llc -mtriple=riscv64 -verify-machineinstrs < %s \ @@ -16,6 +22,11 @@ ; CHECKIF-NEXT: fadd.s fa0, fa0, fa1 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fadd_s: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fadd.s a0, a0, a1 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fadd_s: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -44,6 +55,11 @@ ; CHECKIF-NEXT: fsub.s fa0, fa0, fa1 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fsub_s: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fsub.s a0, a0, a1 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fsub_s: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -72,6 +88,11 @@ ; CHECKIF-NEXT: fmul.s fa0, fa0, fa1 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fmul_s: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fmul.s a0, a0, a1 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fmul_s: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -100,6 +121,11 @@ ; CHECKIF-NEXT: fdiv.s fa0, fa0, fa1 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fdiv_s: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fdiv.s a0, a0, a1 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fdiv_s: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -128,6 +154,11 @@ ; CHECKIF-NEXT: fsqrt.s fa0, fa0 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fsqrt_s: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fsqrt.s a0, a0 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fsqrt_s: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -169,6 +200,24 @@ ; RV64IF-NEXT: addi sp, sp, 16 ; RV64IF-NEXT: ret ; +; RV32IZFINX-LABEL: fmin_s: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call fminf@plt +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: fmin_s: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: addi sp, sp, -16 +; RV64IZFINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: call fminf@plt +; RV64IZFINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINX-NEXT: addi sp, sp, 16 +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: fmin_s: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -210,6 +259,24 @@ ; RV64IF-NEXT: addi sp, sp, 16 ; RV64IF-NEXT: ret ; +; RV32IZFINX-LABEL: fmax_s: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call fmaxf@plt +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: fmax_s: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: addi sp, sp, -16 +; RV64IZFINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: call fmaxf@plt +; RV64IZFINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINX-NEXT: addi sp, sp, 16 +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: fmax_s: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -238,6 +305,11 @@ ; CHECKIF-NEXT: fmadd.s fa0, fa0, fa1, fa2 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fmadd_s: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fmadd.s a0, a0, a1, a2 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fmadd_s: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -268,6 +340,12 @@ ; CHECKIF-NEXT: fmsub.s fa0, fa0, fa1, ft0 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fmsub_s: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fadd.s a2, a2, zero +; CHECKIZFINX-NEXT: fmsub.s a0, a0, a1, a2 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fmsub_s: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -326,6 +404,13 @@ ; CHECKIF-NEXT: fnmadd.s fa0, ft1, fa1, ft0 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fnmadd_s: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fadd.s a0, a0, zero +; CHECKIZFINX-NEXT: fadd.s a2, a2, zero +; CHECKIZFINX-NEXT: fnmadd.s a0, a0, a1, a2 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fnmadd_s: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -398,6 +483,13 @@ ; CHECKIF-NEXT: fnmadd.s fa0, ft1, fa0, ft0 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fnmadd_s_2: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fadd.s a1, a1, zero +; CHECKIZFINX-NEXT: fadd.s a2, a2, zero +; CHECKIZFINX-NEXT: fnmadd.s a0, a1, a0, a2 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fnmadd_s_2: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -469,6 +561,12 @@ ; CHECKIF-NEXT: fnmsub.s fa0, ft0, fa1, fa2 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fnmsub_s: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fadd.s a0, a0, zero +; CHECKIZFINX-NEXT: fnmsub.s a0, a0, a1, a2 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fnmsub_s: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -524,6 +622,12 @@ ; CHECKIF-NEXT: fnmsub.s fa0, ft0, fa0, fa2 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fnmsub_s_2: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fadd.s a1, a1, zero +; CHECKIZFINX-NEXT: fnmsub.s a0, a1, a0, a2 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fnmsub_s_2: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 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 @@ -3,6 +3,10 @@ ; RUN: -target-abi=ilp32f | FileCheck -check-prefix=CHECKIF %s ; RUN: llc -mtriple=riscv64 -mattr=+f -verify-machineinstrs < %s \ ; RUN: -target-abi=lp64f | FileCheck -check-prefix=CHECKIF %s +; RUN: llc -mtriple=riscv32 -mattr=+zfinx -verify-machineinstrs < %s \ +; RUN: -target-abi=ilp32 | FileCheck -check-prefix=CHECKIZFINX %s +; RUN: llc -mtriple=riscv64 -mattr=+zfinx -verify-machineinstrs < %s \ +; RUN: -target-abi=lp64 | FileCheck -check-prefix=CHECKIZFINX %s ; RUN: llc -mtriple=riscv32 -verify-machineinstrs < %s \ ; RUN: | FileCheck -check-prefix=RV32I %s ; RUN: llc -mtriple=riscv64 -verify-machineinstrs < %s \ @@ -19,6 +23,11 @@ ; CHECKIF-NEXT: fadd.s fa0, fa0, fa1 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fadd_s: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fadd.s a0, a0, a1 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fadd_s: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -46,6 +55,11 @@ ; CHECKIF-NEXT: fsub.s fa0, fa0, fa1 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fsub_s: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fsub.s a0, a0, a1 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fsub_s: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -73,6 +87,11 @@ ; CHECKIF-NEXT: fmul.s fa0, fa0, fa1 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fmul_s: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fmul.s a0, a0, a1 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fmul_s: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -100,6 +119,11 @@ ; CHECKIF-NEXT: fdiv.s fa0, fa0, fa1 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fdiv_s: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fdiv.s a0, a0, a1 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fdiv_s: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -129,6 +153,11 @@ ; CHECKIF-NEXT: fsqrt.s fa0, fa0 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fsqrt_s: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fsqrt.s a0, a0 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fsqrt_s: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -158,6 +187,11 @@ ; CHECKIF-NEXT: fsgnj.s fa0, fa0, fa1 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fsgnj_s: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fsgnj.s a0, a0, a1 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fsgnj_s: ; RV32I: # %bb.0: ; RV32I-NEXT: lui a2, 524288 @@ -187,6 +221,13 @@ ; CHECKIF-NEXT: feq.s a0, ft0, ft1 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fneg_s: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fadd.s a0, a0, a0 +; CHECKIZFINX-NEXT: fneg.s a1, a0 +; CHECKIZFINX-NEXT: feq.s a0, a0, a1 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fneg_s: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -228,6 +269,12 @@ ; CHECKIF-NEXT: fsgnjn.s fa0, fa0, ft0 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fsgnjn_s: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fadd.s a1, a0, a1 +; CHECKIZFINX-NEXT: fsgnjn.s a0, a0, a1 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fsgnjn_s: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -279,6 +326,13 @@ ; CHECKIF-NEXT: fadd.s fa0, ft1, ft0 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fabs_s: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fadd.s a0, a0, a1 +; CHECKIZFINX-NEXT: fabs.s a1, a0 +; CHECKIZFINX-NEXT: fadd.s a0, a1, a0 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fabs_s: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -318,6 +372,11 @@ ; CHECKIF-NEXT: fmin.s fa0, fa0, fa1 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fmin_s: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fmin.s a0, a0, a1 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fmin_s: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -347,6 +406,11 @@ ; CHECKIF-NEXT: fmax.s fa0, fa0, fa1 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fmax_s: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fmax.s a0, a0, a1 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fmax_s: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -376,6 +440,11 @@ ; CHECKIF-NEXT: fmadd.s fa0, fa0, fa1, fa2 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fmadd_s: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fmadd.s a0, a0, a1, a2 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fmadd_s: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -405,6 +474,12 @@ ; CHECKIF-NEXT: fmsub.s fa0, fa0, fa1, ft0 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fmsub_s: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fadd.s a2, a2, zero +; CHECKIZFINX-NEXT: fmsub.s a0, a0, a1, a2 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fmsub_s: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -463,6 +538,13 @@ ; CHECKIF-NEXT: fnmadd.s fa0, ft1, fa1, ft0 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fnmadd_s: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fadd.s a0, a0, zero +; CHECKIZFINX-NEXT: fadd.s a2, a2, zero +; CHECKIZFINX-NEXT: fnmadd.s a0, a0, a1, a2 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fnmadd_s: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -535,6 +617,13 @@ ; CHECKIF-NEXT: fnmadd.s fa0, ft1, fa0, ft0 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fnmadd_s_2: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fadd.s a1, a1, zero +; CHECKIZFINX-NEXT: fadd.s a2, a2, zero +; CHECKIZFINX-NEXT: fnmadd.s a0, a1, a0, a2 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fnmadd_s_2: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -617,6 +706,13 @@ ; CHECKIF-NEXT: fneg.s fa0, ft0 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fnmadd_s_3: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fmadd.s a0, a0, a1, a2 +; CHECKIZFINX-NEXT: lui a1, 524288 +; CHECKIZFINX-NEXT: xor a0, a0, a1 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fnmadd_s_3: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -659,6 +755,13 @@ ; CHECKIF-NEXT: fnmadd.s fa0, fa0, fa1, fa2 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fnmadd_nsz: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fmadd.s a0, a0, a1, a2 +; CHECKIZFINX-NEXT: lui a1, 524288 +; CHECKIZFINX-NEXT: xor a0, a0, a1 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fnmadd_nsz: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -693,6 +796,12 @@ ; CHECKIF-NEXT: fnmsub.s fa0, ft0, fa1, fa2 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fnmsub_s: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fadd.s a0, a0, zero +; CHECKIZFINX-NEXT: fnmsub.s a0, a0, a1, a2 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fnmsub_s: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -748,6 +857,12 @@ ; CHECKIF-NEXT: fnmsub.s fa0, ft0, fa0, fa2 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fnmsub_s_2: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fadd.s a1, a1, zero +; CHECKIZFINX-NEXT: fnmsub.s a0, a1, a0, a2 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fnmsub_s_2: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -803,6 +918,11 @@ ; CHECKIF-NEXT: fmadd.s fa0, fa0, fa1, fa2 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fmadd_s_contract: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fmadd.s a0, a0, a1, a2 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fmadd_s_contract: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -843,6 +963,12 @@ ; CHECKIF-NEXT: fmsub.s fa0, fa0, fa1, ft0 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fmsub_s_contract: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fadd.s a2, a2, zero +; CHECKIZFINX-NEXT: fmsub.s a0, a0, a1, a2 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fmsub_s_contract: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -908,6 +1034,14 @@ ; CHECKIF-NEXT: fnmadd.s fa0, ft1, ft2, ft0 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fnmadd_s_contract: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fadd.s a0, a0, zero +; CHECKIZFINX-NEXT: fadd.s a1, a1, zero +; CHECKIZFINX-NEXT: fadd.s a2, a2, zero +; CHECKIZFINX-NEXT: fnmadd.s a0, a0, a1, a2 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fnmadd_s_contract: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -993,6 +1127,13 @@ ; CHECKIF-NEXT: fnmsub.s fa0, ft1, ft0, fa2 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fnmsub_s_contract: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fadd.s a0, a0, zero +; CHECKIZFINX-NEXT: fadd.s a1, a1, zero +; CHECKIZFINX-NEXT: fnmsub.s a0, a0, a1, a2 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fnmsub_s_contract: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 diff --git a/llvm/test/CodeGen/RISCV/float-bit-preserving-dagcombines.ll b/llvm/test/CodeGen/RISCV/float-bit-preserving-dagcombines.ll --- a/llvm/test/CodeGen/RISCV/float-bit-preserving-dagcombines.ll +++ b/llvm/test/CodeGen/RISCV/float-bit-preserving-dagcombines.ll @@ -1,10 +1,14 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py ; RUN: llc -mtriple=riscv32 -mattr=+f -target-abi=ilp32 -verify-machineinstrs < %s \ ; RUN: | FileCheck -check-prefix=RV32F %s +; RUN: llc -mtriple=riscv32 -mattr=+zfinx -target-abi=ilp32 -verify-machineinstrs < %s \ +; RUN: | FileCheck -check-prefix=RV32ZFINX %s ; RUN: llc -mtriple=riscv32 -mattr=+f,+d -target-abi=ilp32 -verify-machineinstrs < %s \ ; RUN: | FileCheck -check-prefix=RV32FD %s ; RUN: llc -mtriple=riscv64 -mattr=+f -target-abi=lp64 -verify-machineinstrs < %s \ ; RUN: | FileCheck -check-prefix=RV64F %s +; RUN: llc -mtriple=riscv64 -mattr=+zfinx -target-abi=lp64 -verify-machineinstrs < %s \ +; RUN: | FileCheck -check-prefix=RV64ZFINX %s ; RUN: llc -mtriple=riscv64 -mattr=+f,+d -target-abi=lp64 -verify-machineinstrs < %s \ ; RUN: | FileCheck -check-prefix=RV64FD %s @@ -25,6 +29,13 @@ ; RV32F-NEXT: fmv.x.w a0, ft0 ; RV32F-NEXT: ret ; +; RV32ZFINX-LABEL: bitcast_and: +; RV32ZFINX: # %bb.0: +; RV32ZFINX-NEXT: fadd.s a1, a0, a1 +; RV32ZFINX-NEXT: fabs.s a1, a1 +; RV32ZFINX-NEXT: fadd.s a0, a0, a1 +; RV32ZFINX-NEXT: ret +; ; RV32FD-LABEL: bitcast_and: ; RV32FD: # %bb.0: ; RV32FD-NEXT: fmv.w.x ft0, a1 @@ -45,6 +56,13 @@ ; RV64F-NEXT: fmv.x.w a0, ft0 ; RV64F-NEXT: ret ; +; RV64ZFINX-LABEL: bitcast_and: +; RV64ZFINX: # %bb.0: +; RV64ZFINX-NEXT: fadd.s a1, a0, a1 +; RV64ZFINX-NEXT: fabs.s a1, a1 +; RV64ZFINX-NEXT: fadd.s a0, a0, a1 +; RV64ZFINX-NEXT: ret +; ; RV64FD-LABEL: bitcast_and: ; RV64FD: # %bb.0: ; RV64FD-NEXT: fmv.w.x ft0, a1 @@ -84,6 +102,27 @@ ; RV32F-NEXT: addi sp, sp, 16 ; RV32F-NEXT: ret ; +; RV32ZFINX-LABEL: bitcast_double_and: +; RV32ZFINX: # %bb.0: +; RV32ZFINX-NEXT: addi sp, sp, -16 +; RV32ZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32ZFINX-NEXT: sw s0, 8(sp) # 4-byte Folded Spill +; RV32ZFINX-NEXT: sw s1, 4(sp) # 4-byte Folded Spill +; RV32ZFINX-NEXT: mv s0, a1 +; RV32ZFINX-NEXT: mv s1, a0 +; RV32ZFINX-NEXT: call __adddf3@plt +; RV32ZFINX-NEXT: mv a2, a0 +; RV32ZFINX-NEXT: slli a0, a1, 1 +; RV32ZFINX-NEXT: srli a3, a0, 1 +; RV32ZFINX-NEXT: mv a0, s1 +; RV32ZFINX-NEXT: mv a1, s0 +; RV32ZFINX-NEXT: call __adddf3@plt +; RV32ZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32ZFINX-NEXT: lw s0, 8(sp) # 4-byte Folded Reload +; RV32ZFINX-NEXT: lw s1, 4(sp) # 4-byte Folded Reload +; RV32ZFINX-NEXT: addi sp, sp, 16 +; RV32ZFINX-NEXT: ret +; ; RV32FD-LABEL: bitcast_double_and: ; RV32FD: # %bb.0: ; RV32FD-NEXT: addi sp, sp, -16 @@ -118,6 +157,22 @@ ; RV64F-NEXT: addi sp, sp, 16 ; RV64F-NEXT: ret ; +; RV64ZFINX-LABEL: bitcast_double_and: +; RV64ZFINX: # %bb.0: +; RV64ZFINX-NEXT: addi sp, sp, -16 +; RV64ZFINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64ZFINX-NEXT: sd s0, 0(sp) # 8-byte Folded Spill +; RV64ZFINX-NEXT: mv s0, a0 +; RV64ZFINX-NEXT: call __adddf3@plt +; RV64ZFINX-NEXT: slli a0, a0, 1 +; RV64ZFINX-NEXT: srli a1, a0, 1 +; RV64ZFINX-NEXT: mv a0, s0 +; RV64ZFINX-NEXT: call __adddf3@plt +; RV64ZFINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64ZFINX-NEXT: ld s0, 0(sp) # 8-byte Folded Reload +; RV64ZFINX-NEXT: addi sp, sp, 16 +; RV64ZFINX-NEXT: ret +; ; RV64FD-LABEL: bitcast_double_and: ; RV64FD: # %bb.0: ; RV64FD-NEXT: fmv.d.x ft0, a1 @@ -147,6 +202,13 @@ ; RV32F-NEXT: fmv.x.w a0, ft0 ; RV32F-NEXT: ret ; +; RV32ZFINX-LABEL: bitcast_xor: +; RV32ZFINX: # %bb.0: +; RV32ZFINX-NEXT: fmul.s a1, a0, a1 +; RV32ZFINX-NEXT: fneg.s a1, a1 +; RV32ZFINX-NEXT: fmul.s a0, a0, a1 +; RV32ZFINX-NEXT: ret +; ; RV32FD-LABEL: bitcast_xor: ; RV32FD: # %bb.0: ; RV32FD-NEXT: fmv.w.x ft0, a1 @@ -167,6 +229,13 @@ ; RV64F-NEXT: fmv.x.w a0, ft0 ; RV64F-NEXT: ret ; +; RV64ZFINX-LABEL: bitcast_xor: +; RV64ZFINX: # %bb.0: +; RV64ZFINX-NEXT: fmul.s a1, a0, a1 +; RV64ZFINX-NEXT: fneg.s a1, a1 +; RV64ZFINX-NEXT: fmul.s a0, a0, a1 +; RV64ZFINX-NEXT: ret +; ; RV64FD-LABEL: bitcast_xor: ; RV64FD: # %bb.0: ; RV64FD-NEXT: fmv.w.x ft0, a1 @@ -206,6 +275,27 @@ ; RV32F-NEXT: addi sp, sp, 16 ; RV32F-NEXT: ret ; +; RV32ZFINX-LABEL: bitcast_double_xor: +; RV32ZFINX: # %bb.0: +; RV32ZFINX-NEXT: addi sp, sp, -16 +; RV32ZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32ZFINX-NEXT: sw s0, 8(sp) # 4-byte Folded Spill +; RV32ZFINX-NEXT: sw s1, 4(sp) # 4-byte Folded Spill +; RV32ZFINX-NEXT: mv s0, a1 +; RV32ZFINX-NEXT: mv s1, a0 +; RV32ZFINX-NEXT: call __muldf3@plt +; RV32ZFINX-NEXT: mv a2, a0 +; RV32ZFINX-NEXT: lui a0, 524288 +; RV32ZFINX-NEXT: xor a3, a1, a0 +; RV32ZFINX-NEXT: mv a0, s1 +; RV32ZFINX-NEXT: mv a1, s0 +; RV32ZFINX-NEXT: call __muldf3@plt +; RV32ZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32ZFINX-NEXT: lw s0, 8(sp) # 4-byte Folded Reload +; RV32ZFINX-NEXT: lw s1, 4(sp) # 4-byte Folded Reload +; RV32ZFINX-NEXT: addi sp, sp, 16 +; RV32ZFINX-NEXT: ret +; ; RV32FD-LABEL: bitcast_double_xor: ; RV32FD: # %bb.0: ; RV32FD-NEXT: addi sp, sp, -16 @@ -241,6 +331,23 @@ ; RV64F-NEXT: addi sp, sp, 16 ; RV64F-NEXT: ret ; +; RV64ZFINX-LABEL: bitcast_double_xor: +; RV64ZFINX: # %bb.0: +; RV64ZFINX-NEXT: addi sp, sp, -16 +; RV64ZFINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64ZFINX-NEXT: sd s0, 0(sp) # 8-byte Folded Spill +; RV64ZFINX-NEXT: mv s0, a0 +; RV64ZFINX-NEXT: call __muldf3@plt +; RV64ZFINX-NEXT: li a1, -1 +; RV64ZFINX-NEXT: slli a1, a1, 63 +; RV64ZFINX-NEXT: xor a1, a0, a1 +; RV64ZFINX-NEXT: mv a0, s0 +; RV64ZFINX-NEXT: call __muldf3@plt +; RV64ZFINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64ZFINX-NEXT: ld s0, 0(sp) # 8-byte Folded Reload +; RV64ZFINX-NEXT: addi sp, sp, 16 +; RV64ZFINX-NEXT: ret +; ; RV64FD-LABEL: bitcast_double_xor: ; RV64FD: # %bb.0: ; RV64FD-NEXT: fmv.d.x ft0, a1 @@ -270,6 +377,14 @@ ; RV32F-NEXT: fmv.x.w a0, ft0 ; RV32F-NEXT: ret ; +; RV32ZFINX-LABEL: bitcast_or: +; RV32ZFINX: # %bb.0: +; RV32ZFINX-NEXT: fmul.s a1, a0, a1 +; RV32ZFINX-NEXT: fabs.s a1, a1 +; RV32ZFINX-NEXT: fneg.s a1, a1 +; RV32ZFINX-NEXT: fmul.s a0, a0, a1 +; RV32ZFINX-NEXT: ret +; ; RV32FD-LABEL: bitcast_or: ; RV32FD: # %bb.0: ; RV32FD-NEXT: fmv.w.x ft0, a1 @@ -292,6 +407,14 @@ ; RV64F-NEXT: fmv.x.w a0, ft0 ; RV64F-NEXT: ret ; +; RV64ZFINX-LABEL: bitcast_or: +; RV64ZFINX: # %bb.0: +; RV64ZFINX-NEXT: fmul.s a1, a0, a1 +; RV64ZFINX-NEXT: fabs.s a1, a1 +; RV64ZFINX-NEXT: fneg.s a1, a1 +; RV64ZFINX-NEXT: fmul.s a0, a0, a1 +; RV64ZFINX-NEXT: ret +; ; RV64FD-LABEL: bitcast_or: ; RV64FD: # %bb.0: ; RV64FD-NEXT: fmv.w.x ft0, a1 @@ -332,6 +455,27 @@ ; RV32F-NEXT: addi sp, sp, 16 ; RV32F-NEXT: ret ; +; RV32ZFINX-LABEL: bitcast_double_or: +; RV32ZFINX: # %bb.0: +; RV32ZFINX-NEXT: addi sp, sp, -16 +; RV32ZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32ZFINX-NEXT: sw s0, 8(sp) # 4-byte Folded Spill +; RV32ZFINX-NEXT: sw s1, 4(sp) # 4-byte Folded Spill +; RV32ZFINX-NEXT: mv s0, a1 +; RV32ZFINX-NEXT: mv s1, a0 +; RV32ZFINX-NEXT: call __muldf3@plt +; RV32ZFINX-NEXT: mv a2, a0 +; RV32ZFINX-NEXT: lui a0, 524288 +; RV32ZFINX-NEXT: or a3, a1, a0 +; RV32ZFINX-NEXT: mv a0, s1 +; RV32ZFINX-NEXT: mv a1, s0 +; RV32ZFINX-NEXT: call __muldf3@plt +; RV32ZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32ZFINX-NEXT: lw s0, 8(sp) # 4-byte Folded Reload +; RV32ZFINX-NEXT: lw s1, 4(sp) # 4-byte Folded Reload +; RV32ZFINX-NEXT: addi sp, sp, 16 +; RV32ZFINX-NEXT: ret +; ; RV32FD-LABEL: bitcast_double_or: ; RV32FD: # %bb.0: ; RV32FD-NEXT: addi sp, sp, -16 @@ -368,6 +512,23 @@ ; RV64F-NEXT: addi sp, sp, 16 ; RV64F-NEXT: ret ; +; RV64ZFINX-LABEL: bitcast_double_or: +; RV64ZFINX: # %bb.0: +; RV64ZFINX-NEXT: addi sp, sp, -16 +; RV64ZFINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64ZFINX-NEXT: sd s0, 0(sp) # 8-byte Folded Spill +; RV64ZFINX-NEXT: mv s0, a0 +; RV64ZFINX-NEXT: call __muldf3@plt +; RV64ZFINX-NEXT: li a1, -1 +; RV64ZFINX-NEXT: slli a1, a1, 63 +; RV64ZFINX-NEXT: or a1, a0, a1 +; RV64ZFINX-NEXT: mv a0, s0 +; RV64ZFINX-NEXT: call __muldf3@plt +; RV64ZFINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64ZFINX-NEXT: ld s0, 0(sp) # 8-byte Folded Reload +; RV64ZFINX-NEXT: addi sp, sp, 16 +; RV64ZFINX-NEXT: ret +; ; RV64FD-LABEL: bitcast_double_or: ; RV64FD: # %bb.0: ; RV64FD-NEXT: fmv.d.x ft0, a1 diff --git a/llvm/test/CodeGen/RISCV/float-bitmanip-dagcombines.ll b/llvm/test/CodeGen/RISCV/float-bitmanip-dagcombines.ll --- a/llvm/test/CodeGen/RISCV/float-bitmanip-dagcombines.ll +++ b/llvm/test/CodeGen/RISCV/float-bitmanip-dagcombines.ll @@ -3,10 +3,14 @@ ; RUN: | FileCheck -check-prefix=RV32I %s ; RUN: llc -mtriple=riscv32 -mattr=+f -verify-machineinstrs < %s \ ; RUN: | FileCheck -check-prefix=RV32IF %s +; RUN: llc -mtriple=riscv32 -mattr=+zfinx -verify-machineinstrs < %s \ +; RUN: | FileCheck -check-prefix=RV32IZFINX %s ; RUN: llc -mtriple=riscv64 -verify-machineinstrs < %s \ ; RUN: | FileCheck -check-prefix=RV64I %s ; RUN: llc -mtriple=riscv64 -mattr=+f -verify-machineinstrs < %s \ ; RUN: | FileCheck -check-prefix=RV64IF %s +; RUN: llc -mtriple=riscv64 -mattr=+zfinx -verify-machineinstrs < %s \ +; RUN: | FileCheck -check-prefix=RV64IZFINX %s ; This file tests cases where simple floating point operations can be ; profitably handled though bit manipulation if a soft-float ABI is being used @@ -27,6 +31,12 @@ ; RV32IF-NEXT: xor a0, a0, a1 ; RV32IF-NEXT: ret ; +; RV32IZFINX-LABEL: fneg: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: lui a1, 524288 +; RV32IZFINX-NEXT: xor a0, a0, a1 +; RV32IZFINX-NEXT: ret +; ; RV64I-LABEL: fneg: ; RV64I: # %bb.0: ; RV64I-NEXT: lui a1, 524288 @@ -38,6 +48,12 @@ ; RV64IF-NEXT: lui a1, 524288 ; RV64IF-NEXT: xor a0, a0, a1 ; RV64IF-NEXT: ret +; +; RV64IZFINX-LABEL: fneg: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: lui a1, 524288 +; RV64IZFINX-NEXT: xor a0, a0, a1 +; RV64IZFINX-NEXT: ret %1 = fneg float %a ret float %1 } @@ -57,6 +73,12 @@ ; RV32IF-NEXT: srli a0, a0, 1 ; RV32IF-NEXT: ret ; +; RV32IZFINX-LABEL: fabs: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: slli a0, a0, 1 +; RV32IZFINX-NEXT: srli a0, a0, 1 +; RV32IZFINX-NEXT: ret +; ; RV64I-LABEL: fabs: ; RV64I: # %bb.0: ; RV64I-NEXT: slli a0, a0, 33 @@ -68,6 +90,12 @@ ; RV64IF-NEXT: slli a0, a0, 33 ; RV64IF-NEXT: srli a0, a0, 33 ; RV64IF-NEXT: ret +; +; RV64IZFINX-LABEL: fabs: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: slli a0, a0, 33 +; RV64IZFINX-NEXT: srli a0, a0, 33 +; RV64IZFINX-NEXT: ret %1 = call float @llvm.fabs.f32(float %a) ret float %1 } @@ -99,6 +127,13 @@ ; RV32IF-NEXT: fmv.x.w a0, ft0 ; RV32IF-NEXT: ret ; +; RV32IZFINX-LABEL: fcopysign_fneg: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: lui a2, 524288 +; RV32IZFINX-NEXT: xor a1, a1, a2 +; RV32IZFINX-NEXT: fsgnj.s a0, a0, a1 +; RV32IZFINX-NEXT: ret +; ; RV64I-LABEL: fcopysign_fneg: ; RV64I: # %bb.0: ; RV64I-NEXT: not a1, a1 @@ -116,6 +151,11 @@ ; RV64IF-NEXT: fsgnjn.s ft0, ft1, ft0 ; RV64IF-NEXT: fmv.x.w a0, ft0 ; RV64IF-NEXT: ret +; +; RV64IZFINX-LABEL: fcopysign_fneg: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fsgnjn.s a0, a0, a1 +; RV64IZFINX-NEXT: ret %1 = fneg float %b %2 = call float @llvm.copysign.f32(float %a, float %1) ret float %2 diff --git a/llvm/test/CodeGen/RISCV/float-br-fcmp.ll b/llvm/test/CodeGen/RISCV/float-br-fcmp.ll --- a/llvm/test/CodeGen/RISCV/float-br-fcmp.ll +++ b/llvm/test/CodeGen/RISCV/float-br-fcmp.ll @@ -3,6 +3,10 @@ ; RUN: -target-abi=ilp32f | FileCheck -check-prefix=RV32IF %s ; RUN: llc -mtriple=riscv64 -mattr=+f -verify-machineinstrs < %s \ ; RUN: -target-abi=lp64f | FileCheck -check-prefix=RV64IF %s +; RUN: llc -mtriple=riscv32 -mattr=+zfinx -verify-machineinstrs < %s \ +; RUN: -target-abi=ilp32 | FileCheck -check-prefix=RV32IZFINX %s +; RUN: llc -mtriple=riscv64 -mattr=+zfinx -verify-machineinstrs < %s \ +; RUN: -target-abi=lp64 | FileCheck -check-prefix=RV64IZFINX %s declare void @abort() declare void @exit(i32) @@ -30,6 +34,28 @@ ; RV64IF-NEXT: addi sp, sp, -16 ; RV64IF-NEXT: sd ra, 8(sp) # 8-byte Folded Spill ; RV64IF-NEXT: call abort@plt +; +; RV32IZFINX-LABEL: br_fcmp_false: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: li a0, 1 +; RV32IZFINX-NEXT: bnez a0, .LBB0_2 +; RV32IZFINX-NEXT: # %bb.1: # %if.then +; RV32IZFINX-NEXT: ret +; RV32IZFINX-NEXT: .LBB0_2: # %if.else +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call abort@plt +; +; RV64IZFINX-LABEL: br_fcmp_false: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: li a0, 1 +; RV64IZFINX-NEXT: bnez a0, .LBB0_2 +; RV64IZFINX-NEXT: # %bb.1: # %if.then +; RV64IZFINX-NEXT: ret +; RV64IZFINX-NEXT: .LBB0_2: # %if.else +; RV64IZFINX-NEXT: addi sp, sp, -16 +; RV64IZFINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: call abort@plt %1 = fcmp false float %a, %b br i1 %1, label %if.then, label %if.else if.then: @@ -61,6 +87,28 @@ ; RV64IF-NEXT: addi sp, sp, -16 ; RV64IF-NEXT: sd ra, 8(sp) # 8-byte Folded Spill ; RV64IF-NEXT: call abort@plt +; +; RV32IZFINX-LABEL: br_fcmp_oeq: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: feq.s a0, a0, a1 +; RV32IZFINX-NEXT: bnez a0, .LBB1_2 +; RV32IZFINX-NEXT: # %bb.1: # %if.else +; RV32IZFINX-NEXT: ret +; RV32IZFINX-NEXT: .LBB1_2: # %if.then +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call abort@plt +; +; RV64IZFINX-LABEL: br_fcmp_oeq: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: feq.s a0, a0, a1 +; RV64IZFINX-NEXT: bnez a0, .LBB1_2 +; RV64IZFINX-NEXT: # %bb.1: # %if.else +; RV64IZFINX-NEXT: ret +; RV64IZFINX-NEXT: .LBB1_2: # %if.then +; RV64IZFINX-NEXT: addi sp, sp, -16 +; RV64IZFINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: call abort@plt %1 = fcmp oeq float %a, %b br i1 %1, label %if.then, label %if.else if.else: @@ -95,6 +143,28 @@ ; RV64IF-NEXT: addi sp, sp, -16 ; RV64IF-NEXT: sd ra, 8(sp) # 8-byte Folded Spill ; RV64IF-NEXT: call abort@plt +; +; RV32IZFINX-LABEL: br_fcmp_oeq_alt: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: feq.s a0, a0, a1 +; RV32IZFINX-NEXT: bnez a0, .LBB2_2 +; RV32IZFINX-NEXT: # %bb.1: # %if.else +; RV32IZFINX-NEXT: ret +; RV32IZFINX-NEXT: .LBB2_2: # %if.then +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call abort@plt +; +; RV64IZFINX-LABEL: br_fcmp_oeq_alt: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: feq.s a0, a0, a1 +; RV64IZFINX-NEXT: bnez a0, .LBB2_2 +; RV64IZFINX-NEXT: # %bb.1: # %if.else +; RV64IZFINX-NEXT: ret +; RV64IZFINX-NEXT: .LBB2_2: # %if.then +; RV64IZFINX-NEXT: addi sp, sp, -16 +; RV64IZFINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: call abort@plt %1 = fcmp oeq float %a, %b br i1 %1, label %if.then, label %if.else if.then: @@ -126,6 +196,28 @@ ; RV64IF-NEXT: addi sp, sp, -16 ; RV64IF-NEXT: sd ra, 8(sp) # 8-byte Folded Spill ; RV64IF-NEXT: call abort@plt +; +; RV32IZFINX-LABEL: br_fcmp_ogt: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: flt.s a0, a1, a0 +; RV32IZFINX-NEXT: bnez a0, .LBB3_2 +; RV32IZFINX-NEXT: # %bb.1: # %if.else +; RV32IZFINX-NEXT: ret +; RV32IZFINX-NEXT: .LBB3_2: # %if.then +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call abort@plt +; +; RV64IZFINX-LABEL: br_fcmp_ogt: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: flt.s a0, a1, a0 +; RV64IZFINX-NEXT: bnez a0, .LBB3_2 +; RV64IZFINX-NEXT: # %bb.1: # %if.else +; RV64IZFINX-NEXT: ret +; RV64IZFINX-NEXT: .LBB3_2: # %if.then +; RV64IZFINX-NEXT: addi sp, sp, -16 +; RV64IZFINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: call abort@plt %1 = fcmp ogt float %a, %b br i1 %1, label %if.then, label %if.else if.else: @@ -157,6 +249,28 @@ ; RV64IF-NEXT: addi sp, sp, -16 ; RV64IF-NEXT: sd ra, 8(sp) # 8-byte Folded Spill ; RV64IF-NEXT: call abort@plt +; +; RV32IZFINX-LABEL: br_fcmp_oge: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: fle.s a0, a1, a0 +; RV32IZFINX-NEXT: bnez a0, .LBB4_2 +; RV32IZFINX-NEXT: # %bb.1: # %if.else +; RV32IZFINX-NEXT: ret +; RV32IZFINX-NEXT: .LBB4_2: # %if.then +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call abort@plt +; +; RV64IZFINX-LABEL: br_fcmp_oge: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fle.s a0, a1, a0 +; RV64IZFINX-NEXT: bnez a0, .LBB4_2 +; RV64IZFINX-NEXT: # %bb.1: # %if.else +; RV64IZFINX-NEXT: ret +; RV64IZFINX-NEXT: .LBB4_2: # %if.then +; RV64IZFINX-NEXT: addi sp, sp, -16 +; RV64IZFINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: call abort@plt %1 = fcmp oge float %a, %b br i1 %1, label %if.then, label %if.else if.else: @@ -188,6 +302,28 @@ ; RV64IF-NEXT: addi sp, sp, -16 ; RV64IF-NEXT: sd ra, 8(sp) # 8-byte Folded Spill ; RV64IF-NEXT: call abort@plt +; +; RV32IZFINX-LABEL: br_fcmp_olt: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: flt.s a0, a0, a1 +; RV32IZFINX-NEXT: bnez a0, .LBB5_2 +; RV32IZFINX-NEXT: # %bb.1: # %if.else +; RV32IZFINX-NEXT: ret +; RV32IZFINX-NEXT: .LBB5_2: # %if.then +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call abort@plt +; +; RV64IZFINX-LABEL: br_fcmp_olt: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: flt.s a0, a0, a1 +; RV64IZFINX-NEXT: bnez a0, .LBB5_2 +; RV64IZFINX-NEXT: # %bb.1: # %if.else +; RV64IZFINX-NEXT: ret +; RV64IZFINX-NEXT: .LBB5_2: # %if.then +; RV64IZFINX-NEXT: addi sp, sp, -16 +; RV64IZFINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: call abort@plt %1 = fcmp olt float %a, %b br i1 %1, label %if.then, label %if.else if.else: @@ -219,6 +355,28 @@ ; RV64IF-NEXT: addi sp, sp, -16 ; RV64IF-NEXT: sd ra, 8(sp) # 8-byte Folded Spill ; RV64IF-NEXT: call abort@plt +; +; RV32IZFINX-LABEL: br_fcmp_ole: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: fle.s a0, a0, a1 +; RV32IZFINX-NEXT: bnez a0, .LBB6_2 +; RV32IZFINX-NEXT: # %bb.1: # %if.else +; RV32IZFINX-NEXT: ret +; RV32IZFINX-NEXT: .LBB6_2: # %if.then +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call abort@plt +; +; RV64IZFINX-LABEL: br_fcmp_ole: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fle.s a0, a0, a1 +; RV64IZFINX-NEXT: bnez a0, .LBB6_2 +; RV64IZFINX-NEXT: # %bb.1: # %if.else +; RV64IZFINX-NEXT: ret +; RV64IZFINX-NEXT: .LBB6_2: # %if.then +; RV64IZFINX-NEXT: addi sp, sp, -16 +; RV64IZFINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: call abort@plt %1 = fcmp ole float %a, %b br i1 %1, label %if.then, label %if.else if.else: @@ -254,6 +412,32 @@ ; RV64IF-NEXT: addi sp, sp, -16 ; RV64IF-NEXT: sd ra, 8(sp) # 8-byte Folded Spill ; RV64IF-NEXT: call abort@plt +; +; RV32IZFINX-LABEL: br_fcmp_one: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: flt.s a2, a0, a1 +; RV32IZFINX-NEXT: flt.s a0, a1, a0 +; RV32IZFINX-NEXT: or a0, a0, a2 +; RV32IZFINX-NEXT: bnez a0, .LBB7_2 +; RV32IZFINX-NEXT: # %bb.1: # %if.else +; RV32IZFINX-NEXT: ret +; RV32IZFINX-NEXT: .LBB7_2: # %if.then +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call abort@plt +; +; RV64IZFINX-LABEL: br_fcmp_one: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: flt.s a2, a0, a1 +; RV64IZFINX-NEXT: flt.s a0, a1, a0 +; RV64IZFINX-NEXT: or a0, a0, a2 +; RV64IZFINX-NEXT: bnez a0, .LBB7_2 +; RV64IZFINX-NEXT: # %bb.1: # %if.else +; RV64IZFINX-NEXT: ret +; RV64IZFINX-NEXT: .LBB7_2: # %if.then +; RV64IZFINX-NEXT: addi sp, sp, -16 +; RV64IZFINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: call abort@plt %1 = fcmp one float %a, %b br i1 %1, label %if.then, label %if.else if.else: @@ -289,6 +473,32 @@ ; RV64IF-NEXT: addi sp, sp, -16 ; RV64IF-NEXT: sd ra, 8(sp) # 8-byte Folded Spill ; RV64IF-NEXT: call abort@plt +; +; RV32IZFINX-LABEL: br_fcmp_ord: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: feq.s a1, a1, a1 +; RV32IZFINX-NEXT: feq.s a0, a0, a0 +; RV32IZFINX-NEXT: and a0, a0, a1 +; RV32IZFINX-NEXT: bnez a0, .LBB8_2 +; RV32IZFINX-NEXT: # %bb.1: # %if.else +; RV32IZFINX-NEXT: ret +; RV32IZFINX-NEXT: .LBB8_2: # %if.then +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call abort@plt +; +; RV64IZFINX-LABEL: br_fcmp_ord: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: feq.s a1, a1, a1 +; RV64IZFINX-NEXT: feq.s a0, a0, a0 +; RV64IZFINX-NEXT: and a0, a0, a1 +; RV64IZFINX-NEXT: bnez a0, .LBB8_2 +; RV64IZFINX-NEXT: # %bb.1: # %if.else +; RV64IZFINX-NEXT: ret +; RV64IZFINX-NEXT: .LBB8_2: # %if.then +; RV64IZFINX-NEXT: addi sp, sp, -16 +; RV64IZFINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: call abort@plt %1 = fcmp ord float %a, %b br i1 %1, label %if.then, label %if.else if.else: @@ -324,6 +534,32 @@ ; RV64IF-NEXT: addi sp, sp, -16 ; RV64IF-NEXT: sd ra, 8(sp) # 8-byte Folded Spill ; RV64IF-NEXT: call abort@plt +; +; RV32IZFINX-LABEL: br_fcmp_ueq: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: flt.s a2, a0, a1 +; RV32IZFINX-NEXT: flt.s a0, a1, a0 +; RV32IZFINX-NEXT: or a0, a0, a2 +; RV32IZFINX-NEXT: beqz a0, .LBB9_2 +; RV32IZFINX-NEXT: # %bb.1: # %if.else +; RV32IZFINX-NEXT: ret +; RV32IZFINX-NEXT: .LBB9_2: # %if.then +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call abort@plt +; +; RV64IZFINX-LABEL: br_fcmp_ueq: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: flt.s a2, a0, a1 +; RV64IZFINX-NEXT: flt.s a0, a1, a0 +; RV64IZFINX-NEXT: or a0, a0, a2 +; RV64IZFINX-NEXT: beqz a0, .LBB9_2 +; RV64IZFINX-NEXT: # %bb.1: # %if.else +; RV64IZFINX-NEXT: ret +; RV64IZFINX-NEXT: .LBB9_2: # %if.then +; RV64IZFINX-NEXT: addi sp, sp, -16 +; RV64IZFINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: call abort@plt %1 = fcmp ueq float %a, %b br i1 %1, label %if.then, label %if.else if.else: @@ -355,6 +591,28 @@ ; RV64IF-NEXT: addi sp, sp, -16 ; RV64IF-NEXT: sd ra, 8(sp) # 8-byte Folded Spill ; RV64IF-NEXT: call abort@plt +; +; RV32IZFINX-LABEL: br_fcmp_ugt: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: fle.s a0, a0, a1 +; RV32IZFINX-NEXT: beqz a0, .LBB10_2 +; RV32IZFINX-NEXT: # %bb.1: # %if.else +; RV32IZFINX-NEXT: ret +; RV32IZFINX-NEXT: .LBB10_2: # %if.then +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call abort@plt +; +; RV64IZFINX-LABEL: br_fcmp_ugt: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fle.s a0, a0, a1 +; RV64IZFINX-NEXT: beqz a0, .LBB10_2 +; RV64IZFINX-NEXT: # %bb.1: # %if.else +; RV64IZFINX-NEXT: ret +; RV64IZFINX-NEXT: .LBB10_2: # %if.then +; RV64IZFINX-NEXT: addi sp, sp, -16 +; RV64IZFINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: call abort@plt %1 = fcmp ugt float %a, %b br i1 %1, label %if.then, label %if.else if.else: @@ -386,6 +644,28 @@ ; RV64IF-NEXT: addi sp, sp, -16 ; RV64IF-NEXT: sd ra, 8(sp) # 8-byte Folded Spill ; RV64IF-NEXT: call abort@plt +; +; RV32IZFINX-LABEL: br_fcmp_uge: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: flt.s a0, a0, a1 +; RV32IZFINX-NEXT: beqz a0, .LBB11_2 +; RV32IZFINX-NEXT: # %bb.1: # %if.else +; RV32IZFINX-NEXT: ret +; RV32IZFINX-NEXT: .LBB11_2: # %if.then +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call abort@plt +; +; RV64IZFINX-LABEL: br_fcmp_uge: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: flt.s a0, a0, a1 +; RV64IZFINX-NEXT: beqz a0, .LBB11_2 +; RV64IZFINX-NEXT: # %bb.1: # %if.else +; RV64IZFINX-NEXT: ret +; RV64IZFINX-NEXT: .LBB11_2: # %if.then +; RV64IZFINX-NEXT: addi sp, sp, -16 +; RV64IZFINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: call abort@plt %1 = fcmp uge float %a, %b br i1 %1, label %if.then, label %if.else if.else: @@ -417,6 +697,28 @@ ; RV64IF-NEXT: addi sp, sp, -16 ; RV64IF-NEXT: sd ra, 8(sp) # 8-byte Folded Spill ; RV64IF-NEXT: call abort@plt +; +; RV32IZFINX-LABEL: br_fcmp_ult: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: fle.s a0, a1, a0 +; RV32IZFINX-NEXT: beqz a0, .LBB12_2 +; RV32IZFINX-NEXT: # %bb.1: # %if.else +; RV32IZFINX-NEXT: ret +; RV32IZFINX-NEXT: .LBB12_2: # %if.then +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call abort@plt +; +; RV64IZFINX-LABEL: br_fcmp_ult: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fle.s a0, a1, a0 +; RV64IZFINX-NEXT: beqz a0, .LBB12_2 +; RV64IZFINX-NEXT: # %bb.1: # %if.else +; RV64IZFINX-NEXT: ret +; RV64IZFINX-NEXT: .LBB12_2: # %if.then +; RV64IZFINX-NEXT: addi sp, sp, -16 +; RV64IZFINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: call abort@plt %1 = fcmp ult float %a, %b br i1 %1, label %if.then, label %if.else if.else: @@ -448,6 +750,28 @@ ; RV64IF-NEXT: addi sp, sp, -16 ; RV64IF-NEXT: sd ra, 8(sp) # 8-byte Folded Spill ; RV64IF-NEXT: call abort@plt +; +; RV32IZFINX-LABEL: br_fcmp_ule: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: flt.s a0, a1, a0 +; RV32IZFINX-NEXT: beqz a0, .LBB13_2 +; RV32IZFINX-NEXT: # %bb.1: # %if.else +; RV32IZFINX-NEXT: ret +; RV32IZFINX-NEXT: .LBB13_2: # %if.then +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call abort@plt +; +; RV64IZFINX-LABEL: br_fcmp_ule: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: flt.s a0, a1, a0 +; RV64IZFINX-NEXT: beqz a0, .LBB13_2 +; RV64IZFINX-NEXT: # %bb.1: # %if.else +; RV64IZFINX-NEXT: ret +; RV64IZFINX-NEXT: .LBB13_2: # %if.then +; RV64IZFINX-NEXT: addi sp, sp, -16 +; RV64IZFINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: call abort@plt %1 = fcmp ule float %a, %b br i1 %1, label %if.then, label %if.else if.else: @@ -479,6 +803,28 @@ ; RV64IF-NEXT: addi sp, sp, -16 ; RV64IF-NEXT: sd ra, 8(sp) # 8-byte Folded Spill ; RV64IF-NEXT: call abort@plt +; +; RV32IZFINX-LABEL: br_fcmp_une: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: feq.s a0, a0, a1 +; RV32IZFINX-NEXT: beqz a0, .LBB14_2 +; RV32IZFINX-NEXT: # %bb.1: # %if.else +; RV32IZFINX-NEXT: ret +; RV32IZFINX-NEXT: .LBB14_2: # %if.then +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call abort@plt +; +; RV64IZFINX-LABEL: br_fcmp_une: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: feq.s a0, a0, a1 +; RV64IZFINX-NEXT: beqz a0, .LBB14_2 +; RV64IZFINX-NEXT: # %bb.1: # %if.else +; RV64IZFINX-NEXT: ret +; RV64IZFINX-NEXT: .LBB14_2: # %if.then +; RV64IZFINX-NEXT: addi sp, sp, -16 +; RV64IZFINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: call abort@plt %1 = fcmp une float %a, %b br i1 %1, label %if.then, label %if.else if.else: @@ -514,6 +860,32 @@ ; RV64IF-NEXT: addi sp, sp, -16 ; RV64IF-NEXT: sd ra, 8(sp) # 8-byte Folded Spill ; RV64IF-NEXT: call abort@plt +; +; RV32IZFINX-LABEL: br_fcmp_uno: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: feq.s a1, a1, a1 +; RV32IZFINX-NEXT: feq.s a0, a0, a0 +; RV32IZFINX-NEXT: and a0, a0, a1 +; RV32IZFINX-NEXT: beqz a0, .LBB15_2 +; RV32IZFINX-NEXT: # %bb.1: # %if.else +; RV32IZFINX-NEXT: ret +; RV32IZFINX-NEXT: .LBB15_2: # %if.then +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call abort@plt +; +; RV64IZFINX-LABEL: br_fcmp_uno: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: feq.s a1, a1, a1 +; RV64IZFINX-NEXT: feq.s a0, a0, a0 +; RV64IZFINX-NEXT: and a0, a0, a1 +; RV64IZFINX-NEXT: beqz a0, .LBB15_2 +; RV64IZFINX-NEXT: # %bb.1: # %if.else +; RV64IZFINX-NEXT: ret +; RV64IZFINX-NEXT: .LBB15_2: # %if.then +; RV64IZFINX-NEXT: addi sp, sp, -16 +; RV64IZFINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: call abort@plt %1 = fcmp uno float %a, %b br i1 %1, label %if.then, label %if.else if.else: @@ -545,6 +917,28 @@ ; RV64IF-NEXT: addi sp, sp, -16 ; RV64IF-NEXT: sd ra, 8(sp) # 8-byte Folded Spill ; RV64IF-NEXT: call abort@plt +; +; RV32IZFINX-LABEL: br_fcmp_true: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: li a0, 1 +; RV32IZFINX-NEXT: bnez a0, .LBB16_2 +; RV32IZFINX-NEXT: # %bb.1: # %if.else +; RV32IZFINX-NEXT: ret +; RV32IZFINX-NEXT: .LBB16_2: # %if.then +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call abort@plt +; +; RV64IZFINX-LABEL: br_fcmp_true: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: li a0, 1 +; RV64IZFINX-NEXT: bnez a0, .LBB16_2 +; RV64IZFINX-NEXT: # %bb.1: # %if.else +; RV64IZFINX-NEXT: ret +; RV64IZFINX-NEXT: .LBB16_2: # %if.then +; RV64IZFINX-NEXT: addi sp, sp, -16 +; RV64IZFINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: call abort@plt %1 = fcmp true float %a, %b br i1 %1, label %if.then, label %if.else if.else: @@ -604,6 +998,48 @@ ; RV64IF-NEXT: ret ; RV64IF-NEXT: .LBB17_3: # %if.then ; RV64IF-NEXT: call abort@plt +; +; RV32IZFINX-LABEL: br_fcmp_store_load_stack_slot: +; RV32IZFINX: # %bb.0: # %entry +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: li a0, 0 +; RV32IZFINX-NEXT: call dummy@plt +; RV32IZFINX-NEXT: feq.s a0, a0, zero +; RV32IZFINX-NEXT: beqz a0, .LBB17_3 +; RV32IZFINX-NEXT: # %bb.1: # %if.end +; RV32IZFINX-NEXT: li a0, 0 +; RV32IZFINX-NEXT: call dummy@plt +; RV32IZFINX-NEXT: feq.s a0, a0, zero +; RV32IZFINX-NEXT: beqz a0, .LBB17_3 +; RV32IZFINX-NEXT: # %bb.2: # %if.end4 +; RV32IZFINX-NEXT: li a0, 0 +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; RV32IZFINX-NEXT: .LBB17_3: # %if.then +; RV32IZFINX-NEXT: call abort@plt +; +; RV64IZFINX-LABEL: br_fcmp_store_load_stack_slot: +; RV64IZFINX: # %bb.0: # %entry +; RV64IZFINX-NEXT: addi sp, sp, -16 +; RV64IZFINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: li a0, 0 +; RV64IZFINX-NEXT: call dummy@plt +; RV64IZFINX-NEXT: feq.s a0, a0, zero +; RV64IZFINX-NEXT: beqz a0, .LBB17_3 +; RV64IZFINX-NEXT: # %bb.1: # %if.end +; RV64IZFINX-NEXT: li a0, 0 +; RV64IZFINX-NEXT: call dummy@plt +; RV64IZFINX-NEXT: feq.s a0, a0, zero +; RV64IZFINX-NEXT: beqz a0, .LBB17_3 +; RV64IZFINX-NEXT: # %bb.2: # %if.end4 +; RV64IZFINX-NEXT: li a0, 0 +; RV64IZFINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINX-NEXT: addi sp, sp, 16 +; RV64IZFINX-NEXT: ret +; RV64IZFINX-NEXT: .LBB17_3: # %if.then +; RV64IZFINX-NEXT: call abort@plt entry: %call = call float @dummy(float 0.000000e+00) %cmp = fcmp une float %call, 0.000000e+00 diff --git a/llvm/test/CodeGen/RISCV/float-convert-strict.ll b/llvm/test/CodeGen/RISCV/float-convert-strict.ll --- a/llvm/test/CodeGen/RISCV/float-convert-strict.ll +++ b/llvm/test/CodeGen/RISCV/float-convert-strict.ll @@ -5,6 +5,12 @@ ; RUN: llc -mtriple=riscv64 -mattr=+f -verify-machineinstrs < %s \ ; RUN: -disable-strictnode-mutation -target-abi=lp64f \ ; RUN: | FileCheck -check-prefixes=CHECKIF,RV64IF %s +; RUN: llc -mtriple=riscv32 -mattr=+zfinx -verify-machineinstrs < %s \ +; RUN: -disable-strictnode-mutation -target-abi=ilp32 \ +; RUN: | FileCheck -check-prefixes=CHECKIZFINX,RV32IZFINX %s +; RUN: llc -mtriple=riscv64 -mattr=+zfinx -verify-machineinstrs < %s \ +; RUN: -disable-strictnode-mutation -target-abi=lp64 \ +; RUN: | FileCheck -check-prefixes=CHECKIZFINX,RV64IZFINX %s ; RUN: llc -mtriple=riscv32 -verify-machineinstrs < %s \ ; RUN: -disable-strictnode-mutation | FileCheck -check-prefix=RV32I %s ; RUN: llc -mtriple=riscv64 -verify-machineinstrs < %s \ @@ -20,6 +26,11 @@ ; CHECKIF-NEXT: fcvt.w.s a0, fa0, rtz ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcvt_w_s: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fcvt.w.s a0, a0, rtz +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcvt_w_s: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -48,6 +59,11 @@ ; CHECKIF-NEXT: fcvt.wu.s a0, fa0, rtz ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcvt_wu_s: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fcvt.wu.s a0, a0, rtz +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcvt_wu_s: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -83,6 +99,16 @@ ; CHECKIF-NEXT: .LBB2_2: ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcvt_wu_s_multiple_use: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fcvt.wu.s a1, a0, rtz +; CHECKIZFINX-NEXT: li a0, 1 +; CHECKIZFINX-NEXT: beqz a1, .LBB2_2 +; CHECKIZFINX-NEXT: # %bb.1: +; CHECKIZFINX-NEXT: mv a0, a1 +; CHECKIZFINX-NEXT: .LBB2_2: +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcvt_wu_s_multiple_use: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -124,6 +150,11 @@ ; CHECKIF-NEXT: fcvt.s.w fa0, a0 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcvt_s_w: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fcvt.s.w a0, a0 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcvt_s_w: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -154,6 +185,12 @@ ; CHECKIF-NEXT: fcvt.s.w fa0, a0 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcvt_s_w_load: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: lw a0, 0(a0) +; CHECKIZFINX-NEXT: fcvt.s.w a0, a0 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcvt_s_w_load: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -184,6 +221,11 @@ ; CHECKIF-NEXT: fcvt.s.wu fa0, a0 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcvt_s_wu: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fcvt.s.wu a0, a0 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcvt_s_wu: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -220,6 +262,18 @@ ; RV64IF-NEXT: fcvt.s.wu fa0, a0 ; RV64IF-NEXT: ret ; +; RV32IZFINX-LABEL: fcvt_s_wu_load: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: lw a0, 0(a0) +; RV32IZFINX-NEXT: fcvt.s.wu a0, a0 +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: fcvt_s_wu_load: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: lwu a0, 0(a0) +; RV64IZFINX-NEXT: fcvt.s.wu a0, a0 +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: fcvt_s_wu_load: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -259,6 +313,20 @@ ; RV64IF-NEXT: fcvt.l.s a0, fa0, rtz ; RV64IF-NEXT: ret ; +; RV32IZFINX-LABEL: fcvt_l_s: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call __fixsfdi@plt +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: fcvt_l_s: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fcvt.l.s a0, a0, rtz +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: fcvt_l_s: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -296,6 +364,20 @@ ; RV64IF-NEXT: fcvt.lu.s a0, fa0, rtz ; RV64IF-NEXT: ret ; +; RV32IZFINX-LABEL: fcvt_lu_s: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call __fixunssfdi@plt +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: fcvt_lu_s: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fcvt.lu.s a0, a0, rtz +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: fcvt_lu_s: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -333,6 +415,20 @@ ; RV64IF-NEXT: fcvt.s.l fa0, a0 ; RV64IF-NEXT: ret ; +; RV32IZFINX-LABEL: fcvt_s_l: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call __floatdisf@plt +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: fcvt_s_l: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fcvt.s.l a0, a0 +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: fcvt_s_l: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -370,6 +466,20 @@ ; RV64IF-NEXT: fcvt.s.lu fa0, a0 ; RV64IF-NEXT: ret ; +; RV32IZFINX-LABEL: fcvt_s_lu: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call __floatundisf@plt +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: fcvt_s_lu: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fcvt.s.lu a0, a0 +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: fcvt_s_lu: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -398,6 +508,11 @@ ; CHECKIF-NEXT: fcvt.s.w fa0, a0 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcvt_s_w_i8: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fcvt.s.w a0, a0 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcvt_s_w_i8: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -426,6 +541,11 @@ ; CHECKIF-NEXT: fcvt.s.wu fa0, a0 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcvt_s_wu_i8: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fcvt.s.wu a0, a0 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcvt_s_wu_i8: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -454,6 +574,11 @@ ; CHECKIF-NEXT: fcvt.s.w fa0, a0 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcvt_s_w_i16: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fcvt.s.w a0, a0 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcvt_s_w_i16: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -482,6 +607,11 @@ ; CHECKIF-NEXT: fcvt.s.wu fa0, a0 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcvt_s_wu_i16: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fcvt.s.wu a0, a0 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcvt_s_wu_i16: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -520,6 +650,22 @@ ; RV64IF-NEXT: fsw ft0, 0(a1) ; RV64IF-NEXT: ret ; +; RV32IZFINX-LABEL: fcvt_s_w_demanded_bits: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi a0, a0, 1 +; RV32IZFINX-NEXT: fcvt.s.w a2, a0 +; RV32IZFINX-NEXT: sw a2, 0(a1) +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: fcvt_s_w_demanded_bits: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: addiw a2, a0, 1 +; RV64IZFINX-NEXT: addi a0, a0, 1 +; RV64IZFINX-NEXT: fcvt.s.w a0, a0 +; RV64IZFINX-NEXT: sw a0, 0(a1) +; RV64IZFINX-NEXT: mv a0, a2 +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: fcvt_s_w_demanded_bits: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -577,6 +723,20 @@ ; RV64IF-NEXT: fsw ft0, 0(a1) ; RV64IF-NEXT: ret ; +; RV32IZFINX-LABEL: fcvt_s_wu_demanded_bits: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi a0, a0, 1 +; RV32IZFINX-NEXT: fcvt.s.wu a2, a0 +; RV32IZFINX-NEXT: sw a2, 0(a1) +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: fcvt_s_wu_demanded_bits: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: addiw a0, a0, 1 +; RV64IZFINX-NEXT: fcvt.s.wu a2, a0 +; RV64IZFINX-NEXT: sw a2, 0(a1) +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: fcvt_s_wu_demanded_bits: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 diff --git a/llvm/test/CodeGen/RISCV/float-convert.ll b/llvm/test/CodeGen/RISCV/float-convert.ll --- a/llvm/test/CodeGen/RISCV/float-convert.ll +++ b/llvm/test/CodeGen/RISCV/float-convert.ll @@ -3,6 +3,10 @@ ; RUN: -target-abi=ilp32f | FileCheck -check-prefixes=CHECKIF,RV32IF %s ; RUN: llc -mtriple=riscv64 -mattr=+f -verify-machineinstrs < %s \ ; RUN: -target-abi=lp64f | FileCheck -check-prefixes=CHECKIF,RV64IF %s +; RUN: llc -mtriple=riscv32 -mattr=+zfinx -verify-machineinstrs < %s \ +; RUN: -target-abi=ilp32 | FileCheck -check-prefixes=CHECKIZFINX,RV32IZFINX %s +; RUN: llc -mtriple=riscv64 -mattr=+zfinx -verify-machineinstrs < %s \ +; RUN: -target-abi=lp64 | FileCheck -check-prefixes=CHECKIZFINX,RV64IZFINX %s ; RUN: llc -mtriple=riscv32 -verify-machineinstrs < %s \ ; RUN: | FileCheck -check-prefix=RV32I %s ; RUN: llc -mtriple=riscv64 -verify-machineinstrs < %s \ @@ -14,6 +18,11 @@ ; CHECKIF-NEXT: fcvt.w.s a0, fa0, rtz ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcvt_w_s: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fcvt.w.s a0, a0, rtz +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcvt_w_s: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -45,6 +54,17 @@ ; CHECKIF-NEXT: .LBB1_2: # %start ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcvt_w_s_sat: +; CHECKIZFINX: # %bb.0: # %start +; CHECKIZFINX-NEXT: feq.s a1, a0, a0 +; CHECKIZFINX-NEXT: bnez a1, .LBB1_2 +; CHECKIZFINX-NEXT: # %bb.1: # %start +; CHECKIZFINX-NEXT: li a0, 0 +; CHECKIZFINX-NEXT: ret +; CHECKIZFINX-NEXT: .LBB1_2: +; CHECKIZFINX-NEXT: fcvt.w.s a0, a0, rtz +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcvt_w_s_sat: ; RV32I: # %bb.0: # %start ; RV32I-NEXT: addi sp, sp, -32 @@ -146,6 +166,11 @@ ; CHECKIF-NEXT: fcvt.wu.s a0, fa0, rtz ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcvt_wu_s: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fcvt.wu.s a0, a0, rtz +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcvt_wu_s: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -180,6 +205,16 @@ ; CHECKIF-NEXT: .LBB3_2: ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcvt_wu_s_multiple_use: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fcvt.wu.s a1, a0, rtz +; CHECKIZFINX-NEXT: li a0, 1 +; CHECKIZFINX-NEXT: beqz a1, .LBB3_2 +; CHECKIZFINX-NEXT: # %bb.1: +; CHECKIZFINX-NEXT: mv a0, a1 +; CHECKIZFINX-NEXT: .LBB3_2: +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcvt_wu_s_multiple_use: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -236,6 +271,30 @@ ; RV64IF-NEXT: .LBB4_2: # %start ; RV64IF-NEXT: ret ; +; RV32IZFINX-LABEL: fcvt_wu_s_sat: +; RV32IZFINX: # %bb.0: # %start +; RV32IZFINX-NEXT: feq.s a1, a0, a0 +; RV32IZFINX-NEXT: bnez a1, .LBB4_2 +; RV32IZFINX-NEXT: # %bb.1: # %start +; RV32IZFINX-NEXT: li a0, 0 +; RV32IZFINX-NEXT: ret +; RV32IZFINX-NEXT: .LBB4_2: +; RV32IZFINX-NEXT: fcvt.wu.s a0, a0, rtz +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: fcvt_wu_s_sat: +; RV64IZFINX: # %bb.0: # %start +; RV64IZFINX-NEXT: feq.s a1, a0, a0 +; RV64IZFINX-NEXT: bnez a1, .LBB4_2 +; RV64IZFINX-NEXT: # %bb.1: # %start +; RV64IZFINX-NEXT: li a0, 0 +; RV64IZFINX-NEXT: ret +; RV64IZFINX-NEXT: .LBB4_2: +; RV64IZFINX-NEXT: fcvt.wu.s a0, a0, rtz +; RV64IZFINX-NEXT: slli a0, a0, 32 +; RV64IZFINX-NEXT: srli a0, a0, 32 +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: fcvt_wu_s_sat: ; RV32I: # %bb.0: # %start ; RV32I-NEXT: addi sp, sp, -16 @@ -315,6 +374,21 @@ ; CHECKIF-NEXT: fmv.x.w a0, ft0 ; CHECKIF-NEXT: ret ; +; RV32IZFINX-LABEL: fmv_x_w: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: fadd.s a0, a0, a1 +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: fmv_x_w: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: addi sp, sp, -16 +; RV64IZFINX-NEXT: fadd.s a0, a0, a1 +; RV64IZFINX-NEXT: addi a1, sp, 12 +; RV64IZFINX-NEXT: sw a0, 0(a1) +; RV64IZFINX-NEXT: lw a0, 12(sp) +; RV64IZFINX-NEXT: addi sp, sp, 16 +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: fmv_x_w: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -344,6 +418,11 @@ ; CHECKIF-NEXT: fcvt.s.w fa0, a0 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcvt_s_w: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fcvt.s.w a0, a0 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcvt_s_w: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -373,6 +452,12 @@ ; CHECKIF-NEXT: fcvt.s.w fa0, a0 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcvt_s_w_load: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: lw a0, 0(a0) +; CHECKIZFINX-NEXT: fcvt.s.w a0, a0 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcvt_s_w_load: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -403,6 +488,11 @@ ; CHECKIF-NEXT: fcvt.s.wu fa0, a0 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcvt_s_wu: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fcvt.s.wu a0, a0 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcvt_s_wu: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -438,6 +528,18 @@ ; RV64IF-NEXT: fcvt.s.wu fa0, a0 ; RV64IF-NEXT: ret ; +; RV32IZFINX-LABEL: fcvt_s_wu_load: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: lw a0, 0(a0) +; RV32IZFINX-NEXT: fcvt.s.wu a0, a0 +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: fcvt_s_wu_load: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: lwu a0, 0(a0) +; RV64IZFINX-NEXT: fcvt.s.wu a0, a0 +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: fcvt_s_wu_load: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -470,6 +572,11 @@ ; CHECKIF-NEXT: fadd.s fa0, ft0, ft1 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fmv_w_x: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fadd.s a0, a0, a1 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fmv_w_x: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -509,6 +616,20 @@ ; RV64IF-NEXT: fcvt.l.s a0, fa0, rtz ; RV64IF-NEXT: ret ; +; RV32IZFINX-LABEL: fcvt_l_s: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call __fixsfdi@plt +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: fcvt_l_s: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fcvt.l.s a0, a0, rtz +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: fcvt_l_s: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -582,6 +703,61 @@ ; RV64IF-NEXT: .LBB12_2: # %start ; RV64IF-NEXT: ret ; +; RV32IZFINX-LABEL: fcvt_l_s_sat: +; RV32IZFINX: # %bb.0: # %start +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: sw s0, 8(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: sw s1, 4(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: lui a1, %hi(.LCPI12_0) +; RV32IZFINX-NEXT: addi a1, a1, %lo(.LCPI12_0) +; RV32IZFINX-NEXT: lw a1, 0(a1) +; RV32IZFINX-NEXT: mv s0, a0 +; RV32IZFINX-NEXT: fle.s s1, a1, a0 +; RV32IZFINX-NEXT: call __fixsfdi@plt +; RV32IZFINX-NEXT: lui a3, 524288 +; RV32IZFINX-NEXT: bnez s1, .LBB12_2 +; RV32IZFINX-NEXT: # %bb.1: # %start +; RV32IZFINX-NEXT: lui a1, 524288 +; RV32IZFINX-NEXT: .LBB12_2: # %start +; RV32IZFINX-NEXT: lui a2, %hi(.LCPI12_1) +; RV32IZFINX-NEXT: addi a2, a2, %lo(.LCPI12_1) +; RV32IZFINX-NEXT: lw a2, 0(a2) +; RV32IZFINX-NEXT: flt.s a2, a2, s0 +; RV32IZFINX-NEXT: beqz a2, .LBB12_4 +; RV32IZFINX-NEXT: # %bb.3: +; RV32IZFINX-NEXT: addi a1, a3, -1 +; RV32IZFINX-NEXT: .LBB12_4: # %start +; RV32IZFINX-NEXT: feq.s a3, s0, s0 +; RV32IZFINX-NEXT: bnez a3, .LBB12_6 +; RV32IZFINX-NEXT: # %bb.5: # %start +; RV32IZFINX-NEXT: li a1, 0 +; RV32IZFINX-NEXT: li a0, 0 +; RV32IZFINX-NEXT: j .LBB12_7 +; RV32IZFINX-NEXT: .LBB12_6: +; RV32IZFINX-NEXT: neg a3, s1 +; RV32IZFINX-NEXT: and a0, a3, a0 +; RV32IZFINX-NEXT: seqz a2, a2 +; RV32IZFINX-NEXT: addi a2, a2, -1 +; RV32IZFINX-NEXT: or a0, a0, a2 +; RV32IZFINX-NEXT: .LBB12_7: # %start +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: lw s0, 8(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: lw s1, 4(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: fcvt_l_s_sat: +; RV64IZFINX: # %bb.0: # %start +; RV64IZFINX-NEXT: feq.s a1, a0, a0 +; RV64IZFINX-NEXT: bnez a1, .LBB12_2 +; RV64IZFINX-NEXT: # %bb.1: # %start +; RV64IZFINX-NEXT: li a0, 0 +; RV64IZFINX-NEXT: ret +; RV64IZFINX-NEXT: .LBB12_2: +; RV64IZFINX-NEXT: fcvt.l.s a0, a0, rtz +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: fcvt_l_s_sat: ; RV32I: # %bb.0: # %start ; RV32I-NEXT: addi sp, sp, -32 @@ -724,6 +900,20 @@ ; RV64IF-NEXT: fcvt.lu.s a0, fa0, rtz ; RV64IF-NEXT: ret ; +; RV32IZFINX-LABEL: fcvt_lu_s: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call __fixunssfdi@plt +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: fcvt_lu_s: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fcvt.lu.s a0, a0, rtz +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: fcvt_lu_s: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -781,6 +971,44 @@ ; RV64IF-NEXT: .LBB14_2: # %start ; RV64IF-NEXT: ret ; +; RV32IZFINX-LABEL: fcvt_lu_s_sat: +; RV32IZFINX: # %bb.0: # %start +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: sw s0, 8(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: sw s1, 4(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: mv s0, a0 +; RV32IZFINX-NEXT: fle.s a0, zero, a0 +; RV32IZFINX-NEXT: neg s1, a0 +; RV32IZFINX-NEXT: mv a0, s0 +; RV32IZFINX-NEXT: call __fixunssfdi@plt +; RV32IZFINX-NEXT: lui a2, %hi(.LCPI14_0) +; RV32IZFINX-NEXT: addi a2, a2, %lo(.LCPI14_0) +; RV32IZFINX-NEXT: lw a2, 0(a2) +; RV32IZFINX-NEXT: and a0, s1, a0 +; RV32IZFINX-NEXT: flt.s a2, a2, s0 +; RV32IZFINX-NEXT: seqz a2, a2 +; RV32IZFINX-NEXT: addi a2, a2, -1 +; RV32IZFINX-NEXT: or a0, a0, a2 +; RV32IZFINX-NEXT: and a1, s1, a1 +; RV32IZFINX-NEXT: or a1, a1, a2 +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: lw s0, 8(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: lw s1, 4(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: fcvt_lu_s_sat: +; RV64IZFINX: # %bb.0: # %start +; RV64IZFINX-NEXT: feq.s a1, a0, a0 +; RV64IZFINX-NEXT: bnez a1, .LBB14_2 +; RV64IZFINX-NEXT: # %bb.1: # %start +; RV64IZFINX-NEXT: li a0, 0 +; RV64IZFINX-NEXT: ret +; RV64IZFINX-NEXT: .LBB14_2: +; RV64IZFINX-NEXT: fcvt.lu.s a0, a0, rtz +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: fcvt_lu_s_sat: ; RV32I: # %bb.0: # %start ; RV32I-NEXT: addi sp, sp, -32 @@ -884,6 +1112,20 @@ ; RV64IF-NEXT: fcvt.s.l fa0, a0 ; RV64IF-NEXT: ret ; +; RV32IZFINX-LABEL: fcvt_s_l: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call __floatdisf@plt +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: fcvt_s_l: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fcvt.s.l a0, a0 +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: fcvt_s_l: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -920,6 +1162,20 @@ ; RV64IF-NEXT: fcvt.s.lu fa0, a0 ; RV64IF-NEXT: ret ; +; RV32IZFINX-LABEL: fcvt_s_lu: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call __floatundisf@plt +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: fcvt_s_lu: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fcvt.s.lu a0, a0 +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: fcvt_s_lu: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -947,6 +1203,11 @@ ; CHECKIF-NEXT: fcvt.s.w fa0, a0 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcvt_s_w_i8: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fcvt.s.w a0, a0 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcvt_s_w_i8: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -974,6 +1235,11 @@ ; CHECKIF-NEXT: fcvt.s.wu fa0, a0 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcvt_s_wu_i8: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fcvt.s.wu a0, a0 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcvt_s_wu_i8: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -1001,6 +1267,11 @@ ; CHECKIF-NEXT: fcvt.s.w fa0, a0 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcvt_s_w_i16: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fcvt.s.w a0, a0 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcvt_s_w_i16: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -1028,6 +1299,11 @@ ; CHECKIF-NEXT: fcvt.s.wu fa0, a0 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcvt_s_wu_i16: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fcvt.s.wu a0, a0 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcvt_s_wu_i16: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -1065,6 +1341,22 @@ ; RV64IF-NEXT: fsw ft0, 0(a1) ; RV64IF-NEXT: ret ; +; RV32IZFINX-LABEL: fcvt_s_w_demanded_bits: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi a0, a0, 1 +; RV32IZFINX-NEXT: fcvt.s.w a2, a0 +; RV32IZFINX-NEXT: sw a2, 0(a1) +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: fcvt_s_w_demanded_bits: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: addiw a2, a0, 1 +; RV64IZFINX-NEXT: addi a0, a0, 1 +; RV64IZFINX-NEXT: fcvt.s.w a0, a0 +; RV64IZFINX-NEXT: sw a0, 0(a1) +; RV64IZFINX-NEXT: mv a0, a2 +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: fcvt_s_w_demanded_bits: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -1122,6 +1414,20 @@ ; RV64IF-NEXT: fsw ft0, 0(a1) ; RV64IF-NEXT: ret ; +; RV32IZFINX-LABEL: fcvt_s_wu_demanded_bits: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi a0, a0, 1 +; RV32IZFINX-NEXT: fcvt.s.wu a2, a0 +; RV32IZFINX-NEXT: sw a2, 0(a1) +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: fcvt_s_wu_demanded_bits: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: addiw a0, a0, 1 +; RV64IZFINX-NEXT: fcvt.s.wu a2, a0 +; RV64IZFINX-NEXT: sw a2, 0(a1) +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: fcvt_s_wu_demanded_bits: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -1174,6 +1480,16 @@ ; RV64IF-NEXT: fcvt.l.s a0, fa0, rtz ; RV64IF-NEXT: ret ; +; RV32IZFINX-LABEL: fcvt_w_s_i16: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: fcvt.w.s a0, a0, rtz +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: fcvt_w_s_i16: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fcvt.l.s a0, a0, rtz +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: fcvt_w_s_i16: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -1226,6 +1542,44 @@ ; RV64IF-NEXT: .LBB24_2: # %start ; RV64IF-NEXT: ret ; +; RV32IZFINX-LABEL: fcvt_w_s_sat_i16: +; RV32IZFINX: # %bb.0: # %start +; RV32IZFINX-NEXT: feq.s a1, a0, a0 +; RV32IZFINX-NEXT: bnez a1, .LBB24_2 +; RV32IZFINX-NEXT: # %bb.1: # %start +; RV32IZFINX-NEXT: li a0, 0 +; RV32IZFINX-NEXT: ret +; RV32IZFINX-NEXT: .LBB24_2: +; RV32IZFINX-NEXT: lui a1, %hi(.LCPI24_0) +; RV32IZFINX-NEXT: addi a1, a1, %lo(.LCPI24_0) +; RV32IZFINX-NEXT: lw a1, 0(a1) +; RV32IZFINX-NEXT: lui a2, %hi(.LCPI24_1) +; RV32IZFINX-NEXT: addi a2, a2, %lo(.LCPI24_1) +; RV32IZFINX-NEXT: lw a2, 0(a2) +; RV32IZFINX-NEXT: fmax.s a0, a0, a1 +; RV32IZFINX-NEXT: fmin.s a0, a0, a2 +; RV32IZFINX-NEXT: fcvt.w.s a0, a0, rtz +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: fcvt_w_s_sat_i16: +; RV64IZFINX: # %bb.0: # %start +; RV64IZFINX-NEXT: feq.s a1, a0, a0 +; RV64IZFINX-NEXT: bnez a1, .LBB24_2 +; RV64IZFINX-NEXT: # %bb.1: # %start +; RV64IZFINX-NEXT: li a0, 0 +; RV64IZFINX-NEXT: ret +; RV64IZFINX-NEXT: .LBB24_2: +; RV64IZFINX-NEXT: lui a1, %hi(.LCPI24_0) +; RV64IZFINX-NEXT: addi a1, a1, %lo(.LCPI24_0) +; RV64IZFINX-NEXT: lw a1, 0(a1) +; RV64IZFINX-NEXT: lui a2, %hi(.LCPI24_1) +; RV64IZFINX-NEXT: addi a2, a2, %lo(.LCPI24_1) +; RV64IZFINX-NEXT: lw a2, 0(a2) +; RV64IZFINX-NEXT: fmax.s a0, a0, a1 +; RV64IZFINX-NEXT: fmin.s a0, a0, a2 +; RV64IZFINX-NEXT: fcvt.l.s a0, a0, rtz +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: fcvt_w_s_sat_i16: ; RV32I: # %bb.0: # %start ; RV32I-NEXT: addi sp, sp, -16 @@ -1330,6 +1684,16 @@ ; RV64IF-NEXT: fcvt.lu.s a0, fa0, rtz ; RV64IF-NEXT: ret ; +; RV32IZFINX-LABEL: fcvt_wu_s_i16: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: fcvt.wu.s a0, a0, rtz +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: fcvt_wu_s_i16: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fcvt.lu.s a0, a0, rtz +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: fcvt_wu_s_i16: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -1372,6 +1736,26 @@ ; RV64IF-NEXT: fcvt.lu.s a0, ft0, rtz ; RV64IF-NEXT: ret ; +; RV32IZFINX-LABEL: fcvt_wu_s_sat_i16: +; RV32IZFINX: # %bb.0: # %start +; RV32IZFINX-NEXT: lui a1, %hi(.LCPI26_0) +; RV32IZFINX-NEXT: addi a1, a1, %lo(.LCPI26_0) +; RV32IZFINX-NEXT: lw a1, 0(a1) +; RV32IZFINX-NEXT: fmax.s a0, a0, zero +; RV32IZFINX-NEXT: fmin.s a0, a0, a1 +; RV32IZFINX-NEXT: fcvt.wu.s a0, a0, rtz +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: fcvt_wu_s_sat_i16: +; RV64IZFINX: # %bb.0: # %start +; RV64IZFINX-NEXT: lui a1, %hi(.LCPI26_0) +; RV64IZFINX-NEXT: addi a1, a1, %lo(.LCPI26_0) +; RV64IZFINX-NEXT: lw a1, 0(a1) +; RV64IZFINX-NEXT: fmax.s a0, a0, zero +; RV64IZFINX-NEXT: fmin.s a0, a0, a1 +; RV64IZFINX-NEXT: fcvt.lu.s a0, a0, rtz +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: fcvt_wu_s_sat_i16: ; RV32I: # %bb.0: # %start ; RV32I-NEXT: addi sp, sp, -16 @@ -1462,6 +1846,16 @@ ; RV64IF-NEXT: fcvt.l.s a0, fa0, rtz ; RV64IF-NEXT: ret ; +; RV32IZFINX-LABEL: fcvt_w_s_i8: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: fcvt.w.s a0, a0, rtz +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: fcvt_w_s_i8: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fcvt.l.s a0, a0, rtz +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: fcvt_w_s_i8: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -1514,6 +1908,44 @@ ; RV64IF-NEXT: .LBB28_2: # %start ; RV64IF-NEXT: ret ; +; RV32IZFINX-LABEL: fcvt_w_s_sat_i8: +; RV32IZFINX: # %bb.0: # %start +; RV32IZFINX-NEXT: feq.s a1, a0, a0 +; RV32IZFINX-NEXT: bnez a1, .LBB28_2 +; RV32IZFINX-NEXT: # %bb.1: # %start +; RV32IZFINX-NEXT: li a0, 0 +; RV32IZFINX-NEXT: ret +; RV32IZFINX-NEXT: .LBB28_2: +; RV32IZFINX-NEXT: lui a1, %hi(.LCPI28_0) +; RV32IZFINX-NEXT: addi a1, a1, %lo(.LCPI28_0) +; RV32IZFINX-NEXT: lw a1, 0(a1) +; RV32IZFINX-NEXT: lui a2, %hi(.LCPI28_1) +; RV32IZFINX-NEXT: addi a2, a2, %lo(.LCPI28_1) +; RV32IZFINX-NEXT: lw a2, 0(a2) +; RV32IZFINX-NEXT: fmax.s a0, a0, a1 +; RV32IZFINX-NEXT: fmin.s a0, a0, a2 +; RV32IZFINX-NEXT: fcvt.w.s a0, a0, rtz +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: fcvt_w_s_sat_i8: +; RV64IZFINX: # %bb.0: # %start +; RV64IZFINX-NEXT: feq.s a1, a0, a0 +; RV64IZFINX-NEXT: bnez a1, .LBB28_2 +; RV64IZFINX-NEXT: # %bb.1: # %start +; RV64IZFINX-NEXT: li a0, 0 +; RV64IZFINX-NEXT: ret +; RV64IZFINX-NEXT: .LBB28_2: +; RV64IZFINX-NEXT: lui a1, %hi(.LCPI28_0) +; RV64IZFINX-NEXT: addi a1, a1, %lo(.LCPI28_0) +; RV64IZFINX-NEXT: lw a1, 0(a1) +; RV64IZFINX-NEXT: lui a2, %hi(.LCPI28_1) +; RV64IZFINX-NEXT: addi a2, a2, %lo(.LCPI28_1) +; RV64IZFINX-NEXT: lw a2, 0(a2) +; RV64IZFINX-NEXT: fmax.s a0, a0, a1 +; RV64IZFINX-NEXT: fmin.s a0, a0, a2 +; RV64IZFINX-NEXT: fcvt.l.s a0, a0, rtz +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: fcvt_w_s_sat_i8: ; RV32I: # %bb.0: # %start ; RV32I-NEXT: addi sp, sp, -16 @@ -1616,6 +2048,16 @@ ; RV64IF-NEXT: fcvt.lu.s a0, fa0, rtz ; RV64IF-NEXT: ret ; +; RV32IZFINX-LABEL: fcvt_wu_s_i8: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: fcvt.wu.s a0, a0, rtz +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: fcvt_wu_s_i8: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fcvt.lu.s a0, a0, rtz +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: fcvt_wu_s_i8: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -1658,6 +2100,26 @@ ; RV64IF-NEXT: fcvt.lu.s a0, ft0, rtz ; RV64IF-NEXT: ret ; +; RV32IZFINX-LABEL: fcvt_wu_s_sat_i8: +; RV32IZFINX: # %bb.0: # %start +; RV32IZFINX-NEXT: lui a1, %hi(.LCPI30_0) +; RV32IZFINX-NEXT: addi a1, a1, %lo(.LCPI30_0) +; RV32IZFINX-NEXT: lw a1, 0(a1) +; RV32IZFINX-NEXT: fmax.s a0, a0, zero +; RV32IZFINX-NEXT: fmin.s a0, a0, a1 +; RV32IZFINX-NEXT: fcvt.wu.s a0, a0, rtz +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: fcvt_wu_s_sat_i8: +; RV64IZFINX: # %bb.0: # %start +; RV64IZFINX-NEXT: lui a1, %hi(.LCPI30_0) +; RV64IZFINX-NEXT: addi a1, a1, %lo(.LCPI30_0) +; RV64IZFINX-NEXT: lw a1, 0(a1) +; RV64IZFINX-NEXT: fmax.s a0, a0, zero +; RV64IZFINX-NEXT: fmin.s a0, a0, a1 +; RV64IZFINX-NEXT: fcvt.lu.s a0, a0, rtz +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: fcvt_wu_s_sat_i8: ; RV32I: # %bb.0: # %start ; RV32I-NEXT: addi sp, sp, -16 @@ -1752,6 +2214,30 @@ ; RV64IF-NEXT: .LBB31_2: # %start ; RV64IF-NEXT: ret ; +; RV32IZFINX-LABEL: fcvt_wu_s_sat_zext: +; RV32IZFINX: # %bb.0: # %start +; RV32IZFINX-NEXT: feq.s a1, a0, a0 +; RV32IZFINX-NEXT: bnez a1, .LBB31_2 +; RV32IZFINX-NEXT: # %bb.1: # %start +; RV32IZFINX-NEXT: li a0, 0 +; RV32IZFINX-NEXT: ret +; RV32IZFINX-NEXT: .LBB31_2: +; RV32IZFINX-NEXT: fcvt.wu.s a0, a0, rtz +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: fcvt_wu_s_sat_zext: +; RV64IZFINX: # %bb.0: # %start +; RV64IZFINX-NEXT: feq.s a1, a0, a0 +; RV64IZFINX-NEXT: bnez a1, .LBB31_2 +; RV64IZFINX-NEXT: # %bb.1: # %start +; RV64IZFINX-NEXT: li a0, 0 +; RV64IZFINX-NEXT: ret +; RV64IZFINX-NEXT: .LBB31_2: +; RV64IZFINX-NEXT: fcvt.wu.s a0, a0, rtz +; RV64IZFINX-NEXT: slli a0, a0, 32 +; RV64IZFINX-NEXT: srli a0, a0, 32 +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: fcvt_wu_s_sat_zext: ; RV32I: # %bb.0: # %start ; RV32I-NEXT: addi sp, sp, -16 @@ -1834,6 +2320,17 @@ ; CHECKIF-NEXT: .LBB32_2: # %start ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcvt_w_s_sat_sext: +; CHECKIZFINX: # %bb.0: # %start +; CHECKIZFINX-NEXT: feq.s a1, a0, a0 +; CHECKIZFINX-NEXT: bnez a1, .LBB32_2 +; CHECKIZFINX-NEXT: # %bb.1: # %start +; CHECKIZFINX-NEXT: li a0, 0 +; CHECKIZFINX-NEXT: ret +; CHECKIZFINX-NEXT: .LBB32_2: +; CHECKIZFINX-NEXT: fcvt.w.s a0, a0, rtz +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcvt_w_s_sat_sext: ; RV32I: # %bb.0: # %start ; RV32I-NEXT: addi sp, sp, -32 diff --git a/llvm/test/CodeGen/RISCV/float-fcmp-strict.ll b/llvm/test/CodeGen/RISCV/float-fcmp-strict.ll --- a/llvm/test/CodeGen/RISCV/float-fcmp-strict.ll +++ b/llvm/test/CodeGen/RISCV/float-fcmp-strict.ll @@ -5,6 +5,12 @@ ; RUN: llc -mtriple=riscv64 -mattr=+f -verify-machineinstrs < %s \ ; RUN: -disable-strictnode-mutation -target-abi=lp64f \ ; RUN: | FileCheck -check-prefix=CHECKIF %s +; RUN: llc -mtriple=riscv32 -mattr=+zfinx -verify-machineinstrs < %s \ +; RUN: -disable-strictnode-mutation -target-abi=ilp32 \ +; RUN: | FileCheck -check-prefix=CHECKIZFINX %s +; RUN: llc -mtriple=riscv64 -mattr=+zfinx -verify-machineinstrs < %s \ +; RUN: -disable-strictnode-mutation -target-abi=lp64 \ +; RUN: | FileCheck -check-prefix=CHECKIZFINX %s ; RUN: llc -mtriple=riscv32 -verify-machineinstrs < %s \ ; RUN: -disable-strictnode-mutation | FileCheck -check-prefix=RV32I %s ; RUN: llc -mtriple=riscv64 -verify-machineinstrs < %s \ @@ -16,6 +22,11 @@ ; CHECKIF-NEXT: feq.s a0, fa0, fa1 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcmp_oeq: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: feq.s a0, a0, a1 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcmp_oeq: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -50,6 +61,15 @@ ; CHECKIF-NEXT: feq.s zero, fa1, fa0 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcmp_ogt: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: frflags a3 +; CHECKIZFINX-NEXT: flt.s a2, a1, a0 +; CHECKIZFINX-NEXT: fsflags a3 +; CHECKIZFINX-NEXT: feq.s zero, a1, a0 +; CHECKIZFINX-NEXT: mv a0, a2 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcmp_ogt: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -83,6 +103,15 @@ ; CHECKIF-NEXT: feq.s zero, fa1, fa0 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcmp_oge: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: frflags a3 +; CHECKIZFINX-NEXT: fle.s a2, a1, a0 +; CHECKIZFINX-NEXT: fsflags a3 +; CHECKIZFINX-NEXT: feq.s zero, a1, a0 +; CHECKIZFINX-NEXT: mv a0, a2 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcmp_oge: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -118,6 +147,15 @@ ; CHECKIF-NEXT: feq.s zero, fa0, fa1 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcmp_olt: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: frflags a3 +; CHECKIZFINX-NEXT: flt.s a2, a0, a1 +; CHECKIZFINX-NEXT: fsflags a3 +; CHECKIZFINX-NEXT: feq.s zero, a0, a1 +; CHECKIZFINX-NEXT: mv a0, a2 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcmp_olt: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -151,6 +189,15 @@ ; CHECKIF-NEXT: feq.s zero, fa0, fa1 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcmp_ole: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: frflags a3 +; CHECKIZFINX-NEXT: fle.s a2, a0, a1 +; CHECKIZFINX-NEXT: fsflags a3 +; CHECKIZFINX-NEXT: feq.s zero, a0, a1 +; CHECKIZFINX-NEXT: mv a0, a2 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcmp_ole: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -191,6 +238,20 @@ ; CHECKIF-NEXT: feq.s zero, fa1, fa0 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcmp_one: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: frflags a2 +; CHECKIZFINX-NEXT: flt.s a3, a0, a1 +; CHECKIZFINX-NEXT: fsflags a2 +; CHECKIZFINX-NEXT: feq.s zero, a0, a1 +; CHECKIZFINX-NEXT: frflags a2 +; CHECKIZFINX-NEXT: flt.s a4, a1, a0 +; CHECKIZFINX-NEXT: fsflags a2 +; CHECKIZFINX-NEXT: or a2, a4, a3 +; CHECKIZFINX-NEXT: feq.s zero, a1, a0 +; CHECKIZFINX-NEXT: mv a0, a2 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcmp_one: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -249,6 +310,13 @@ ; CHECKIF-NEXT: and a0, a1, a0 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcmp_ord: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: feq.s a1, a1, a1 +; CHECKIZFINX-NEXT: feq.s a0, a0, a0 +; CHECKIZFINX-NEXT: and a0, a0, a1 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcmp_ord: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -290,6 +358,21 @@ ; CHECKIF-NEXT: feq.s zero, fa1, fa0 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcmp_ueq: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: frflags a2 +; CHECKIZFINX-NEXT: flt.s a3, a0, a1 +; CHECKIZFINX-NEXT: fsflags a2 +; CHECKIZFINX-NEXT: feq.s zero, a0, a1 +; CHECKIZFINX-NEXT: frflags a2 +; CHECKIZFINX-NEXT: flt.s a4, a1, a0 +; CHECKIZFINX-NEXT: fsflags a2 +; CHECKIZFINX-NEXT: or a2, a4, a3 +; CHECKIZFINX-NEXT: xori a2, a2, 1 +; CHECKIZFINX-NEXT: feq.s zero, a1, a0 +; CHECKIZFINX-NEXT: mv a0, a2 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcmp_ueq: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -350,6 +433,16 @@ ; CHECKIF-NEXT: feq.s zero, fa0, fa1 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcmp_ugt: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: frflags a2 +; CHECKIZFINX-NEXT: fle.s a3, a0, a1 +; CHECKIZFINX-NEXT: fsflags a2 +; CHECKIZFINX-NEXT: xori a2, a3, 1 +; CHECKIZFINX-NEXT: feq.s zero, a0, a1 +; CHECKIZFINX-NEXT: mv a0, a2 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcmp_ugt: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -384,6 +477,16 @@ ; CHECKIF-NEXT: feq.s zero, fa0, fa1 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcmp_uge: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: frflags a2 +; CHECKIZFINX-NEXT: flt.s a3, a0, a1 +; CHECKIZFINX-NEXT: fsflags a2 +; CHECKIZFINX-NEXT: xori a2, a3, 1 +; CHECKIZFINX-NEXT: feq.s zero, a0, a1 +; CHECKIZFINX-NEXT: mv a0, a2 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcmp_uge: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -420,6 +523,16 @@ ; CHECKIF-NEXT: feq.s zero, fa1, fa0 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcmp_ult: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: frflags a2 +; CHECKIZFINX-NEXT: fle.s a3, a1, a0 +; CHECKIZFINX-NEXT: fsflags a2 +; CHECKIZFINX-NEXT: xori a2, a3, 1 +; CHECKIZFINX-NEXT: feq.s zero, a1, a0 +; CHECKIZFINX-NEXT: mv a0, a2 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcmp_ult: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -454,6 +567,16 @@ ; CHECKIF-NEXT: feq.s zero, fa1, fa0 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcmp_ule: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: frflags a2 +; CHECKIZFINX-NEXT: flt.s a3, a1, a0 +; CHECKIZFINX-NEXT: fsflags a2 +; CHECKIZFINX-NEXT: xori a2, a3, 1 +; CHECKIZFINX-NEXT: feq.s zero, a1, a0 +; CHECKIZFINX-NEXT: mv a0, a2 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcmp_ule: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -485,6 +608,12 @@ ; CHECKIF-NEXT: xori a0, a0, 1 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcmp_une: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: feq.s a0, a0, a1 +; CHECKIZFINX-NEXT: xori a0, a0, 1 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcmp_une: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -518,6 +647,14 @@ ; CHECKIF-NEXT: xori a0, a0, 1 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcmp_uno: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: feq.s a1, a1, a1 +; CHECKIZFINX-NEXT: feq.s a0, a0, a0 +; CHECKIZFINX-NEXT: and a0, a0, a1 +; CHECKIZFINX-NEXT: xori a0, a0, 1 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcmp_uno: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -550,6 +687,13 @@ ; CHECKIF-NEXT: and a0, a1, a0 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcmps_oeq: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fle.s a2, a1, a0 +; CHECKIZFINX-NEXT: fle.s a0, a0, a1 +; CHECKIZFINX-NEXT: and a0, a0, a2 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcmps_oeq: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -581,6 +725,11 @@ ; CHECKIF-NEXT: flt.s a0, fa1, fa0 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcmps_ogt: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: flt.s a0, a1, a0 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcmps_ogt: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -611,6 +760,11 @@ ; CHECKIF-NEXT: fle.s a0, fa1, fa0 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcmps_oge: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fle.s a0, a1, a0 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcmps_oge: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -643,6 +797,11 @@ ; CHECKIF-NEXT: flt.s a0, fa0, fa1 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcmps_olt: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: flt.s a0, a0, a1 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcmps_olt: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -673,6 +832,11 @@ ; CHECKIF-NEXT: fle.s a0, fa0, fa1 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcmps_ole: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fle.s a0, a0, a1 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcmps_ole: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -705,6 +869,13 @@ ; CHECKIF-NEXT: or a0, a1, a0 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcmps_one: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: flt.s a2, a0, a1 +; CHECKIZFINX-NEXT: flt.s a0, a1, a0 +; CHECKIZFINX-NEXT: or a0, a0, a2 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcmps_one: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -763,6 +934,13 @@ ; CHECKIF-NEXT: and a0, a1, a0 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcmps_ord: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fle.s a1, a1, a1 +; CHECKIZFINX-NEXT: fle.s a0, a0, a0 +; CHECKIZFINX-NEXT: and a0, a0, a1 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcmps_ord: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -796,6 +974,14 @@ ; CHECKIF-NEXT: xori a0, a0, 1 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcmps_ueq: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: flt.s a2, a0, a1 +; CHECKIZFINX-NEXT: flt.s a0, a1, a0 +; CHECKIZFINX-NEXT: or a0, a0, a2 +; CHECKIZFINX-NEXT: xori a0, a0, 1 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcmps_ueq: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -853,6 +1039,12 @@ ; CHECKIF-NEXT: xori a0, a0, 1 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcmps_ugt: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fle.s a0, a0, a1 +; CHECKIZFINX-NEXT: xori a0, a0, 1 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcmps_ugt: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -884,6 +1076,12 @@ ; CHECKIF-NEXT: xori a0, a0, 1 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcmps_uge: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: flt.s a0, a0, a1 +; CHECKIZFINX-NEXT: xori a0, a0, 1 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcmps_uge: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -917,6 +1115,12 @@ ; CHECKIF-NEXT: xori a0, a0, 1 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcmps_ult: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fle.s a0, a1, a0 +; CHECKIZFINX-NEXT: xori a0, a0, 1 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcmps_ult: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -948,6 +1152,12 @@ ; CHECKIF-NEXT: xori a0, a0, 1 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcmps_ule: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: flt.s a0, a1, a0 +; CHECKIZFINX-NEXT: xori a0, a0, 1 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcmps_ule: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -981,6 +1191,14 @@ ; CHECKIF-NEXT: xori a0, a0, 1 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcmps_une: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fle.s a2, a1, a0 +; CHECKIZFINX-NEXT: fle.s a0, a0, a1 +; CHECKIZFINX-NEXT: and a0, a0, a2 +; CHECKIZFINX-NEXT: xori a0, a0, 1 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcmps_une: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -1014,6 +1232,14 @@ ; CHECKIF-NEXT: xori a0, a0, 1 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcmps_uno: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fle.s a1, a1, a1 +; CHECKIZFINX-NEXT: fle.s a0, a0, a0 +; CHECKIZFINX-NEXT: and a0, a0, a1 +; CHECKIZFINX-NEXT: xori a0, a0, 1 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcmps_uno: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 diff --git a/llvm/test/CodeGen/RISCV/float-fcmp.ll b/llvm/test/CodeGen/RISCV/float-fcmp.ll --- a/llvm/test/CodeGen/RISCV/float-fcmp.ll +++ b/llvm/test/CodeGen/RISCV/float-fcmp.ll @@ -3,6 +3,10 @@ ; RUN: -target-abi=ilp32f | FileCheck -check-prefix=CHECKIF %s ; RUN: llc -mtriple=riscv64 -mattr=+f -verify-machineinstrs < %s \ ; RUN: -target-abi=lp64f | FileCheck -check-prefix=CHECKIF %s +; RUN: llc -mtriple=riscv32 -mattr=+zfinx -verify-machineinstrs < %s \ +; RUN: -target-abi=ilp32 | FileCheck -check-prefix=CHECKIZFINX %s +; RUN: llc -mtriple=riscv64 -mattr=+zfinx -verify-machineinstrs < %s \ +; RUN: -target-abi=lp64 | FileCheck -check-prefix=CHECKIZFINX %s ; RUN: llc -mtriple=riscv32 -verify-machineinstrs < %s \ ; RUN: | FileCheck -check-prefix=RV32I %s ; RUN: llc -mtriple=riscv64 -verify-machineinstrs < %s \ @@ -14,6 +18,11 @@ ; CHECKIF-NEXT: li a0, 0 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcmp_false: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: li a0, 0 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcmp_false: ; RV32I: # %bb.0: ; RV32I-NEXT: li a0, 0 @@ -34,6 +43,11 @@ ; CHECKIF-NEXT: feq.s a0, fa0, fa1 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcmp_oeq: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: feq.s a0, a0, a1 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcmp_oeq: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -64,6 +78,11 @@ ; CHECKIF-NEXT: flt.s a0, fa1, fa0 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcmp_ogt: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: flt.s a0, a1, a0 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcmp_ogt: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -94,6 +113,11 @@ ; CHECKIF-NEXT: fle.s a0, fa1, fa0 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcmp_oge: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fle.s a0, a1, a0 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcmp_oge: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -126,6 +150,11 @@ ; CHECKIF-NEXT: flt.s a0, fa0, fa1 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcmp_olt: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: flt.s a0, a0, a1 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcmp_olt: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -156,6 +185,11 @@ ; CHECKIF-NEXT: fle.s a0, fa0, fa1 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcmp_ole: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fle.s a0, a0, a1 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcmp_ole: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -188,6 +222,13 @@ ; CHECKIF-NEXT: or a0, a1, a0 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcmp_one: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: flt.s a2, a0, a1 +; CHECKIZFINX-NEXT: flt.s a0, a1, a0 +; CHECKIZFINX-NEXT: or a0, a0, a2 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcmp_one: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -246,6 +287,13 @@ ; CHECKIF-NEXT: and a0, a1, a0 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcmp_ord: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: feq.s a1, a1, a1 +; CHECKIZFINX-NEXT: feq.s a0, a0, a0 +; CHECKIZFINX-NEXT: and a0, a0, a1 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcmp_ord: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -279,6 +327,14 @@ ; CHECKIF-NEXT: xori a0, a0, 1 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcmp_ueq: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: flt.s a2, a0, a1 +; CHECKIZFINX-NEXT: flt.s a0, a1, a0 +; CHECKIZFINX-NEXT: or a0, a0, a2 +; CHECKIZFINX-NEXT: xori a0, a0, 1 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcmp_ueq: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -336,6 +392,12 @@ ; CHECKIF-NEXT: xori a0, a0, 1 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcmp_ugt: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fle.s a0, a0, a1 +; CHECKIZFINX-NEXT: xori a0, a0, 1 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcmp_ugt: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -367,6 +429,12 @@ ; CHECKIF-NEXT: xori a0, a0, 1 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcmp_uge: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: flt.s a0, a0, a1 +; CHECKIZFINX-NEXT: xori a0, a0, 1 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcmp_uge: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -400,6 +468,12 @@ ; CHECKIF-NEXT: xori a0, a0, 1 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcmp_ult: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fle.s a0, a1, a0 +; CHECKIZFINX-NEXT: xori a0, a0, 1 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcmp_ult: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -431,6 +505,12 @@ ; CHECKIF-NEXT: xori a0, a0, 1 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcmp_ule: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: flt.s a0, a1, a0 +; CHECKIZFINX-NEXT: xori a0, a0, 1 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcmp_ule: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -462,6 +542,12 @@ ; CHECKIF-NEXT: xori a0, a0, 1 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcmp_une: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: feq.s a0, a0, a1 +; CHECKIZFINX-NEXT: xori a0, a0, 1 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcmp_une: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -495,6 +581,14 @@ ; CHECKIF-NEXT: xori a0, a0, 1 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcmp_uno: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: feq.s a1, a1, a1 +; CHECKIZFINX-NEXT: feq.s a0, a0, a0 +; CHECKIZFINX-NEXT: and a0, a0, a1 +; CHECKIZFINX-NEXT: xori a0, a0, 1 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcmp_uno: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -525,6 +619,11 @@ ; CHECKIF-NEXT: li a0, 1 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fcmp_true: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: li a0, 1 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fcmp_true: ; RV32I: # %bb.0: ; RV32I-NEXT: li a0, 1 diff --git a/llvm/test/CodeGen/RISCV/float-frem.ll b/llvm/test/CodeGen/RISCV/float-frem.ll --- a/llvm/test/CodeGen/RISCV/float-frem.ll +++ b/llvm/test/CodeGen/RISCV/float-frem.ll @@ -3,6 +3,10 @@ ; RUN: | FileCheck -check-prefix=RV32IF %s ; RUN: llc -mtriple=riscv64 -mattr=+f -verify-machineinstrs < %s \ ; RUN: | FileCheck -check-prefix=RV64IF %s +; RUN: llc -mtriple=riscv32 -mattr=+zfinx -verify-machineinstrs < %s \ +; RUN: | FileCheck -check-prefix=RV32IZFINX %s +; RUN: llc -mtriple=riscv64 -mattr=+zfinx -verify-machineinstrs < %s \ +; RUN: | FileCheck -check-prefix=RV64IZFINX %s ; RUN: llc -mtriple=riscv32 -verify-machineinstrs < %s \ ; RUN: | FileCheck -check-prefix=RV32I %s ; RUN: llc -mtriple=riscv64 -verify-machineinstrs < %s \ @@ -27,6 +31,24 @@ ; RV64IF-NEXT: addi sp, sp, 16 ; RV64IF-NEXT: ret ; +; RV32IZFINX-LABEL: frem_f32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call fmodf@plt +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: frem_f32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: addi sp, sp, -16 +; RV64IZFINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: call fmodf@plt +; RV64IZFINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINX-NEXT: addi sp, sp, 16 +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: frem_f32: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 diff --git a/llvm/test/CodeGen/RISCV/float-imm.ll b/llvm/test/CodeGen/RISCV/float-imm.ll --- a/llvm/test/CodeGen/RISCV/float-imm.ll +++ b/llvm/test/CodeGen/RISCV/float-imm.ll @@ -3,6 +3,10 @@ ; RUN: -target-abi=ilp32f | FileCheck %s ; RUN: llc -mtriple=riscv64 -mattr=+f -verify-machineinstrs < %s \ ; RUN: -target-abi=lp64f | FileCheck %s +; RUN: llc -mtriple=riscv32 -mattr=+zfinx -verify-machineinstrs < %s \ +; RUN: -target-abi=ilp32 | FileCheck --check-prefixes=CHECKZFINX,RV32ZFINX %s +; RUN: llc -mtriple=riscv64 -mattr=+zfinx -verify-machineinstrs < %s \ +; RUN: -target-abi=lp64 | FileCheck --check-prefixes=CHECKZFINX,RV64ZFINX %s ; TODO: constant pool shouldn't be necessary for RV64IF. define float @float_imm() nounwind { @@ -11,6 +15,19 @@ ; CHECK-NEXT: lui a0, %hi(.LCPI0_0) ; CHECK-NEXT: flw fa0, %lo(.LCPI0_0)(a0) ; CHECK-NEXT: ret +; +; RV32ZFINX-LABEL: float_imm: +; RV32ZFINX: # %bb.0: +; RV32ZFINX-NEXT: lui a0, 263313 +; RV32ZFINX-NEXT: addi a0, a0, -37 +; RV32ZFINX-NEXT: ret +; +; RV64ZFINX-LABEL: float_imm: +; RV64ZFINX: # %bb.0: +; RV64ZFINX-NEXT: lui a0, %hi(.LCPI0_0) +; RV64ZFINX-NEXT: addi a0, a0, %lo(.LCPI0_0) +; RV64ZFINX-NEXT: lw a0, 0(a0) +; RV64ZFINX-NEXT: ret ret float 3.14159274101257324218750 } @@ -21,6 +38,14 @@ ; CHECK-NEXT: flw ft0, %lo(.LCPI1_0)(a0) ; CHECK-NEXT: fadd.s fa0, fa0, ft0 ; CHECK-NEXT: ret +; +; CHECKZFINX-LABEL: float_imm_op: +; CHECKZFINX: # %bb.0: +; CHECKZFINX-NEXT: lui a1, %hi(.LCPI1_0) +; CHECKZFINX-NEXT: addi a1, a1, %lo(.LCPI1_0) +; CHECKZFINX-NEXT: lw a1, 0(a1) +; CHECKZFINX-NEXT: fadd.s a0, a0, a1 +; CHECKZFINX-NEXT: ret %1 = fadd float %a, 1.0 ret float %1 } diff --git a/llvm/test/CodeGen/RISCV/float-intrinsics-strict.ll b/llvm/test/CodeGen/RISCV/float-intrinsics-strict.ll --- a/llvm/test/CodeGen/RISCV/float-intrinsics-strict.ll +++ b/llvm/test/CodeGen/RISCV/float-intrinsics-strict.ll @@ -5,6 +5,12 @@ ; RUN: sed 's/iXLen/i64/g' %s | llc -mtriple=riscv64 -mattr=+f \ ; RUN: -verify-machineinstrs -disable-strictnode-mutation -target-abi=lp64f \ ; RUN: | FileCheck -check-prefixes=CHECKIF,RV64IF %s +; RUN: sed 's/iXLen/i32/g' %s | llc -mtriple=riscv32 -mattr=+zfinx \ +; RUN: -verify-machineinstrs -disable-strictnode-mutation -target-abi=ilp32 \ +; RUN: | FileCheck -check-prefixes=CHECKIZFINX,RV32IZFINX %s +; RUN: sed 's/iXLen/i64/g' %s | llc -mtriple=riscv64 -mattr=+zfinx \ +; RUN: -verify-machineinstrs -disable-strictnode-mutation -target-abi=lp64 \ +; RUN: | FileCheck -check-prefixes=CHECKIZFINX,RV64IZFINX %s ; RUN: sed 's/iXLen/i32/g' %s | llc -mtriple=riscv32 \ ; RUN: -verify-machineinstrs -disable-strictnode-mutation \ ; RUN: | FileCheck -check-prefix=RV32I %s @@ -20,6 +26,11 @@ ; CHECKIF-NEXT: fsqrt.s fa0, fa0 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: sqrt_f32: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fsqrt.s a0, a0 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: sqrt_f32: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -63,6 +74,25 @@ ; RV64IF-NEXT: addi sp, sp, 16 ; RV64IF-NEXT: ret ; +; RV32IZFINX-LABEL: powi_f32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call __powisf2@plt +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: powi_f32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: addi sp, sp, -16 +; RV64IZFINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: sext.w a1, a1 +; RV64IZFINX-NEXT: call __powisf2@plt +; RV64IZFINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINX-NEXT: addi sp, sp, 16 +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: powi_f32: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -106,6 +136,24 @@ ; RV64IF-NEXT: addi sp, sp, 16 ; RV64IF-NEXT: ret ; +; RV32IZFINX-LABEL: sin_f32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call sinf@plt +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: sin_f32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: addi sp, sp, -16 +; RV64IZFINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: call sinf@plt +; RV64IZFINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINX-NEXT: addi sp, sp, 16 +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: sin_f32: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -148,6 +196,24 @@ ; RV64IF-NEXT: addi sp, sp, 16 ; RV64IF-NEXT: ret ; +; RV32IZFINX-LABEL: cos_f32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call cosf@plt +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: cos_f32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: addi sp, sp, -16 +; RV64IZFINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: call cosf@plt +; RV64IZFINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINX-NEXT: addi sp, sp, 16 +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: cos_f32: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -207,6 +273,42 @@ ; RV64IF-NEXT: addi sp, sp, 16 ; RV64IF-NEXT: ret ; +; RV32IZFINX-LABEL: sincos_f32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: sw s0, 8(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: sw s1, 4(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: mv s0, a0 +; RV32IZFINX-NEXT: call sinf@plt +; RV32IZFINX-NEXT: mv s1, a0 +; RV32IZFINX-NEXT: mv a0, s0 +; RV32IZFINX-NEXT: call cosf@plt +; RV32IZFINX-NEXT: fadd.s a0, s1, a0 +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: lw s0, 8(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: lw s1, 4(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: sincos_f32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: addi sp, sp, -32 +; RV64IZFINX-NEXT: sd ra, 24(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: sd s0, 16(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: sd s1, 8(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: mv s0, a0 +; RV64IZFINX-NEXT: call sinf@plt +; RV64IZFINX-NEXT: mv s1, a0 +; RV64IZFINX-NEXT: mv a0, s0 +; RV64IZFINX-NEXT: call cosf@plt +; RV64IZFINX-NEXT: fadd.s a0, s1, a0 +; RV64IZFINX-NEXT: ld ra, 24(sp) # 8-byte Folded Reload +; RV64IZFINX-NEXT: ld s0, 16(sp) # 8-byte Folded Reload +; RV64IZFINX-NEXT: ld s1, 8(sp) # 8-byte Folded Reload +; RV64IZFINX-NEXT: addi sp, sp, 32 +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: sincos_f32: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -273,6 +375,24 @@ ; RV64IF-NEXT: addi sp, sp, 16 ; RV64IF-NEXT: ret ; +; RV32IZFINX-LABEL: pow_f32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call powf@plt +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: pow_f32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: addi sp, sp, -16 +; RV64IZFINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: call powf@plt +; RV64IZFINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINX-NEXT: addi sp, sp, 16 +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: pow_f32: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -315,6 +435,24 @@ ; RV64IF-NEXT: addi sp, sp, 16 ; RV64IF-NEXT: ret ; +; RV32IZFINX-LABEL: exp_f32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call expf@plt +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: exp_f32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: addi sp, sp, -16 +; RV64IZFINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: call expf@plt +; RV64IZFINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINX-NEXT: addi sp, sp, 16 +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: exp_f32: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -357,6 +495,24 @@ ; RV64IF-NEXT: addi sp, sp, 16 ; RV64IF-NEXT: ret ; +; RV32IZFINX-LABEL: exp2_f32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call exp2f@plt +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: exp2_f32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: addi sp, sp, -16 +; RV64IZFINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: call exp2f@plt +; RV64IZFINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINX-NEXT: addi sp, sp, 16 +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: exp2_f32: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -399,6 +555,24 @@ ; RV64IF-NEXT: addi sp, sp, 16 ; RV64IF-NEXT: ret ; +; RV32IZFINX-LABEL: log_f32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call logf@plt +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: log_f32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: addi sp, sp, -16 +; RV64IZFINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: call logf@plt +; RV64IZFINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINX-NEXT: addi sp, sp, 16 +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: log_f32: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -441,6 +615,24 @@ ; RV64IF-NEXT: addi sp, sp, 16 ; RV64IF-NEXT: ret ; +; RV32IZFINX-LABEL: log10_f32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call log10f@plt +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: log10_f32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: addi sp, sp, -16 +; RV64IZFINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: call log10f@plt +; RV64IZFINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINX-NEXT: addi sp, sp, 16 +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: log10_f32: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -483,6 +675,24 @@ ; RV64IF-NEXT: addi sp, sp, 16 ; RV64IF-NEXT: ret ; +; RV32IZFINX-LABEL: log2_f32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call log2f@plt +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: log2_f32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: addi sp, sp, -16 +; RV64IZFINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: call log2f@plt +; RV64IZFINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINX-NEXT: addi sp, sp, 16 +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: log2_f32: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -512,6 +722,11 @@ ; CHECKIF-NEXT: fmadd.s fa0, fa0, fa1, fa2 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fma_f32: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fmadd.s a0, a0, a1, a2 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fma_f32: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -541,6 +756,11 @@ ; CHECKIF-NEXT: fmadd.s fa0, fa0, fa1, fa2 ; CHECKIF-NEXT: ret ; +; CHECKIZFINX-LABEL: fmuladd_f32: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fmadd.s a0, a0, a1, a2 +; CHECKIZFINX-NEXT: ret +; ; RV32I-LABEL: fmuladd_f32: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -593,6 +813,24 @@ ; RV64IF-NEXT: addi sp, sp, 16 ; RV64IF-NEXT: ret ; +; RV32IZFINX-LABEL: minnum_f32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call fminf@plt +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: minnum_f32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: addi sp, sp, -16 +; RV64IZFINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: call fminf@plt +; RV64IZFINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINX-NEXT: addi sp, sp, 16 +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: minnum_f32: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -635,6 +873,24 @@ ; RV64IF-NEXT: addi sp, sp, 16 ; RV64IF-NEXT: ret ; +; RV32IZFINX-LABEL: maxnum_f32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call fmaxf@plt +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: maxnum_f32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: addi sp, sp, -16 +; RV64IZFINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: call fmaxf@plt +; RV64IZFINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINX-NEXT: addi sp, sp, 16 +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: maxnum_f32: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -694,6 +950,24 @@ ; RV64IF-NEXT: addi sp, sp, 16 ; RV64IF-NEXT: ret ; +; RV32IZFINX-LABEL: floor_f32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call floorf@plt +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: floor_f32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: addi sp, sp, -16 +; RV64IZFINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: call floorf@plt +; RV64IZFINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINX-NEXT: addi sp, sp, 16 +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: floor_f32: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -736,6 +1010,24 @@ ; RV64IF-NEXT: addi sp, sp, 16 ; RV64IF-NEXT: ret ; +; RV32IZFINX-LABEL: ceil_f32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call ceilf@plt +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: ceil_f32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: addi sp, sp, -16 +; RV64IZFINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: call ceilf@plt +; RV64IZFINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINX-NEXT: addi sp, sp, 16 +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: ceil_f32: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -778,6 +1070,24 @@ ; RV64IF-NEXT: addi sp, sp, 16 ; RV64IF-NEXT: ret ; +; RV32IZFINX-LABEL: trunc_f32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call truncf@plt +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: trunc_f32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: addi sp, sp, -16 +; RV64IZFINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: call truncf@plt +; RV64IZFINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINX-NEXT: addi sp, sp, 16 +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: trunc_f32: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -820,6 +1130,24 @@ ; RV64IF-NEXT: addi sp, sp, 16 ; RV64IF-NEXT: ret ; +; RV32IZFINX-LABEL: rint_f32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call rintf@plt +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: rint_f32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: addi sp, sp, -16 +; RV64IZFINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: call rintf@plt +; RV64IZFINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINX-NEXT: addi sp, sp, 16 +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: rint_f32: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -862,6 +1190,24 @@ ; RV64IF-NEXT: addi sp, sp, 16 ; RV64IF-NEXT: ret ; +; RV32IZFINX-LABEL: nearbyint_f32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call nearbyintf@plt +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: nearbyint_f32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: addi sp, sp, -16 +; RV64IZFINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: call nearbyintf@plt +; RV64IZFINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINX-NEXT: addi sp, sp, 16 +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: nearbyint_f32: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -904,6 +1250,24 @@ ; RV64IF-NEXT: addi sp, sp, 16 ; RV64IF-NEXT: ret ; +; RV32IZFINX-LABEL: round_f32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call roundf@plt +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: round_f32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: addi sp, sp, -16 +; RV64IZFINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: call roundf@plt +; RV64IZFINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINX-NEXT: addi sp, sp, 16 +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: round_f32: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -946,6 +1310,24 @@ ; RV64IF-NEXT: addi sp, sp, 16 ; RV64IF-NEXT: ret ; +; RV32IZFINX-LABEL: roundeven_f32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call roundevenf@plt +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: roundeven_f32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: addi sp, sp, -16 +; RV64IZFINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: call roundevenf@plt +; RV64IZFINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINX-NEXT: addi sp, sp, 16 +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: roundeven_f32: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -980,6 +1362,16 @@ ; RV64IF-NEXT: fcvt.l.s a0, fa0 ; RV64IF-NEXT: ret ; +; RV32IZFINX-LABEL: lrint_f32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: fcvt.w.s a0, a0 +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: lrint_f32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fcvt.l.s a0, a0 +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: lrint_f32: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -1014,6 +1406,16 @@ ; RV64IF-NEXT: fcvt.l.s a0, fa0, rmm ; RV64IF-NEXT: ret ; +; RV32IZFINX-LABEL: lround_f32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: fcvt.w.s a0, a0, rmm +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: lround_f32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fcvt.l.s a0, a0, rmm +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: lround_f32: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -1052,6 +1454,20 @@ ; RV64IF-NEXT: fcvt.l.s a0, fa0 ; RV64IF-NEXT: ret ; +; RV32IZFINX-LABEL: llrint_f32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call llrintf@plt +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: llrint_f32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fcvt.l.s a0, a0 +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: llrint_f32: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -1090,6 +1506,20 @@ ; RV64IF-NEXT: fcvt.l.s a0, fa0, rmm ; RV64IF-NEXT: ret ; +; RV32IZFINX-LABEL: llround_f32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call llroundf@plt +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: llround_f32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fcvt.l.s a0, a0, rmm +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: llround_f32: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 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 @@ -2,12 +2,18 @@ ; RUN: sed 's/iXLen/i32/g' %s | llc -mtriple=riscv32 -mattr=+f \ ; RUN: -verify-machineinstrs -target-abi=ilp32f \ ; RUN: | FileCheck -check-prefix=RV32IF %s +; RUN: sed 's/iXLen/i32/g' %s | llc -mtriple=riscv32 -mattr=+zfinx \ +; RUN: -verify-machineinstrs -target-abi=ilp32 \ +; RUN: | FileCheck -check-prefix=RV32IZFINX %s ; RUN: sed 's/iXLen/i32/g' %s | llc -mtriple=riscv32 -mattr=+d \ ; RUN: -verify-machineinstrs -target-abi=ilp32f \ ; RUN: | FileCheck -check-prefix=RV32IF %s ; RUN: sed 's/iXLen/i64/g' %s | llc -mtriple=riscv64 -mattr=+f \ ; RUN: -verify-machineinstrs -target-abi=lp64f \ ; RUN: | FileCheck -check-prefix=RV64IF %s +; RUN: sed 's/iXLen/i64/g' %s | llc -mtriple=riscv64 -mattr=+zfinx \ +; RUN: -verify-machineinstrs -target-abi=lp64 \ +; RUN: | FileCheck -check-prefix=RV64IZFINX %s ; RUN: sed 's/iXLen/i64/g' %s | llc -mtriple=riscv64 -mattr=+d \ ; RUN: -verify-machineinstrs -target-abi=lp64d \ ; RUN: | FileCheck -check-prefix=RV64IF %s @@ -24,11 +30,21 @@ ; RV32IF-NEXT: fsqrt.s fa0, fa0 ; RV32IF-NEXT: ret ; +; RV32IZFINX-LABEL: sqrt_f32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: fsqrt.s a0, a0 +; RV32IZFINX-NEXT: ret +; ; RV64IF-LABEL: sqrt_f32: ; RV64IF: # %bb.0: ; RV64IF-NEXT: fsqrt.s fa0, fa0 ; RV64IF-NEXT: ret ; +; RV64IZFINX-LABEL: sqrt_f32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fsqrt.s a0, a0 +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: sqrt_f32: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -57,6 +73,15 @@ ; RV32IF: # %bb.0: ; RV32IF-NEXT: tail __powisf2@plt ; +; RV32IZFINX-LABEL: powi_f32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call __powisf2@plt +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; ; RV64IF-LABEL: powi_f32: ; RV64IF: # %bb.0: ; RV64IF-NEXT: addi sp, sp, -16 @@ -67,6 +92,16 @@ ; RV64IF-NEXT: addi sp, sp, 16 ; RV64IF-NEXT: ret ; +; RV64IZFINX-LABEL: powi_f32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: addi sp, sp, -16 +; RV64IZFINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: sext.w a1, a1 +; RV64IZFINX-NEXT: call __powisf2@plt +; RV64IZFINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINX-NEXT: addi sp, sp, 16 +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: powi_f32: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -96,10 +131,28 @@ ; RV32IF: # %bb.0: ; RV32IF-NEXT: tail sinf@plt ; +; RV32IZFINX-LABEL: sin_f32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call sinf@plt +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; ; RV64IF-LABEL: sin_f32: ; RV64IF: # %bb.0: ; RV64IF-NEXT: tail sinf@plt ; +; RV64IZFINX-LABEL: sin_f32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: addi sp, sp, -16 +; RV64IZFINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: call sinf@plt +; RV64IZFINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINX-NEXT: addi sp, sp, 16 +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: sin_f32: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -128,10 +181,28 @@ ; RV32IF: # %bb.0: ; RV32IF-NEXT: tail cosf@plt ; +; RV32IZFINX-LABEL: cos_f32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call cosf@plt +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; ; RV64IF-LABEL: cos_f32: ; RV64IF: # %bb.0: ; RV64IF-NEXT: tail cosf@plt ; +; RV64IZFINX-LABEL: cos_f32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: addi sp, sp, -16 +; RV64IZFINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: call cosf@plt +; RV64IZFINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINX-NEXT: addi sp, sp, 16 +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: cos_f32: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -173,6 +244,42 @@ ; RV32IF-NEXT: addi sp, sp, 16 ; RV32IF-NEXT: ret ; +; RV32IZFINX-LABEL: sincos_f32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: sw s0, 8(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: sw s1, 4(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: mv s0, a0 +; RV32IZFINX-NEXT: call sinf@plt +; RV32IZFINX-NEXT: mv s1, a0 +; RV32IZFINX-NEXT: mv a0, s0 +; RV32IZFINX-NEXT: call cosf@plt +; RV32IZFINX-NEXT: fadd.s a0, s1, a0 +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: lw s0, 8(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: lw s1, 4(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: sincos_f32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: addi sp, sp, -32 +; RV64IZFINX-NEXT: sd ra, 24(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: sd s0, 16(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: sd s1, 8(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: mv s0, a0 +; RV64IZFINX-NEXT: call sinf@plt +; RV64IZFINX-NEXT: mv s1, a0 +; RV64IZFINX-NEXT: mv a0, s0 +; RV64IZFINX-NEXT: call cosf@plt +; RV64IZFINX-NEXT: fadd.s a0, s1, a0 +; RV64IZFINX-NEXT: ld ra, 24(sp) # 8-byte Folded Reload +; RV64IZFINX-NEXT: ld s0, 16(sp) # 8-byte Folded Reload +; RV64IZFINX-NEXT: ld s1, 8(sp) # 8-byte Folded Reload +; RV64IZFINX-NEXT: addi sp, sp, 32 +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: sincos_f32: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -225,10 +332,28 @@ ; RV32IF: # %bb.0: ; RV32IF-NEXT: tail powf@plt ; +; RV32IZFINX-LABEL: pow_f32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call powf@plt +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; ; RV64IF-LABEL: pow_f32: ; RV64IF: # %bb.0: ; RV64IF-NEXT: tail powf@plt ; +; RV64IZFINX-LABEL: pow_f32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: addi sp, sp, -16 +; RV64IZFINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: call powf@plt +; RV64IZFINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINX-NEXT: addi sp, sp, 16 +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: pow_f32: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -257,10 +382,28 @@ ; RV32IF: # %bb.0: ; RV32IF-NEXT: tail expf@plt ; +; RV32IZFINX-LABEL: exp_f32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call expf@plt +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; ; RV64IF-LABEL: exp_f32: ; RV64IF: # %bb.0: ; RV64IF-NEXT: tail expf@plt ; +; RV64IZFINX-LABEL: exp_f32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: addi sp, sp, -16 +; RV64IZFINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: call expf@plt +; RV64IZFINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINX-NEXT: addi sp, sp, 16 +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: exp_f32: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -289,10 +432,28 @@ ; RV32IF: # %bb.0: ; RV32IF-NEXT: tail exp2f@plt ; +; RV32IZFINX-LABEL: exp2_f32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call exp2f@plt +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; ; RV64IF-LABEL: exp2_f32: ; RV64IF: # %bb.0: ; RV64IF-NEXT: tail exp2f@plt ; +; RV64IZFINX-LABEL: exp2_f32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: addi sp, sp, -16 +; RV64IZFINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: call exp2f@plt +; RV64IZFINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINX-NEXT: addi sp, sp, 16 +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: exp2_f32: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -321,10 +482,28 @@ ; RV32IF: # %bb.0: ; RV32IF-NEXT: tail logf@plt ; +; RV32IZFINX-LABEL: log_f32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call logf@plt +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; ; RV64IF-LABEL: log_f32: ; RV64IF: # %bb.0: ; RV64IF-NEXT: tail logf@plt ; +; RV64IZFINX-LABEL: log_f32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: addi sp, sp, -16 +; RV64IZFINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: call logf@plt +; RV64IZFINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINX-NEXT: addi sp, sp, 16 +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: log_f32: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -353,10 +532,28 @@ ; RV32IF: # %bb.0: ; RV32IF-NEXT: tail log10f@plt ; +; RV32IZFINX-LABEL: log10_f32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call log10f@plt +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; ; RV64IF-LABEL: log10_f32: ; RV64IF: # %bb.0: ; RV64IF-NEXT: tail log10f@plt ; +; RV64IZFINX-LABEL: log10_f32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: addi sp, sp, -16 +; RV64IZFINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: call log10f@plt +; RV64IZFINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINX-NEXT: addi sp, sp, 16 +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: log10_f32: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -385,10 +582,28 @@ ; RV32IF: # %bb.0: ; RV32IF-NEXT: tail log2f@plt ; +; RV32IZFINX-LABEL: log2_f32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call log2f@plt +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; ; RV64IF-LABEL: log2_f32: ; RV64IF: # %bb.0: ; RV64IF-NEXT: tail log2f@plt ; +; RV64IZFINX-LABEL: log2_f32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: addi sp, sp, -16 +; RV64IZFINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: call log2f@plt +; RV64IZFINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINX-NEXT: addi sp, sp, 16 +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: log2_f32: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -418,11 +633,21 @@ ; RV32IF-NEXT: fmadd.s fa0, fa0, fa1, fa2 ; RV32IF-NEXT: ret ; +; RV32IZFINX-LABEL: fma_f32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: fmadd.s a0, a0, a1, a2 +; RV32IZFINX-NEXT: ret +; ; RV64IF-LABEL: fma_f32: ; RV64IF: # %bb.0: ; RV64IF-NEXT: fmadd.s fa0, fa0, fa1, fa2 ; RV64IF-NEXT: ret ; +; RV64IZFINX-LABEL: fma_f32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fmadd.s a0, a0, a1, a2 +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: fma_f32: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -452,11 +677,21 @@ ; RV32IF-NEXT: fmadd.s fa0, fa0, fa1, fa2 ; RV32IF-NEXT: ret ; +; RV32IZFINX-LABEL: fmuladd_f32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: fmadd.s a0, a0, a1, a2 +; RV32IZFINX-NEXT: ret +; ; RV64IF-LABEL: fmuladd_f32: ; RV64IF: # %bb.0: ; RV64IF-NEXT: fmadd.s fa0, fa0, fa1, fa2 ; RV64IF-NEXT: ret ; +; RV64IZFINX-LABEL: fmuladd_f32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fmadd.s a0, a0, a1, a2 +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: fmuladd_f32: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -496,11 +731,23 @@ ; RV32IF-NEXT: fabs.s fa0, fa0 ; RV32IF-NEXT: ret ; +; RV32IZFINX-LABEL: fabs_f32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: slli a0, a0, 1 +; RV32IZFINX-NEXT: srli a0, a0, 1 +; RV32IZFINX-NEXT: ret +; ; RV64IF-LABEL: fabs_f32: ; RV64IF: # %bb.0: ; RV64IF-NEXT: fabs.s fa0, fa0 ; RV64IF-NEXT: ret ; +; RV64IZFINX-LABEL: fabs_f32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: slli a0, a0, 33 +; RV64IZFINX-NEXT: srli a0, a0, 33 +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: fabs_f32: ; RV32I: # %bb.0: ; RV32I-NEXT: slli a0, a0, 1 @@ -524,11 +771,21 @@ ; RV32IF-NEXT: fmin.s fa0, fa0, fa1 ; RV32IF-NEXT: ret ; +; RV32IZFINX-LABEL: minnum_f32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: fmin.s a0, a0, a1 +; RV32IZFINX-NEXT: ret +; ; RV64IF-LABEL: minnum_f32: ; RV64IF: # %bb.0: ; RV64IF-NEXT: fmin.s fa0, fa0, fa1 ; RV64IF-NEXT: ret ; +; RV64IZFINX-LABEL: minnum_f32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fmin.s a0, a0, a1 +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: minnum_f32: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -558,11 +815,21 @@ ; RV32IF-NEXT: fmax.s fa0, fa0, fa1 ; RV32IF-NEXT: ret ; +; RV32IZFINX-LABEL: maxnum_f32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: fmax.s a0, a0, a1 +; RV32IZFINX-NEXT: ret +; ; RV64IF-LABEL: maxnum_f32: ; RV64IF: # %bb.0: ; RV64IF-NEXT: fmax.s fa0, fa0, fa1 ; RV64IF-NEXT: ret ; +; RV64IZFINX-LABEL: maxnum_f32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fmax.s a0, a0, a1 +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: maxnum_f32: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -609,11 +876,21 @@ ; RV32IF-NEXT: fsgnj.s fa0, fa0, fa1 ; RV32IF-NEXT: ret ; +; RV32IZFINX-LABEL: copysign_f32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: fsgnj.s a0, a0, a1 +; RV32IZFINX-NEXT: ret +; ; RV64IF-LABEL: copysign_f32: ; RV64IF: # %bb.0: ; RV64IF-NEXT: fsgnj.s fa0, fa0, fa1 ; RV64IF-NEXT: ret ; +; RV64IZFINX-LABEL: copysign_f32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fsgnj.s a0, a0, a1 +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: copysign_f32: ; RV32I: # %bb.0: ; RV32I-NEXT: lui a2, 524288 @@ -642,10 +919,28 @@ ; RV32IF: # %bb.0: ; RV32IF-NEXT: tail floorf@plt ; +; RV32IZFINX-LABEL: floor_f32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call floorf@plt +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; ; RV64IF-LABEL: floor_f32: ; RV64IF: # %bb.0: ; RV64IF-NEXT: tail floorf@plt ; +; RV64IZFINX-LABEL: floor_f32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: addi sp, sp, -16 +; RV64IZFINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: call floorf@plt +; RV64IZFINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINX-NEXT: addi sp, sp, 16 +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: floor_f32: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -674,10 +969,28 @@ ; RV32IF: # %bb.0: ; RV32IF-NEXT: tail ceilf@plt ; +; RV32IZFINX-LABEL: ceil_f32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call ceilf@plt +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; ; RV64IF-LABEL: ceil_f32: ; RV64IF: # %bb.0: ; RV64IF-NEXT: tail ceilf@plt ; +; RV64IZFINX-LABEL: ceil_f32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: addi sp, sp, -16 +; RV64IZFINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: call ceilf@plt +; RV64IZFINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINX-NEXT: addi sp, sp, 16 +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: ceil_f32: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -706,10 +1019,28 @@ ; RV32IF: # %bb.0: ; RV32IF-NEXT: tail truncf@plt ; +; RV32IZFINX-LABEL: trunc_f32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call truncf@plt +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; ; RV64IF-LABEL: trunc_f32: ; RV64IF: # %bb.0: ; RV64IF-NEXT: tail truncf@plt ; +; RV64IZFINX-LABEL: trunc_f32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: addi sp, sp, -16 +; RV64IZFINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: call truncf@plt +; RV64IZFINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINX-NEXT: addi sp, sp, 16 +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: trunc_f32: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -738,10 +1069,28 @@ ; RV32IF: # %bb.0: ; RV32IF-NEXT: tail rintf@plt ; +; RV32IZFINX-LABEL: rint_f32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call rintf@plt +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; ; RV64IF-LABEL: rint_f32: ; RV64IF: # %bb.0: ; RV64IF-NEXT: tail rintf@plt ; +; RV64IZFINX-LABEL: rint_f32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: addi sp, sp, -16 +; RV64IZFINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: call rintf@plt +; RV64IZFINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINX-NEXT: addi sp, sp, 16 +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: rint_f32: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -770,10 +1119,28 @@ ; RV32IF: # %bb.0: ; RV32IF-NEXT: tail nearbyintf@plt ; +; RV32IZFINX-LABEL: nearbyint_f32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call nearbyintf@plt +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; ; RV64IF-LABEL: nearbyint_f32: ; RV64IF: # %bb.0: ; RV64IF-NEXT: tail nearbyintf@plt ; +; RV64IZFINX-LABEL: nearbyint_f32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: addi sp, sp, -16 +; RV64IZFINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: call nearbyintf@plt +; RV64IZFINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINX-NEXT: addi sp, sp, 16 +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: nearbyint_f32: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -802,10 +1169,28 @@ ; RV32IF: # %bb.0: ; RV32IF-NEXT: tail roundf@plt ; +; RV32IZFINX-LABEL: round_f32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call roundf@plt +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; ; RV64IF-LABEL: round_f32: ; RV64IF: # %bb.0: ; RV64IF-NEXT: tail roundf@plt ; +; RV64IZFINX-LABEL: round_f32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: addi sp, sp, -16 +; RV64IZFINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: call roundf@plt +; RV64IZFINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINX-NEXT: addi sp, sp, 16 +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: round_f32: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -834,10 +1219,28 @@ ; RV32IF: # %bb.0: ; RV32IF-NEXT: tail roundevenf@plt ; +; RV32IZFINX-LABEL: roundeven_f32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call roundevenf@plt +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; ; RV64IF-LABEL: roundeven_f32: ; RV64IF: # %bb.0: ; RV64IF-NEXT: tail roundevenf@plt ; +; RV64IZFINX-LABEL: roundeven_f32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: addi sp, sp, -16 +; RV64IZFINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: call roundevenf@plt +; RV64IZFINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINX-NEXT: addi sp, sp, 16 +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: roundeven_f32: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -867,11 +1270,21 @@ ; RV32IF-NEXT: fcvt.w.s a0, fa0 ; RV32IF-NEXT: ret ; +; RV32IZFINX-LABEL: lrint_f32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: fcvt.w.s a0, a0 +; RV32IZFINX-NEXT: ret +; ; RV64IF-LABEL: lrint_f32: ; RV64IF: # %bb.0: ; RV64IF-NEXT: fcvt.l.s a0, fa0 ; RV64IF-NEXT: ret ; +; RV64IZFINX-LABEL: lrint_f32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fcvt.l.s a0, a0 +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: lrint_f32: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -901,11 +1314,21 @@ ; RV32IF-NEXT: fcvt.w.s a0, fa0, rmm ; RV32IF-NEXT: ret ; +; RV32IZFINX-LABEL: lround_f32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: fcvt.w.s a0, a0, rmm +; RV32IZFINX-NEXT: ret +; ; RV64IF-LABEL: lround_f32: ; RV64IF: # %bb.0: ; RV64IF-NEXT: fcvt.l.s a0, fa0, rmm ; RV64IF-NEXT: ret ; +; RV64IZFINX-LABEL: lround_f32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fcvt.l.s a0, a0, rmm +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: lround_f32: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -939,11 +1362,25 @@ ; RV32IF-NEXT: addi sp, sp, 16 ; RV32IF-NEXT: ret ; +; RV32IZFINX-LABEL: llrint_f32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call llrintf@plt +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; ; RV64IF-LABEL: llrint_f32: ; RV64IF: # %bb.0: ; RV64IF-NEXT: fcvt.l.s a0, fa0 ; RV64IF-NEXT: ret ; +; RV64IZFINX-LABEL: llrint_f32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fcvt.l.s a0, a0 +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: llrint_f32: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -977,11 +1414,25 @@ ; RV32IF-NEXT: addi sp, sp, 16 ; RV32IF-NEXT: ret ; +; RV32IZFINX-LABEL: llround_f32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call llroundf@plt +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; ; RV64IF-LABEL: llround_f32: ; RV64IF: # %bb.0: ; RV64IF-NEXT: fcvt.l.s a0, fa0, rmm ; RV64IF-NEXT: ret ; +; RV64IZFINX-LABEL: llround_f32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fcvt.l.s a0, a0, rmm +; RV64IZFINX-NEXT: ret +; ; RV32I-LABEL: llround_f32: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 diff --git a/llvm/test/CodeGen/RISCV/float-isnan.ll b/llvm/test/CodeGen/RISCV/float-isnan.ll --- a/llvm/test/CodeGen/RISCV/float-isnan.ll +++ b/llvm/test/CodeGen/RISCV/float-isnan.ll @@ -3,6 +3,10 @@ ; RUN: < %s | FileCheck %s ; RUN: llc -mtriple=riscv64 -mattr=+f -target-abi lp64f -verify-machineinstrs \ ; RUN: < %s | FileCheck %s +; RUN: llc -mtriple=riscv32 -mattr=+zfinx -target-abi ilp32 -verify-machineinstrs \ +; RUN: < %s | FileCheck --check-prefix=CHECKZFINX %s +; RUN: llc -mtriple=riscv64 -mattr=+zfinx -target-abi lp64 -verify-machineinstrs \ +; RUN: < %s | FileCheck --check-prefix=CHECKZFINX %s define zeroext i1 @float_is_nan(float %a) nounwind { ; CHECK-LABEL: float_is_nan: @@ -10,6 +14,12 @@ ; CHECK-NEXT: feq.s a0, fa0, fa0 ; CHECK-NEXT: xori a0, a0, 1 ; CHECK-NEXT: ret +; +; CHECKZFINX-LABEL: float_is_nan: +; CHECKZFINX: # %bb.0: +; CHECKZFINX-NEXT: feq.s a0, a0, a0 +; CHECKZFINX-NEXT: xori a0, a0, 1 +; CHECKZFINX-NEXT: ret %1 = fcmp uno float %a, 0.000000e+00 ret i1 %1 } @@ -19,6 +29,11 @@ ; CHECK: # %bb.0: ; CHECK-NEXT: feq.s a0, fa0, fa0 ; CHECK-NEXT: ret +; +; CHECKZFINX-LABEL: float_not_nan: +; CHECKZFINX: # %bb.0: +; CHECKZFINX-NEXT: feq.s a0, a0, a0 +; CHECKZFINX-NEXT: ret %1 = fcmp ord float %a, 0.000000e+00 ret i1 %1 } diff --git a/llvm/test/CodeGen/RISCV/float-mem.ll b/llvm/test/CodeGen/RISCV/float-mem.ll --- a/llvm/test/CodeGen/RISCV/float-mem.ll +++ b/llvm/test/CodeGen/RISCV/float-mem.ll @@ -3,6 +3,10 @@ ; RUN: -target-abi=ilp32f | FileCheck -check-prefixes=CHECKIF,RV32IF %s ; RUN: llc -mtriple=riscv64 -mattr=+f -verify-machineinstrs < %s \ ; RUN: -target-abi=lp64f | FileCheck -check-prefixes=CHECKIF,RV64IF %s +; RUN: llc -mtriple=riscv32 -mattr=+zfinx -verify-machineinstrs < %s \ +; RUN: -target-abi=ilp32 | FileCheck -check-prefixes=CHECKIZFINX,RV32IZFINX %s +; RUN: llc -mtriple=riscv64 -mattr=+zfinx -verify-machineinstrs < %s \ +; RUN: -target-abi=lp64 | FileCheck -check-prefixes=CHECKIZFINX,RV64IZFINX %s define dso_local float @flw(float *%a) nounwind { ; CHECKIF-LABEL: flw: @@ -11,6 +15,14 @@ ; CHECKIF-NEXT: flw ft1, 12(a0) ; CHECKIF-NEXT: fadd.s fa0, ft0, ft1 ; CHECKIF-NEXT: ret +; +; CHECKIZFINX-LABEL: flw: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: lw a1, 0(a0) +; CHECKIZFINX-NEXT: addi a0, a0, 12 +; CHECKIZFINX-NEXT: lw a0, 0(a0) +; CHECKIZFINX-NEXT: fadd.s a0, a1, a0 +; CHECKIZFINX-NEXT: ret %1 = load float, float* %a %2 = getelementptr float, float* %a, i32 3 %3 = load float, float* %2 @@ -29,6 +41,14 @@ ; CHECKIF-NEXT: fsw ft0, 0(a0) ; CHECKIF-NEXT: fsw ft0, 32(a0) ; CHECKIF-NEXT: ret +; +; CHECKIZFINX-LABEL: fsw: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fadd.s a1, a1, a2 +; CHECKIZFINX-NEXT: sw a1, 0(a0) +; CHECKIZFINX-NEXT: addi a0, a0, 32 +; CHECKIZFINX-NEXT: sw a1, 0(a0) +; CHECKIZFINX-NEXT: ret %1 = fadd float %b, %c store float %1, float* %a %2 = getelementptr float, float* %a, i32 8 @@ -52,6 +72,18 @@ ; CHECKIF-NEXT: flw ft0, 36(a1) ; CHECKIF-NEXT: fsw fa0, 36(a1) ; CHECKIF-NEXT: ret +; +; CHECKIZFINX-LABEL: flw_fsw_global: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: fadd.s a0, a0, a1 +; CHECKIZFINX-NEXT: lui a1, %hi(G) +; CHECKIZFINX-NEXT: addi a1, a1, %lo(G) +; CHECKIZFINX-NEXT: lw a2, 0(a1) +; CHECKIZFINX-NEXT: sw a0, 0(a1) +; CHECKIZFINX-NEXT: addi a1, a1, 36 +; CHECKIZFINX-NEXT: lw a2, 0(a1) +; CHECKIZFINX-NEXT: sw a0, 0(a1) +; CHECKIZFINX-NEXT: ret %1 = fadd float %a, %b %2 = load volatile float, float* @G store float %1, float* @G @@ -79,6 +111,25 @@ ; RV64IF-NEXT: fadd.s fa0, fa0, ft0 ; RV64IF-NEXT: fsw fa0, -273(a0) ; RV64IF-NEXT: ret +; +; RV32IZFINX-LABEL: flw_fsw_constant: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: lui a1, 912092 +; RV32IZFINX-NEXT: addi a1, a1, -273 +; RV32IZFINX-NEXT: lw a2, 0(a1) +; RV32IZFINX-NEXT: fadd.s a0, a0, a2 +; RV32IZFINX-NEXT: sw a0, 0(a1) +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: flw_fsw_constant: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: lui a1, 228023 +; RV64IZFINX-NEXT: slli a1, a1, 2 +; RV64IZFINX-NEXT: addi a1, a1, -273 +; RV64IZFINX-NEXT: lw a2, 0(a1) +; RV64IZFINX-NEXT: fadd.s a0, a0, a2 +; RV64IZFINX-NEXT: sw a0, 0(a1) +; RV64IZFINX-NEXT: ret %1 = inttoptr i32 3735928559 to float* %2 = load volatile float, float* %1 %3 = fadd float %a, %2 @@ -118,6 +169,42 @@ ; RV64IF-NEXT: flw fs0, 4(sp) # 4-byte Folded Reload ; RV64IF-NEXT: addi sp, sp, 16 ; RV64IF-NEXT: ret +; +; RV32IZFINX-LABEL: flw_stack: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: sw s0, 8(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: sw s1, 4(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: mv s0, a0 +; RV32IZFINX-NEXT: mv a0, sp +; RV32IZFINX-NEXT: mv s1, sp +; RV32IZFINX-NEXT: call notdead@plt +; RV32IZFINX-NEXT: lw a0, 0(s1) +; RV32IZFINX-NEXT: fadd.s a0, a0, s0 +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: lw s0, 8(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: lw s1, 4(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: flw_stack: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: addi sp, sp, -32 +; RV64IZFINX-NEXT: sd ra, 24(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: sd s0, 16(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: sd s1, 8(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: mv s0, a0 +; RV64IZFINX-NEXT: addi a0, sp, 4 +; RV64IZFINX-NEXT: addi s1, sp, 4 +; RV64IZFINX-NEXT: call notdead@plt +; RV64IZFINX-NEXT: lw a0, 0(s1) +; RV64IZFINX-NEXT: fadd.s a0, a0, s0 +; RV64IZFINX-NEXT: ld ra, 24(sp) # 8-byte Folded Reload +; RV64IZFINX-NEXT: ld s0, 16(sp) # 8-byte Folded Reload +; RV64IZFINX-NEXT: ld s1, 8(sp) # 8-byte Folded Reload +; RV64IZFINX-NEXT: addi sp, sp, 32 +; RV64IZFINX-NEXT: ret %1 = alloca float, align 4 %2 = bitcast float* %1 to i8* call void @notdead(i8* %2) @@ -150,6 +237,32 @@ ; RV64IF-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64IF-NEXT: addi sp, sp, 16 ; RV64IF-NEXT: ret +; +; RV32IZFINX-LABEL: fsw_stack: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: fadd.s a0, a0, a1 +; RV32IZFINX-NEXT: addi a1, sp, 8 +; RV32IZFINX-NEXT: sw a0, 0(a1) +; RV32IZFINX-NEXT: addi a0, sp, 8 +; RV32IZFINX-NEXT: call notdead@plt +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: fsw_stack: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: addi sp, sp, -16 +; RV64IZFINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZFINX-NEXT: fadd.s a0, a0, a1 +; RV64IZFINX-NEXT: addi a1, sp, 4 +; RV64IZFINX-NEXT: sw a0, 0(a1) +; RV64IZFINX-NEXT: addi a0, sp, 4 +; RV64IZFINX-NEXT: call notdead@plt +; RV64IZFINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZFINX-NEXT: addi sp, sp, 16 +; RV64IZFINX-NEXT: ret %1 = fadd float %a, %b ; force store from FPR32 %2 = alloca float, align 4 store float %1, float* %2 diff --git a/llvm/test/CodeGen/RISCV/float-round-conv-sat.ll b/llvm/test/CodeGen/RISCV/float-round-conv-sat.ll --- a/llvm/test/CodeGen/RISCV/float-round-conv-sat.ll +++ b/llvm/test/CodeGen/RISCV/float-round-conv-sat.ll @@ -3,6 +3,10 @@ ; RUN: -target-abi=ilp32f | FileCheck -check-prefixes=CHECKIF,RV32IF %s ; RUN: llc -mtriple=riscv64 -mattr=+f -verify-machineinstrs < %s \ ; RUN: -target-abi=lp64f | FileCheck -check-prefixes=CHECKIF,RV64IF %s +; RUN: llc -mtriple=riscv32 -mattr=+zfinx -verify-machineinstrs < %s \ +; RUN: -target-abi=ilp32 | FileCheck -check-prefixes=CHECKIZFINX,RV32IZFINX %s +; RUN: llc -mtriple=riscv64 -mattr=+zfinx -verify-machineinstrs < %s \ +; RUN: -target-abi=lp64 | FileCheck -check-prefixes=CHECKIZFINX,RV64IZFINX %s define signext i32 @test_floor_si32(float %x) { ; CHECKIF-LABEL: test_floor_si32: @@ -13,6 +17,17 @@ ; CHECKIF-NEXT: fcvt.w.s a0, fa0, rdn ; CHECKIF-NEXT: .LBB0_2: ; CHECKIF-NEXT: ret +; +; CHECKIZFINX-LABEL: test_floor_si32: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: feq.s a1, a0, a0 +; CHECKIZFINX-NEXT: bnez a1, .LBB0_2 +; CHECKIZFINX-NEXT: # %bb.1: +; CHECKIZFINX-NEXT: li a0, 0 +; CHECKIZFINX-NEXT: ret +; CHECKIZFINX-NEXT: .LBB0_2: +; CHECKIZFINX-NEXT: fcvt.w.s a0, a0, rdn +; CHECKIZFINX-NEXT: ret %a = call float @llvm.floor.f32(float %x) %b = call i32 @llvm.fptosi.sat.i32.f32(float %a) ret i32 %b @@ -70,6 +85,62 @@ ; RV64IF-NEXT: fcvt.l.s a0, fa0, rdn ; RV64IF-NEXT: .LBB1_2: ; RV64IF-NEXT: ret +; +; RV32IZFINX-LABEL: test_floor_si64: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: sw s0, 8(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: sw s1, 4(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call floorf@plt +; RV32IZFINX-NEXT: lui a1, %hi(.LCPI1_0) +; RV32IZFINX-NEXT: addi a1, a1, %lo(.LCPI1_0) +; RV32IZFINX-NEXT: lw a1, 0(a1) +; RV32IZFINX-NEXT: mv s0, a0 +; RV32IZFINX-NEXT: fle.s s1, a1, a0 +; RV32IZFINX-NEXT: call __fixsfdi@plt +; RV32IZFINX-NEXT: lui a3, 524288 +; RV32IZFINX-NEXT: bnez s1, .LBB1_2 +; RV32IZFINX-NEXT: # %bb.1: +; RV32IZFINX-NEXT: lui a1, 524288 +; RV32IZFINX-NEXT: .LBB1_2: +; RV32IZFINX-NEXT: lui a2, %hi(.LCPI1_1) +; RV32IZFINX-NEXT: addi a2, a2, %lo(.LCPI1_1) +; RV32IZFINX-NEXT: lw a2, 0(a2) +; RV32IZFINX-NEXT: flt.s a2, a2, s0 +; RV32IZFINX-NEXT: beqz a2, .LBB1_4 +; RV32IZFINX-NEXT: # %bb.3: +; RV32IZFINX-NEXT: addi a1, a3, -1 +; RV32IZFINX-NEXT: .LBB1_4: +; RV32IZFINX-NEXT: feq.s a3, s0, s0 +; RV32IZFINX-NEXT: bnez a3, .LBB1_6 +; RV32IZFINX-NEXT: # %bb.5: +; RV32IZFINX-NEXT: li a1, 0 +; RV32IZFINX-NEXT: li a0, 0 +; RV32IZFINX-NEXT: j .LBB1_7 +; RV32IZFINX-NEXT: .LBB1_6: +; RV32IZFINX-NEXT: neg a3, s1 +; RV32IZFINX-NEXT: and a0, a3, a0 +; RV32IZFINX-NEXT: seqz a2, a2 +; RV32IZFINX-NEXT: addi a2, a2, -1 +; RV32IZFINX-NEXT: or a0, a0, a2 +; RV32IZFINX-NEXT: .LBB1_7: +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: lw s0, 8(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: lw s1, 4(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: test_floor_si64: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: feq.s a1, a0, a0 +; RV64IZFINX-NEXT: bnez a1, .LBB1_2 +; RV64IZFINX-NEXT: # %bb.1: +; RV64IZFINX-NEXT: li a0, 0 +; RV64IZFINX-NEXT: ret +; RV64IZFINX-NEXT: .LBB1_2: +; RV64IZFINX-NEXT: fcvt.l.s a0, a0, rdn +; RV64IZFINX-NEXT: ret %a = call float @llvm.floor.f32(float %x) %b = call i64 @llvm.fptosi.sat.i64.f32(float %a) ret i64 %b @@ -84,6 +155,17 @@ ; CHECKIF-NEXT: fcvt.wu.s a0, fa0, rdn ; CHECKIF-NEXT: .LBB2_2: ; CHECKIF-NEXT: ret +; +; CHECKIZFINX-LABEL: test_floor_ui32: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: feq.s a1, a0, a0 +; CHECKIZFINX-NEXT: bnez a1, .LBB2_2 +; CHECKIZFINX-NEXT: # %bb.1: +; CHECKIZFINX-NEXT: li a0, 0 +; CHECKIZFINX-NEXT: ret +; CHECKIZFINX-NEXT: .LBB2_2: +; CHECKIZFINX-NEXT: fcvt.wu.s a0, a0, rdn +; CHECKIZFINX-NEXT: ret %a = call float @llvm.floor.f32(float %x) %b = call i32 @llvm.fptoui.sat.i32.f32(float %a) ret i32 %b @@ -125,6 +207,45 @@ ; RV64IF-NEXT: fcvt.lu.s a0, fa0, rdn ; RV64IF-NEXT: .LBB3_2: ; RV64IF-NEXT: ret +; +; RV32IZFINX-LABEL: test_floor_ui64: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: sw s0, 8(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: sw s1, 4(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call floorf@plt +; RV32IZFINX-NEXT: mv s0, a0 +; RV32IZFINX-NEXT: fle.s a0, zero, a0 +; RV32IZFINX-NEXT: neg s1, a0 +; RV32IZFINX-NEXT: mv a0, s0 +; RV32IZFINX-NEXT: call __fixunssfdi@plt +; RV32IZFINX-NEXT: lui a2, %hi(.LCPI3_0) +; RV32IZFINX-NEXT: addi a2, a2, %lo(.LCPI3_0) +; RV32IZFINX-NEXT: lw a2, 0(a2) +; RV32IZFINX-NEXT: and a0, s1, a0 +; RV32IZFINX-NEXT: flt.s a2, a2, s0 +; RV32IZFINX-NEXT: seqz a2, a2 +; RV32IZFINX-NEXT: addi a2, a2, -1 +; RV32IZFINX-NEXT: or a0, a0, a2 +; RV32IZFINX-NEXT: and a1, s1, a1 +; RV32IZFINX-NEXT: or a1, a1, a2 +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: lw s0, 8(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: lw s1, 4(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: test_floor_ui64: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: feq.s a1, a0, a0 +; RV64IZFINX-NEXT: bnez a1, .LBB3_2 +; RV64IZFINX-NEXT: # %bb.1: +; RV64IZFINX-NEXT: li a0, 0 +; RV64IZFINX-NEXT: ret +; RV64IZFINX-NEXT: .LBB3_2: +; RV64IZFINX-NEXT: fcvt.lu.s a0, a0, rdn +; RV64IZFINX-NEXT: ret %a = call float @llvm.floor.f32(float %x) %b = call i64 @llvm.fptoui.sat.i64.f32(float %a) ret i64 %b @@ -139,6 +260,17 @@ ; CHECKIF-NEXT: fcvt.w.s a0, fa0, rup ; CHECKIF-NEXT: .LBB4_2: ; CHECKIF-NEXT: ret +; +; CHECKIZFINX-LABEL: test_ceil_si32: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: feq.s a1, a0, a0 +; CHECKIZFINX-NEXT: bnez a1, .LBB4_2 +; CHECKIZFINX-NEXT: # %bb.1: +; CHECKIZFINX-NEXT: li a0, 0 +; CHECKIZFINX-NEXT: ret +; CHECKIZFINX-NEXT: .LBB4_2: +; CHECKIZFINX-NEXT: fcvt.w.s a0, a0, rup +; CHECKIZFINX-NEXT: ret %a = call float @llvm.ceil.f32(float %x) %b = call i32 @llvm.fptosi.sat.i32.f32(float %a) ret i32 %b @@ -196,6 +328,62 @@ ; RV64IF-NEXT: fcvt.l.s a0, fa0, rup ; RV64IF-NEXT: .LBB5_2: ; RV64IF-NEXT: ret +; +; RV32IZFINX-LABEL: test_ceil_si64: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: sw s0, 8(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: sw s1, 4(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call ceilf@plt +; RV32IZFINX-NEXT: lui a1, %hi(.LCPI5_0) +; RV32IZFINX-NEXT: addi a1, a1, %lo(.LCPI5_0) +; RV32IZFINX-NEXT: lw a1, 0(a1) +; RV32IZFINX-NEXT: mv s0, a0 +; RV32IZFINX-NEXT: fle.s s1, a1, a0 +; RV32IZFINX-NEXT: call __fixsfdi@plt +; RV32IZFINX-NEXT: lui a3, 524288 +; RV32IZFINX-NEXT: bnez s1, .LBB5_2 +; RV32IZFINX-NEXT: # %bb.1: +; RV32IZFINX-NEXT: lui a1, 524288 +; RV32IZFINX-NEXT: .LBB5_2: +; RV32IZFINX-NEXT: lui a2, %hi(.LCPI5_1) +; RV32IZFINX-NEXT: addi a2, a2, %lo(.LCPI5_1) +; RV32IZFINX-NEXT: lw a2, 0(a2) +; RV32IZFINX-NEXT: flt.s a2, a2, s0 +; RV32IZFINX-NEXT: beqz a2, .LBB5_4 +; RV32IZFINX-NEXT: # %bb.3: +; RV32IZFINX-NEXT: addi a1, a3, -1 +; RV32IZFINX-NEXT: .LBB5_4: +; RV32IZFINX-NEXT: feq.s a3, s0, s0 +; RV32IZFINX-NEXT: bnez a3, .LBB5_6 +; RV32IZFINX-NEXT: # %bb.5: +; RV32IZFINX-NEXT: li a1, 0 +; RV32IZFINX-NEXT: li a0, 0 +; RV32IZFINX-NEXT: j .LBB5_7 +; RV32IZFINX-NEXT: .LBB5_6: +; RV32IZFINX-NEXT: neg a3, s1 +; RV32IZFINX-NEXT: and a0, a3, a0 +; RV32IZFINX-NEXT: seqz a2, a2 +; RV32IZFINX-NEXT: addi a2, a2, -1 +; RV32IZFINX-NEXT: or a0, a0, a2 +; RV32IZFINX-NEXT: .LBB5_7: +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: lw s0, 8(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: lw s1, 4(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: test_ceil_si64: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: feq.s a1, a0, a0 +; RV64IZFINX-NEXT: bnez a1, .LBB5_2 +; RV64IZFINX-NEXT: # %bb.1: +; RV64IZFINX-NEXT: li a0, 0 +; RV64IZFINX-NEXT: ret +; RV64IZFINX-NEXT: .LBB5_2: +; RV64IZFINX-NEXT: fcvt.l.s a0, a0, rup +; RV64IZFINX-NEXT: ret %a = call float @llvm.ceil.f32(float %x) %b = call i64 @llvm.fptosi.sat.i64.f32(float %a) ret i64 %b @@ -210,6 +398,17 @@ ; CHECKIF-NEXT: fcvt.wu.s a0, fa0, rup ; CHECKIF-NEXT: .LBB6_2: ; CHECKIF-NEXT: ret +; +; CHECKIZFINX-LABEL: test_ceil_ui32: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: feq.s a1, a0, a0 +; CHECKIZFINX-NEXT: bnez a1, .LBB6_2 +; CHECKIZFINX-NEXT: # %bb.1: +; CHECKIZFINX-NEXT: li a0, 0 +; CHECKIZFINX-NEXT: ret +; CHECKIZFINX-NEXT: .LBB6_2: +; CHECKIZFINX-NEXT: fcvt.wu.s a0, a0, rup +; CHECKIZFINX-NEXT: ret %a = call float @llvm.ceil.f32(float %x) %b = call i32 @llvm.fptoui.sat.i32.f32(float %a) ret i32 %b @@ -251,6 +450,45 @@ ; RV64IF-NEXT: fcvt.lu.s a0, fa0, rup ; RV64IF-NEXT: .LBB7_2: ; RV64IF-NEXT: ret +; +; RV32IZFINX-LABEL: test_ceil_ui64: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: sw s0, 8(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: sw s1, 4(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call ceilf@plt +; RV32IZFINX-NEXT: mv s0, a0 +; RV32IZFINX-NEXT: fle.s a0, zero, a0 +; RV32IZFINX-NEXT: neg s1, a0 +; RV32IZFINX-NEXT: mv a0, s0 +; RV32IZFINX-NEXT: call __fixunssfdi@plt +; RV32IZFINX-NEXT: lui a2, %hi(.LCPI7_0) +; RV32IZFINX-NEXT: addi a2, a2, %lo(.LCPI7_0) +; RV32IZFINX-NEXT: lw a2, 0(a2) +; RV32IZFINX-NEXT: and a0, s1, a0 +; RV32IZFINX-NEXT: flt.s a2, a2, s0 +; RV32IZFINX-NEXT: seqz a2, a2 +; RV32IZFINX-NEXT: addi a2, a2, -1 +; RV32IZFINX-NEXT: or a0, a0, a2 +; RV32IZFINX-NEXT: and a1, s1, a1 +; RV32IZFINX-NEXT: or a1, a1, a2 +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: lw s0, 8(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: lw s1, 4(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: test_ceil_ui64: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: feq.s a1, a0, a0 +; RV64IZFINX-NEXT: bnez a1, .LBB7_2 +; RV64IZFINX-NEXT: # %bb.1: +; RV64IZFINX-NEXT: li a0, 0 +; RV64IZFINX-NEXT: ret +; RV64IZFINX-NEXT: .LBB7_2: +; RV64IZFINX-NEXT: fcvt.lu.s a0, a0, rup +; RV64IZFINX-NEXT: ret %a = call float @llvm.ceil.f32(float %x) %b = call i64 @llvm.fptoui.sat.i64.f32(float %a) ret i64 %b @@ -265,6 +503,17 @@ ; CHECKIF-NEXT: fcvt.w.s a0, fa0, rtz ; CHECKIF-NEXT: .LBB8_2: ; CHECKIF-NEXT: ret +; +; CHECKIZFINX-LABEL: test_trunc_si32: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: feq.s a1, a0, a0 +; CHECKIZFINX-NEXT: bnez a1, .LBB8_2 +; CHECKIZFINX-NEXT: # %bb.1: +; CHECKIZFINX-NEXT: li a0, 0 +; CHECKIZFINX-NEXT: ret +; CHECKIZFINX-NEXT: .LBB8_2: +; CHECKIZFINX-NEXT: fcvt.w.s a0, a0, rtz +; CHECKIZFINX-NEXT: ret %a = call float @llvm.trunc.f32(float %x) %b = call i32 @llvm.fptosi.sat.i32.f32(float %a) ret i32 %b @@ -322,6 +571,62 @@ ; RV64IF-NEXT: fcvt.l.s a0, fa0, rtz ; RV64IF-NEXT: .LBB9_2: ; RV64IF-NEXT: ret +; +; RV32IZFINX-LABEL: test_trunc_si64: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: sw s0, 8(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: sw s1, 4(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call truncf@plt +; RV32IZFINX-NEXT: lui a1, %hi(.LCPI9_0) +; RV32IZFINX-NEXT: addi a1, a1, %lo(.LCPI9_0) +; RV32IZFINX-NEXT: lw a1, 0(a1) +; RV32IZFINX-NEXT: mv s0, a0 +; RV32IZFINX-NEXT: fle.s s1, a1, a0 +; RV32IZFINX-NEXT: call __fixsfdi@plt +; RV32IZFINX-NEXT: lui a3, 524288 +; RV32IZFINX-NEXT: bnez s1, .LBB9_2 +; RV32IZFINX-NEXT: # %bb.1: +; RV32IZFINX-NEXT: lui a1, 524288 +; RV32IZFINX-NEXT: .LBB9_2: +; RV32IZFINX-NEXT: lui a2, %hi(.LCPI9_1) +; RV32IZFINX-NEXT: addi a2, a2, %lo(.LCPI9_1) +; RV32IZFINX-NEXT: lw a2, 0(a2) +; RV32IZFINX-NEXT: flt.s a2, a2, s0 +; RV32IZFINX-NEXT: beqz a2, .LBB9_4 +; RV32IZFINX-NEXT: # %bb.3: +; RV32IZFINX-NEXT: addi a1, a3, -1 +; RV32IZFINX-NEXT: .LBB9_4: +; RV32IZFINX-NEXT: feq.s a3, s0, s0 +; RV32IZFINX-NEXT: bnez a3, .LBB9_6 +; RV32IZFINX-NEXT: # %bb.5: +; RV32IZFINX-NEXT: li a1, 0 +; RV32IZFINX-NEXT: li a0, 0 +; RV32IZFINX-NEXT: j .LBB9_7 +; RV32IZFINX-NEXT: .LBB9_6: +; RV32IZFINX-NEXT: neg a3, s1 +; RV32IZFINX-NEXT: and a0, a3, a0 +; RV32IZFINX-NEXT: seqz a2, a2 +; RV32IZFINX-NEXT: addi a2, a2, -1 +; RV32IZFINX-NEXT: or a0, a0, a2 +; RV32IZFINX-NEXT: .LBB9_7: +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: lw s0, 8(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: lw s1, 4(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: test_trunc_si64: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: feq.s a1, a0, a0 +; RV64IZFINX-NEXT: bnez a1, .LBB9_2 +; RV64IZFINX-NEXT: # %bb.1: +; RV64IZFINX-NEXT: li a0, 0 +; RV64IZFINX-NEXT: ret +; RV64IZFINX-NEXT: .LBB9_2: +; RV64IZFINX-NEXT: fcvt.l.s a0, a0, rtz +; RV64IZFINX-NEXT: ret %a = call float @llvm.trunc.f32(float %x) %b = call i64 @llvm.fptosi.sat.i64.f32(float %a) ret i64 %b @@ -336,6 +641,17 @@ ; CHECKIF-NEXT: fcvt.wu.s a0, fa0, rtz ; CHECKIF-NEXT: .LBB10_2: ; CHECKIF-NEXT: ret +; +; CHECKIZFINX-LABEL: test_trunc_ui32: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: feq.s a1, a0, a0 +; CHECKIZFINX-NEXT: bnez a1, .LBB10_2 +; CHECKIZFINX-NEXT: # %bb.1: +; CHECKIZFINX-NEXT: li a0, 0 +; CHECKIZFINX-NEXT: ret +; CHECKIZFINX-NEXT: .LBB10_2: +; CHECKIZFINX-NEXT: fcvt.wu.s a0, a0, rtz +; CHECKIZFINX-NEXT: ret %a = call float @llvm.trunc.f32(float %x) %b = call i32 @llvm.fptoui.sat.i32.f32(float %a) ret i32 %b @@ -377,6 +693,45 @@ ; RV64IF-NEXT: fcvt.lu.s a0, fa0, rtz ; RV64IF-NEXT: .LBB11_2: ; RV64IF-NEXT: ret +; +; RV32IZFINX-LABEL: test_trunc_ui64: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: sw s0, 8(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: sw s1, 4(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call truncf@plt +; RV32IZFINX-NEXT: mv s0, a0 +; RV32IZFINX-NEXT: fle.s a0, zero, a0 +; RV32IZFINX-NEXT: neg s1, a0 +; RV32IZFINX-NEXT: mv a0, s0 +; RV32IZFINX-NEXT: call __fixunssfdi@plt +; RV32IZFINX-NEXT: lui a2, %hi(.LCPI11_0) +; RV32IZFINX-NEXT: addi a2, a2, %lo(.LCPI11_0) +; RV32IZFINX-NEXT: lw a2, 0(a2) +; RV32IZFINX-NEXT: and a0, s1, a0 +; RV32IZFINX-NEXT: flt.s a2, a2, s0 +; RV32IZFINX-NEXT: seqz a2, a2 +; RV32IZFINX-NEXT: addi a2, a2, -1 +; RV32IZFINX-NEXT: or a0, a0, a2 +; RV32IZFINX-NEXT: and a1, s1, a1 +; RV32IZFINX-NEXT: or a1, a1, a2 +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: lw s0, 8(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: lw s1, 4(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: test_trunc_ui64: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: feq.s a1, a0, a0 +; RV64IZFINX-NEXT: bnez a1, .LBB11_2 +; RV64IZFINX-NEXT: # %bb.1: +; RV64IZFINX-NEXT: li a0, 0 +; RV64IZFINX-NEXT: ret +; RV64IZFINX-NEXT: .LBB11_2: +; RV64IZFINX-NEXT: fcvt.lu.s a0, a0, rtz +; RV64IZFINX-NEXT: ret %a = call float @llvm.trunc.f32(float %x) %b = call i64 @llvm.fptoui.sat.i64.f32(float %a) ret i64 %b @@ -391,6 +746,17 @@ ; CHECKIF-NEXT: fcvt.w.s a0, fa0, rmm ; CHECKIF-NEXT: .LBB12_2: ; CHECKIF-NEXT: ret +; +; CHECKIZFINX-LABEL: test_round_si32: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: feq.s a1, a0, a0 +; CHECKIZFINX-NEXT: bnez a1, .LBB12_2 +; CHECKIZFINX-NEXT: # %bb.1: +; CHECKIZFINX-NEXT: li a0, 0 +; CHECKIZFINX-NEXT: ret +; CHECKIZFINX-NEXT: .LBB12_2: +; CHECKIZFINX-NEXT: fcvt.w.s a0, a0, rmm +; CHECKIZFINX-NEXT: ret %a = call float @llvm.round.f32(float %x) %b = call i32 @llvm.fptosi.sat.i32.f32(float %a) ret i32 %b @@ -448,6 +814,62 @@ ; RV64IF-NEXT: fcvt.l.s a0, fa0, rmm ; RV64IF-NEXT: .LBB13_2: ; RV64IF-NEXT: ret +; +; RV32IZFINX-LABEL: test_round_si64: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: sw s0, 8(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: sw s1, 4(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call roundf@plt +; RV32IZFINX-NEXT: lui a1, %hi(.LCPI13_0) +; RV32IZFINX-NEXT: addi a1, a1, %lo(.LCPI13_0) +; RV32IZFINX-NEXT: lw a1, 0(a1) +; RV32IZFINX-NEXT: mv s0, a0 +; RV32IZFINX-NEXT: fle.s s1, a1, a0 +; RV32IZFINX-NEXT: call __fixsfdi@plt +; RV32IZFINX-NEXT: lui a3, 524288 +; RV32IZFINX-NEXT: bnez s1, .LBB13_2 +; RV32IZFINX-NEXT: # %bb.1: +; RV32IZFINX-NEXT: lui a1, 524288 +; RV32IZFINX-NEXT: .LBB13_2: +; RV32IZFINX-NEXT: lui a2, %hi(.LCPI13_1) +; RV32IZFINX-NEXT: addi a2, a2, %lo(.LCPI13_1) +; RV32IZFINX-NEXT: lw a2, 0(a2) +; RV32IZFINX-NEXT: flt.s a2, a2, s0 +; RV32IZFINX-NEXT: beqz a2, .LBB13_4 +; RV32IZFINX-NEXT: # %bb.3: +; RV32IZFINX-NEXT: addi a1, a3, -1 +; RV32IZFINX-NEXT: .LBB13_4: +; RV32IZFINX-NEXT: feq.s a3, s0, s0 +; RV32IZFINX-NEXT: bnez a3, .LBB13_6 +; RV32IZFINX-NEXT: # %bb.5: +; RV32IZFINX-NEXT: li a1, 0 +; RV32IZFINX-NEXT: li a0, 0 +; RV32IZFINX-NEXT: j .LBB13_7 +; RV32IZFINX-NEXT: .LBB13_6: +; RV32IZFINX-NEXT: neg a3, s1 +; RV32IZFINX-NEXT: and a0, a3, a0 +; RV32IZFINX-NEXT: seqz a2, a2 +; RV32IZFINX-NEXT: addi a2, a2, -1 +; RV32IZFINX-NEXT: or a0, a0, a2 +; RV32IZFINX-NEXT: .LBB13_7: +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: lw s0, 8(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: lw s1, 4(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: test_round_si64: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: feq.s a1, a0, a0 +; RV64IZFINX-NEXT: bnez a1, .LBB13_2 +; RV64IZFINX-NEXT: # %bb.1: +; RV64IZFINX-NEXT: li a0, 0 +; RV64IZFINX-NEXT: ret +; RV64IZFINX-NEXT: .LBB13_2: +; RV64IZFINX-NEXT: fcvt.l.s a0, a0, rmm +; RV64IZFINX-NEXT: ret %a = call float @llvm.round.f32(float %x) %b = call i64 @llvm.fptosi.sat.i64.f32(float %a) ret i64 %b @@ -462,6 +884,17 @@ ; CHECKIF-NEXT: fcvt.wu.s a0, fa0, rmm ; CHECKIF-NEXT: .LBB14_2: ; CHECKIF-NEXT: ret +; +; CHECKIZFINX-LABEL: test_round_ui32: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: feq.s a1, a0, a0 +; CHECKIZFINX-NEXT: bnez a1, .LBB14_2 +; CHECKIZFINX-NEXT: # %bb.1: +; CHECKIZFINX-NEXT: li a0, 0 +; CHECKIZFINX-NEXT: ret +; CHECKIZFINX-NEXT: .LBB14_2: +; CHECKIZFINX-NEXT: fcvt.wu.s a0, a0, rmm +; CHECKIZFINX-NEXT: ret %a = call float @llvm.round.f32(float %x) %b = call i32 @llvm.fptoui.sat.i32.f32(float %a) ret i32 %b @@ -503,6 +936,45 @@ ; RV64IF-NEXT: fcvt.lu.s a0, fa0, rmm ; RV64IF-NEXT: .LBB15_2: ; RV64IF-NEXT: ret +; +; RV32IZFINX-LABEL: test_round_ui64: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: sw s0, 8(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: sw s1, 4(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call roundf@plt +; RV32IZFINX-NEXT: mv s0, a0 +; RV32IZFINX-NEXT: fle.s a0, zero, a0 +; RV32IZFINX-NEXT: neg s1, a0 +; RV32IZFINX-NEXT: mv a0, s0 +; RV32IZFINX-NEXT: call __fixunssfdi@plt +; RV32IZFINX-NEXT: lui a2, %hi(.LCPI15_0) +; RV32IZFINX-NEXT: addi a2, a2, %lo(.LCPI15_0) +; RV32IZFINX-NEXT: lw a2, 0(a2) +; RV32IZFINX-NEXT: and a0, s1, a0 +; RV32IZFINX-NEXT: flt.s a2, a2, s0 +; RV32IZFINX-NEXT: seqz a2, a2 +; RV32IZFINX-NEXT: addi a2, a2, -1 +; RV32IZFINX-NEXT: or a0, a0, a2 +; RV32IZFINX-NEXT: and a1, s1, a1 +; RV32IZFINX-NEXT: or a1, a1, a2 +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: lw s0, 8(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: lw s1, 4(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: test_round_ui64: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: feq.s a1, a0, a0 +; RV64IZFINX-NEXT: bnez a1, .LBB15_2 +; RV64IZFINX-NEXT: # %bb.1: +; RV64IZFINX-NEXT: li a0, 0 +; RV64IZFINX-NEXT: ret +; RV64IZFINX-NEXT: .LBB15_2: +; RV64IZFINX-NEXT: fcvt.lu.s a0, a0, rmm +; RV64IZFINX-NEXT: ret %a = call float @llvm.round.f32(float %x) %b = call i64 @llvm.fptoui.sat.i64.f32(float %a) ret i64 %b @@ -517,6 +989,17 @@ ; CHECKIF-NEXT: fcvt.w.s a0, fa0, rne ; CHECKIF-NEXT: .LBB16_2: ; CHECKIF-NEXT: ret +; +; CHECKIZFINX-LABEL: test_roundeven_si32: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: feq.s a1, a0, a0 +; CHECKIZFINX-NEXT: bnez a1, .LBB16_2 +; CHECKIZFINX-NEXT: # %bb.1: +; CHECKIZFINX-NEXT: li a0, 0 +; CHECKIZFINX-NEXT: ret +; CHECKIZFINX-NEXT: .LBB16_2: +; CHECKIZFINX-NEXT: fcvt.w.s a0, a0, rne +; CHECKIZFINX-NEXT: ret %a = call float @llvm.roundeven.f32(float %x) %b = call i32 @llvm.fptosi.sat.i32.f32(float %a) ret i32 %b @@ -574,6 +1057,62 @@ ; RV64IF-NEXT: fcvt.l.s a0, fa0, rne ; RV64IF-NEXT: .LBB17_2: ; RV64IF-NEXT: ret +; +; RV32IZFINX-LABEL: test_roundeven_si64: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: sw s0, 8(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: sw s1, 4(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call roundevenf@plt +; RV32IZFINX-NEXT: lui a1, %hi(.LCPI17_0) +; RV32IZFINX-NEXT: addi a1, a1, %lo(.LCPI17_0) +; RV32IZFINX-NEXT: lw a1, 0(a1) +; RV32IZFINX-NEXT: mv s0, a0 +; RV32IZFINX-NEXT: fle.s s1, a1, a0 +; RV32IZFINX-NEXT: call __fixsfdi@plt +; RV32IZFINX-NEXT: lui a3, 524288 +; RV32IZFINX-NEXT: bnez s1, .LBB17_2 +; RV32IZFINX-NEXT: # %bb.1: +; RV32IZFINX-NEXT: lui a1, 524288 +; RV32IZFINX-NEXT: .LBB17_2: +; RV32IZFINX-NEXT: lui a2, %hi(.LCPI17_1) +; RV32IZFINX-NEXT: addi a2, a2, %lo(.LCPI17_1) +; RV32IZFINX-NEXT: lw a2, 0(a2) +; RV32IZFINX-NEXT: flt.s a2, a2, s0 +; RV32IZFINX-NEXT: beqz a2, .LBB17_4 +; RV32IZFINX-NEXT: # %bb.3: +; RV32IZFINX-NEXT: addi a1, a3, -1 +; RV32IZFINX-NEXT: .LBB17_4: +; RV32IZFINX-NEXT: feq.s a3, s0, s0 +; RV32IZFINX-NEXT: bnez a3, .LBB17_6 +; RV32IZFINX-NEXT: # %bb.5: +; RV32IZFINX-NEXT: li a1, 0 +; RV32IZFINX-NEXT: li a0, 0 +; RV32IZFINX-NEXT: j .LBB17_7 +; RV32IZFINX-NEXT: .LBB17_6: +; RV32IZFINX-NEXT: neg a3, s1 +; RV32IZFINX-NEXT: and a0, a3, a0 +; RV32IZFINX-NEXT: seqz a2, a2 +; RV32IZFINX-NEXT: addi a2, a2, -1 +; RV32IZFINX-NEXT: or a0, a0, a2 +; RV32IZFINX-NEXT: .LBB17_7: +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: lw s0, 8(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: lw s1, 4(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: test_roundeven_si64: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: feq.s a1, a0, a0 +; RV64IZFINX-NEXT: bnez a1, .LBB17_2 +; RV64IZFINX-NEXT: # %bb.1: +; RV64IZFINX-NEXT: li a0, 0 +; RV64IZFINX-NEXT: ret +; RV64IZFINX-NEXT: .LBB17_2: +; RV64IZFINX-NEXT: fcvt.l.s a0, a0, rne +; RV64IZFINX-NEXT: ret %a = call float @llvm.roundeven.f32(float %x) %b = call i64 @llvm.fptosi.sat.i64.f32(float %a) ret i64 %b @@ -588,6 +1127,17 @@ ; CHECKIF-NEXT: fcvt.wu.s a0, fa0, rne ; CHECKIF-NEXT: .LBB18_2: ; CHECKIF-NEXT: ret +; +; CHECKIZFINX-LABEL: test_roundeven_ui32: +; CHECKIZFINX: # %bb.0: +; CHECKIZFINX-NEXT: feq.s a1, a0, a0 +; CHECKIZFINX-NEXT: bnez a1, .LBB18_2 +; CHECKIZFINX-NEXT: # %bb.1: +; CHECKIZFINX-NEXT: li a0, 0 +; CHECKIZFINX-NEXT: ret +; CHECKIZFINX-NEXT: .LBB18_2: +; CHECKIZFINX-NEXT: fcvt.wu.s a0, a0, rne +; CHECKIZFINX-NEXT: ret %a = call float @llvm.roundeven.f32(float %x) %b = call i32 @llvm.fptoui.sat.i32.f32(float %a) ret i32 %b @@ -629,6 +1179,45 @@ ; RV64IF-NEXT: fcvt.lu.s a0, fa0, rne ; RV64IF-NEXT: .LBB19_2: ; RV64IF-NEXT: ret +; +; RV32IZFINX-LABEL: test_roundeven_ui64: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: sw s0, 8(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: sw s1, 4(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: call roundevenf@plt +; RV32IZFINX-NEXT: mv s0, a0 +; RV32IZFINX-NEXT: fle.s a0, zero, a0 +; RV32IZFINX-NEXT: neg s1, a0 +; RV32IZFINX-NEXT: mv a0, s0 +; RV32IZFINX-NEXT: call __fixunssfdi@plt +; RV32IZFINX-NEXT: lui a2, %hi(.LCPI19_0) +; RV32IZFINX-NEXT: addi a2, a2, %lo(.LCPI19_0) +; RV32IZFINX-NEXT: lw a2, 0(a2) +; RV32IZFINX-NEXT: and a0, s1, a0 +; RV32IZFINX-NEXT: flt.s a2, a2, s0 +; RV32IZFINX-NEXT: seqz a2, a2 +; RV32IZFINX-NEXT: addi a2, a2, -1 +; RV32IZFINX-NEXT: or a0, a0, a2 +; RV32IZFINX-NEXT: and a1, s1, a1 +; RV32IZFINX-NEXT: or a1, a1, a2 +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: lw s0, 8(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: lw s1, 4(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: test_roundeven_ui64: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: feq.s a1, a0, a0 +; RV64IZFINX-NEXT: bnez a1, .LBB19_2 +; RV64IZFINX-NEXT: # %bb.1: +; RV64IZFINX-NEXT: li a0, 0 +; RV64IZFINX-NEXT: ret +; RV64IZFINX-NEXT: .LBB19_2: +; RV64IZFINX-NEXT: fcvt.lu.s a0, a0, rne +; RV64IZFINX-NEXT: ret %a = call float @llvm.roundeven.f32(float %x) %b = call i64 @llvm.fptoui.sat.i64.f32(float %a) ret i64 %b diff --git a/llvm/test/CodeGen/RISCV/float-round-conv.ll b/llvm/test/CodeGen/RISCV/float-round-conv.ll --- a/llvm/test/CodeGen/RISCV/float-round-conv.ll +++ b/llvm/test/CodeGen/RISCV/float-round-conv.ll @@ -3,6 +3,10 @@ ; RUN: -target-abi=ilp32f | FileCheck -check-prefix=RV32IF %s ; RUN: llc -mtriple=riscv64 -mattr=+f -verify-machineinstrs < %s \ ; RUN: -target-abi=lp64f | FileCheck -check-prefix=RV64IF %s +; RUN: llc -mtriple=riscv32 -mattr=+zfinx -verify-machineinstrs < %s \ +; RUN: -target-abi=ilp32 | FileCheck -check-prefix=RV32IZFINX %s +; RUN: llc -mtriple=riscv64 -mattr=+zfinx -verify-machineinstrs < %s \ +; RUN: -target-abi=lp64 | FileCheck -check-prefix=RV64IZFINX %s define signext i8 @test_floor_si8(float %x) { ; RV32IF-LABEL: test_floor_si8: @@ -14,6 +18,16 @@ ; RV64IF: # %bb.0: ; RV64IF-NEXT: fcvt.l.s a0, fa0, rdn ; RV64IF-NEXT: ret +; +; RV32IZFINX-LABEL: test_floor_si8: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: fcvt.w.s a0, a0, rdn +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: test_floor_si8: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fcvt.l.s a0, a0, rdn +; RV64IZFINX-NEXT: ret %a = call float @llvm.floor.f32(float %x) %b = fptosi float %a to i8 ret i8 %b @@ -29,6 +43,16 @@ ; RV64IF: # %bb.0: ; RV64IF-NEXT: fcvt.l.s a0, fa0, rdn ; RV64IF-NEXT: ret +; +; RV32IZFINX-LABEL: test_floor_si16: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: fcvt.w.s a0, a0, rdn +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: test_floor_si16: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fcvt.l.s a0, a0, rdn +; RV64IZFINX-NEXT: ret %a = call float @llvm.floor.f32(float %x) %b = fptosi float %a to i16 ret i16 %b @@ -44,6 +68,16 @@ ; RV64IF: # %bb.0: ; RV64IF-NEXT: fcvt.w.s a0, fa0, rdn ; RV64IF-NEXT: ret +; +; RV32IZFINX-LABEL: test_floor_si32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: fcvt.w.s a0, a0, rdn +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: test_floor_si32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fcvt.w.s a0, a0, rdn +; RV64IZFINX-NEXT: ret %a = call float @llvm.floor.f32(float %x) %b = fptosi float %a to i32 ret i32 %b @@ -66,6 +100,23 @@ ; RV64IF: # %bb.0: ; RV64IF-NEXT: fcvt.l.s a0, fa0, rdn ; RV64IF-NEXT: ret +; +; RV32IZFINX-LABEL: test_floor_si64: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: .cfi_offset ra, -4 +; RV32IZFINX-NEXT: call floorf@plt +; RV32IZFINX-NEXT: call __fixsfdi@plt +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: test_floor_si64: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fcvt.l.s a0, a0, rdn +; RV64IZFINX-NEXT: ret %a = call float @llvm.floor.f32(float %x) %b = fptosi float %a to i64 ret i64 %b @@ -81,6 +132,16 @@ ; RV64IF: # %bb.0: ; RV64IF-NEXT: fcvt.lu.s a0, fa0, rdn ; RV64IF-NEXT: ret +; +; RV32IZFINX-LABEL: test_floor_ui8: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: fcvt.wu.s a0, a0, rdn +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: test_floor_ui8: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fcvt.lu.s a0, a0, rdn +; RV64IZFINX-NEXT: ret %a = call float @llvm.floor.f32(float %x) %b = fptoui float %a to i8 ret i8 %b @@ -96,6 +157,16 @@ ; RV64IF: # %bb.0: ; RV64IF-NEXT: fcvt.lu.s a0, fa0, rdn ; RV64IF-NEXT: ret +; +; RV32IZFINX-LABEL: test_floor_ui16: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: fcvt.wu.s a0, a0, rdn +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: test_floor_ui16: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fcvt.lu.s a0, a0, rdn +; RV64IZFINX-NEXT: ret %a = call float @llvm.floor.f32(float %x) %b = fptoui float %a to i16 ret i16 %b @@ -111,6 +182,16 @@ ; RV64IF: # %bb.0: ; RV64IF-NEXT: fcvt.wu.s a0, fa0, rdn ; RV64IF-NEXT: ret +; +; RV32IZFINX-LABEL: test_floor_ui32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: fcvt.wu.s a0, a0, rdn +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: test_floor_ui32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fcvt.wu.s a0, a0, rdn +; RV64IZFINX-NEXT: ret %a = call float @llvm.floor.f32(float %x) %b = fptoui float %a to i32 ret i32 %b @@ -133,6 +214,23 @@ ; RV64IF: # %bb.0: ; RV64IF-NEXT: fcvt.lu.s a0, fa0, rdn ; RV64IF-NEXT: ret +; +; RV32IZFINX-LABEL: test_floor_ui64: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: .cfi_offset ra, -4 +; RV32IZFINX-NEXT: call floorf@plt +; RV32IZFINX-NEXT: call __fixunssfdi@plt +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: test_floor_ui64: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fcvt.lu.s a0, a0, rdn +; RV64IZFINX-NEXT: ret %a = call float @llvm.floor.f32(float %x) %b = fptoui float %a to i64 ret i64 %b @@ -148,6 +246,16 @@ ; RV64IF: # %bb.0: ; RV64IF-NEXT: fcvt.l.s a0, fa0, rup ; RV64IF-NEXT: ret +; +; RV32IZFINX-LABEL: test_ceil_si8: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: fcvt.w.s a0, a0, rup +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: test_ceil_si8: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fcvt.l.s a0, a0, rup +; RV64IZFINX-NEXT: ret %a = call float @llvm.ceil.f32(float %x) %b = fptosi float %a to i8 ret i8 %b @@ -163,6 +271,16 @@ ; RV64IF: # %bb.0: ; RV64IF-NEXT: fcvt.l.s a0, fa0, rup ; RV64IF-NEXT: ret +; +; RV32IZFINX-LABEL: test_ceil_si16: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: fcvt.w.s a0, a0, rup +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: test_ceil_si16: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fcvt.l.s a0, a0, rup +; RV64IZFINX-NEXT: ret %a = call float @llvm.ceil.f32(float %x) %b = fptosi float %a to i16 ret i16 %b @@ -178,6 +296,16 @@ ; RV64IF: # %bb.0: ; RV64IF-NEXT: fcvt.w.s a0, fa0, rup ; RV64IF-NEXT: ret +; +; RV32IZFINX-LABEL: test_ceil_si32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: fcvt.w.s a0, a0, rup +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: test_ceil_si32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fcvt.w.s a0, a0, rup +; RV64IZFINX-NEXT: ret %a = call float @llvm.ceil.f32(float %x) %b = fptosi float %a to i32 ret i32 %b @@ -200,6 +328,23 @@ ; RV64IF: # %bb.0: ; RV64IF-NEXT: fcvt.l.s a0, fa0, rup ; RV64IF-NEXT: ret +; +; RV32IZFINX-LABEL: test_ceil_si64: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: .cfi_offset ra, -4 +; RV32IZFINX-NEXT: call ceilf@plt +; RV32IZFINX-NEXT: call __fixsfdi@plt +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: test_ceil_si64: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fcvt.l.s a0, a0, rup +; RV64IZFINX-NEXT: ret %a = call float @llvm.ceil.f32(float %x) %b = fptosi float %a to i64 ret i64 %b @@ -215,6 +360,16 @@ ; RV64IF: # %bb.0: ; RV64IF-NEXT: fcvt.lu.s a0, fa0, rup ; RV64IF-NEXT: ret +; +; RV32IZFINX-LABEL: test_ceil_ui8: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: fcvt.wu.s a0, a0, rup +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: test_ceil_ui8: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fcvt.lu.s a0, a0, rup +; RV64IZFINX-NEXT: ret %a = call float @llvm.ceil.f32(float %x) %b = fptoui float %a to i8 ret i8 %b @@ -230,6 +385,16 @@ ; RV64IF: # %bb.0: ; RV64IF-NEXT: fcvt.lu.s a0, fa0, rup ; RV64IF-NEXT: ret +; +; RV32IZFINX-LABEL: test_ceil_ui16: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: fcvt.wu.s a0, a0, rup +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: test_ceil_ui16: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fcvt.lu.s a0, a0, rup +; RV64IZFINX-NEXT: ret %a = call float @llvm.ceil.f32(float %x) %b = fptoui float %a to i16 ret i16 %b @@ -245,6 +410,16 @@ ; RV64IF: # %bb.0: ; RV64IF-NEXT: fcvt.wu.s a0, fa0, rup ; RV64IF-NEXT: ret +; +; RV32IZFINX-LABEL: test_ceil_ui32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: fcvt.wu.s a0, a0, rup +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: test_ceil_ui32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fcvt.wu.s a0, a0, rup +; RV64IZFINX-NEXT: ret %a = call float @llvm.ceil.f32(float %x) %b = fptoui float %a to i32 ret i32 %b @@ -267,6 +442,23 @@ ; RV64IF: # %bb.0: ; RV64IF-NEXT: fcvt.lu.s a0, fa0, rup ; RV64IF-NEXT: ret +; +; RV32IZFINX-LABEL: test_ceil_ui64: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: .cfi_offset ra, -4 +; RV32IZFINX-NEXT: call ceilf@plt +; RV32IZFINX-NEXT: call __fixunssfdi@plt +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: test_ceil_ui64: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fcvt.lu.s a0, a0, rup +; RV64IZFINX-NEXT: ret %a = call float @llvm.ceil.f32(float %x) %b = fptoui float %a to i64 ret i64 %b @@ -282,6 +474,16 @@ ; RV64IF: # %bb.0: ; RV64IF-NEXT: fcvt.l.s a0, fa0, rtz ; RV64IF-NEXT: ret +; +; RV32IZFINX-LABEL: test_trunc_si8: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: fcvt.w.s a0, a0, rtz +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: test_trunc_si8: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fcvt.l.s a0, a0, rtz +; RV64IZFINX-NEXT: ret %a = call float @llvm.trunc.f32(float %x) %b = fptosi float %a to i8 ret i8 %b @@ -297,6 +499,16 @@ ; RV64IF: # %bb.0: ; RV64IF-NEXT: fcvt.l.s a0, fa0, rtz ; RV64IF-NEXT: ret +; +; RV32IZFINX-LABEL: test_trunc_si16: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: fcvt.w.s a0, a0, rtz +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: test_trunc_si16: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fcvt.l.s a0, a0, rtz +; RV64IZFINX-NEXT: ret %a = call float @llvm.trunc.f32(float %x) %b = fptosi float %a to i16 ret i16 %b @@ -312,6 +524,16 @@ ; RV64IF: # %bb.0: ; RV64IF-NEXT: fcvt.w.s a0, fa0, rtz ; RV64IF-NEXT: ret +; +; RV32IZFINX-LABEL: test_trunc_si32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: fcvt.w.s a0, a0, rtz +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: test_trunc_si32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fcvt.w.s a0, a0, rtz +; RV64IZFINX-NEXT: ret %a = call float @llvm.trunc.f32(float %x) %b = fptosi float %a to i32 ret i32 %b @@ -334,6 +556,23 @@ ; RV64IF: # %bb.0: ; RV64IF-NEXT: fcvt.l.s a0, fa0, rtz ; RV64IF-NEXT: ret +; +; RV32IZFINX-LABEL: test_trunc_si64: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: .cfi_offset ra, -4 +; RV32IZFINX-NEXT: call truncf@plt +; RV32IZFINX-NEXT: call __fixsfdi@plt +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: test_trunc_si64: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fcvt.l.s a0, a0, rtz +; RV64IZFINX-NEXT: ret %a = call float @llvm.trunc.f32(float %x) %b = fptosi float %a to i64 ret i64 %b @@ -349,6 +588,16 @@ ; RV64IF: # %bb.0: ; RV64IF-NEXT: fcvt.lu.s a0, fa0, rtz ; RV64IF-NEXT: ret +; +; RV32IZFINX-LABEL: test_trunc_ui8: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: fcvt.wu.s a0, a0, rtz +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: test_trunc_ui8: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fcvt.lu.s a0, a0, rtz +; RV64IZFINX-NEXT: ret %a = call float @llvm.trunc.f32(float %x) %b = fptoui float %a to i8 ret i8 %b @@ -364,6 +613,16 @@ ; RV64IF: # %bb.0: ; RV64IF-NEXT: fcvt.lu.s a0, fa0, rtz ; RV64IF-NEXT: ret +; +; RV32IZFINX-LABEL: test_trunc_ui16: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: fcvt.wu.s a0, a0, rtz +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: test_trunc_ui16: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fcvt.lu.s a0, a0, rtz +; RV64IZFINX-NEXT: ret %a = call float @llvm.trunc.f32(float %x) %b = fptoui float %a to i16 ret i16 %b @@ -379,6 +638,16 @@ ; RV64IF: # %bb.0: ; RV64IF-NEXT: fcvt.wu.s a0, fa0, rtz ; RV64IF-NEXT: ret +; +; RV32IZFINX-LABEL: test_trunc_ui32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: fcvt.wu.s a0, a0, rtz +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: test_trunc_ui32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fcvt.wu.s a0, a0, rtz +; RV64IZFINX-NEXT: ret %a = call float @llvm.trunc.f32(float %x) %b = fptoui float %a to i32 ret i32 %b @@ -401,6 +670,23 @@ ; RV64IF: # %bb.0: ; RV64IF-NEXT: fcvt.lu.s a0, fa0, rtz ; RV64IF-NEXT: ret +; +; RV32IZFINX-LABEL: test_trunc_ui64: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: .cfi_offset ra, -4 +; RV32IZFINX-NEXT: call truncf@plt +; RV32IZFINX-NEXT: call __fixunssfdi@plt +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: test_trunc_ui64: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fcvt.lu.s a0, a0, rtz +; RV64IZFINX-NEXT: ret %a = call float @llvm.trunc.f32(float %x) %b = fptoui float %a to i64 ret i64 %b @@ -416,6 +702,16 @@ ; RV64IF: # %bb.0: ; RV64IF-NEXT: fcvt.l.s a0, fa0, rmm ; RV64IF-NEXT: ret +; +; RV32IZFINX-LABEL: test_round_si8: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: fcvt.w.s a0, a0, rmm +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: test_round_si8: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fcvt.l.s a0, a0, rmm +; RV64IZFINX-NEXT: ret %a = call float @llvm.round.f32(float %x) %b = fptosi float %a to i8 ret i8 %b @@ -431,6 +727,16 @@ ; RV64IF: # %bb.0: ; RV64IF-NEXT: fcvt.l.s a0, fa0, rmm ; RV64IF-NEXT: ret +; +; RV32IZFINX-LABEL: test_round_si16: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: fcvt.w.s a0, a0, rmm +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: test_round_si16: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fcvt.l.s a0, a0, rmm +; RV64IZFINX-NEXT: ret %a = call float @llvm.round.f32(float %x) %b = fptosi float %a to i16 ret i16 %b @@ -446,6 +752,16 @@ ; RV64IF: # %bb.0: ; RV64IF-NEXT: fcvt.w.s a0, fa0, rmm ; RV64IF-NEXT: ret +; +; RV32IZFINX-LABEL: test_round_si32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: fcvt.w.s a0, a0, rmm +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: test_round_si32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fcvt.w.s a0, a0, rmm +; RV64IZFINX-NEXT: ret %a = call float @llvm.round.f32(float %x) %b = fptosi float %a to i32 ret i32 %b @@ -468,6 +784,23 @@ ; RV64IF: # %bb.0: ; RV64IF-NEXT: fcvt.l.s a0, fa0, rmm ; RV64IF-NEXT: ret +; +; RV32IZFINX-LABEL: test_round_si64: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: .cfi_offset ra, -4 +; RV32IZFINX-NEXT: call roundf@plt +; RV32IZFINX-NEXT: call __fixsfdi@plt +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: test_round_si64: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fcvt.l.s a0, a0, rmm +; RV64IZFINX-NEXT: ret %a = call float @llvm.round.f32(float %x) %b = fptosi float %a to i64 ret i64 %b @@ -483,6 +816,16 @@ ; RV64IF: # %bb.0: ; RV64IF-NEXT: fcvt.lu.s a0, fa0, rmm ; RV64IF-NEXT: ret +; +; RV32IZFINX-LABEL: test_round_ui8: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: fcvt.wu.s a0, a0, rmm +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: test_round_ui8: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fcvt.lu.s a0, a0, rmm +; RV64IZFINX-NEXT: ret %a = call float @llvm.round.f32(float %x) %b = fptoui float %a to i8 ret i8 %b @@ -498,6 +841,16 @@ ; RV64IF: # %bb.0: ; RV64IF-NEXT: fcvt.lu.s a0, fa0, rmm ; RV64IF-NEXT: ret +; +; RV32IZFINX-LABEL: test_round_ui16: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: fcvt.wu.s a0, a0, rmm +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: test_round_ui16: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fcvt.lu.s a0, a0, rmm +; RV64IZFINX-NEXT: ret %a = call float @llvm.round.f32(float %x) %b = fptoui float %a to i16 ret i16 %b @@ -513,6 +866,16 @@ ; RV64IF: # %bb.0: ; RV64IF-NEXT: fcvt.wu.s a0, fa0, rmm ; RV64IF-NEXT: ret +; +; RV32IZFINX-LABEL: test_round_ui32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: fcvt.wu.s a0, a0, rmm +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: test_round_ui32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fcvt.wu.s a0, a0, rmm +; RV64IZFINX-NEXT: ret %a = call float @llvm.round.f32(float %x) %b = fptoui float %a to i32 ret i32 %b @@ -535,6 +898,23 @@ ; RV64IF: # %bb.0: ; RV64IF-NEXT: fcvt.lu.s a0, fa0, rmm ; RV64IF-NEXT: ret +; +; RV32IZFINX-LABEL: test_round_ui64: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: .cfi_offset ra, -4 +; RV32IZFINX-NEXT: call roundf@plt +; RV32IZFINX-NEXT: call __fixunssfdi@plt +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: test_round_ui64: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fcvt.lu.s a0, a0, rmm +; RV64IZFINX-NEXT: ret %a = call float @llvm.round.f32(float %x) %b = fptoui float %a to i64 ret i64 %b @@ -550,6 +930,16 @@ ; RV64IF: # %bb.0: ; RV64IF-NEXT: fcvt.l.s a0, fa0, rne ; RV64IF-NEXT: ret +; +; RV32IZFINX-LABEL: test_roundeven_si8: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: fcvt.w.s a0, a0, rne +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: test_roundeven_si8: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fcvt.l.s a0, a0, rne +; RV64IZFINX-NEXT: ret %a = call float @llvm.roundeven.f32(float %x) %b = fptosi float %a to i8 ret i8 %b @@ -565,6 +955,16 @@ ; RV64IF: # %bb.0: ; RV64IF-NEXT: fcvt.l.s a0, fa0, rne ; RV64IF-NEXT: ret +; +; RV32IZFINX-LABEL: test_roundeven_si16: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: fcvt.w.s a0, a0, rne +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: test_roundeven_si16: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fcvt.l.s a0, a0, rne +; RV64IZFINX-NEXT: ret %a = call float @llvm.roundeven.f32(float %x) %b = fptosi float %a to i16 ret i16 %b @@ -580,6 +980,16 @@ ; RV64IF: # %bb.0: ; RV64IF-NEXT: fcvt.w.s a0, fa0, rne ; RV64IF-NEXT: ret +; +; RV32IZFINX-LABEL: test_roundeven_si32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: fcvt.w.s a0, a0, rne +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: test_roundeven_si32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fcvt.w.s a0, a0, rne +; RV64IZFINX-NEXT: ret %a = call float @llvm.roundeven.f32(float %x) %b = fptosi float %a to i32 ret i32 %b @@ -602,6 +1012,23 @@ ; RV64IF: # %bb.0: ; RV64IF-NEXT: fcvt.l.s a0, fa0, rne ; RV64IF-NEXT: ret +; +; RV32IZFINX-LABEL: test_roundeven_si64: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: .cfi_offset ra, -4 +; RV32IZFINX-NEXT: call roundevenf@plt +; RV32IZFINX-NEXT: call __fixsfdi@plt +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: test_roundeven_si64: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fcvt.l.s a0, a0, rne +; RV64IZFINX-NEXT: ret %a = call float @llvm.roundeven.f32(float %x) %b = fptosi float %a to i64 ret i64 %b @@ -617,6 +1044,16 @@ ; RV64IF: # %bb.0: ; RV64IF-NEXT: fcvt.lu.s a0, fa0, rne ; RV64IF-NEXT: ret +; +; RV32IZFINX-LABEL: test_roundeven_ui8: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: fcvt.wu.s a0, a0, rne +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: test_roundeven_ui8: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fcvt.lu.s a0, a0, rne +; RV64IZFINX-NEXT: ret %a = call float @llvm.roundeven.f32(float %x) %b = fptoui float %a to i8 ret i8 %b @@ -632,6 +1069,16 @@ ; RV64IF: # %bb.0: ; RV64IF-NEXT: fcvt.lu.s a0, fa0, rne ; RV64IF-NEXT: ret +; +; RV32IZFINX-LABEL: test_roundeven_ui16: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: fcvt.wu.s a0, a0, rne +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: test_roundeven_ui16: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fcvt.lu.s a0, a0, rne +; RV64IZFINX-NEXT: ret %a = call float @llvm.roundeven.f32(float %x) %b = fptoui float %a to i16 ret i16 %b @@ -647,6 +1094,16 @@ ; RV64IF: # %bb.0: ; RV64IF-NEXT: fcvt.wu.s a0, fa0, rne ; RV64IF-NEXT: ret +; +; RV32IZFINX-LABEL: test_roundeven_ui32: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: fcvt.wu.s a0, a0, rne +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: test_roundeven_ui32: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fcvt.wu.s a0, a0, rne +; RV64IZFINX-NEXT: ret %a = call float @llvm.roundeven.f32(float %x) %b = fptoui float %a to i32 ret i32 %b @@ -669,6 +1126,23 @@ ; RV64IF: # %bb.0: ; RV64IF-NEXT: fcvt.lu.s a0, fa0, rne ; RV64IF-NEXT: ret +; +; RV32IZFINX-LABEL: test_roundeven_ui64: +; RV32IZFINX: # %bb.0: +; RV32IZFINX-NEXT: addi sp, sp, -16 +; RV32IZFINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZFINX-NEXT: .cfi_offset ra, -4 +; RV32IZFINX-NEXT: call roundevenf@plt +; RV32IZFINX-NEXT: call __fixunssfdi@plt +; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZFINX-NEXT: addi sp, sp, 16 +; RV32IZFINX-NEXT: ret +; +; RV64IZFINX-LABEL: test_roundeven_ui64: +; RV64IZFINX: # %bb.0: +; RV64IZFINX-NEXT: fcvt.lu.s a0, a0, rne +; RV64IZFINX-NEXT: ret %a = call float @llvm.roundeven.f32(float %x) %b = fptoui float %a to i64 ret i64 %b diff --git a/llvm/test/CodeGen/RISCV/float-select-fcmp.ll b/llvm/test/CodeGen/RISCV/float-select-fcmp.ll --- a/llvm/test/CodeGen/RISCV/float-select-fcmp.ll +++ b/llvm/test/CodeGen/RISCV/float-select-fcmp.ll @@ -3,12 +3,21 @@ ; RUN: -target-abi=ilp32f | FileCheck %s ; RUN: llc -mtriple=riscv64 -mattr=+f -verify-machineinstrs < %s \ ; RUN: -target-abi=lp64f | FileCheck %s +; RUN: llc -mtriple=riscv32 -mattr=+zfinx -verify-machineinstrs < %s \ +; RUN: -target-abi=ilp32 | FileCheck --check-prefix=CHECKZFINX %s +; RUN: llc -mtriple=riscv64 -mattr=+zfinx -verify-machineinstrs < %s \ +; RUN: -target-abi=lp64 | FileCheck --check-prefix=CHECKZFINX %s define float @select_fcmp_false(float %a, float %b) nounwind { ; CHECK-LABEL: select_fcmp_false: ; CHECK: # %bb.0: ; CHECK-NEXT: fmv.s fa0, fa1 ; CHECK-NEXT: ret +; +; CHECKZFINX-LABEL: select_fcmp_false: +; CHECKZFINX: # %bb.0: +; CHECKZFINX-NEXT: mv a0, a1 +; CHECKZFINX-NEXT: ret %1 = fcmp false float %a, %b %2 = select i1 %1, float %a, float %b ret float %2 @@ -23,6 +32,15 @@ ; CHECK-NEXT: fmv.s fa0, fa1 ; CHECK-NEXT: .LBB1_2: ; CHECK-NEXT: ret +; +; CHECKZFINX-LABEL: select_fcmp_oeq: +; CHECKZFINX: # %bb.0: +; CHECKZFINX-NEXT: feq.s a2, a0, a1 +; CHECKZFINX-NEXT: bnez a2, .LBB1_2 +; CHECKZFINX-NEXT: # %bb.1: +; CHECKZFINX-NEXT: mv a0, a1 +; CHECKZFINX-NEXT: .LBB1_2: +; CHECKZFINX-NEXT: ret %1 = fcmp oeq float %a, %b %2 = select i1 %1, float %a, float %b ret float %2 @@ -37,6 +55,15 @@ ; CHECK-NEXT: fmv.s fa0, fa1 ; CHECK-NEXT: .LBB2_2: ; CHECK-NEXT: ret +; +; CHECKZFINX-LABEL: select_fcmp_ogt: +; CHECKZFINX: # %bb.0: +; CHECKZFINX-NEXT: flt.s a2, a1, a0 +; CHECKZFINX-NEXT: bnez a2, .LBB2_2 +; CHECKZFINX-NEXT: # %bb.1: +; CHECKZFINX-NEXT: mv a0, a1 +; CHECKZFINX-NEXT: .LBB2_2: +; CHECKZFINX-NEXT: ret %1 = fcmp ogt float %a, %b %2 = select i1 %1, float %a, float %b ret float %2 @@ -51,6 +78,15 @@ ; CHECK-NEXT: fmv.s fa0, fa1 ; CHECK-NEXT: .LBB3_2: ; CHECK-NEXT: ret +; +; CHECKZFINX-LABEL: select_fcmp_oge: +; CHECKZFINX: # %bb.0: +; CHECKZFINX-NEXT: fle.s a2, a1, a0 +; CHECKZFINX-NEXT: bnez a2, .LBB3_2 +; CHECKZFINX-NEXT: # %bb.1: +; CHECKZFINX-NEXT: mv a0, a1 +; CHECKZFINX-NEXT: .LBB3_2: +; CHECKZFINX-NEXT: ret %1 = fcmp oge float %a, %b %2 = select i1 %1, float %a, float %b ret float %2 @@ -65,6 +101,15 @@ ; CHECK-NEXT: fmv.s fa0, fa1 ; CHECK-NEXT: .LBB4_2: ; CHECK-NEXT: ret +; +; CHECKZFINX-LABEL: select_fcmp_olt: +; CHECKZFINX: # %bb.0: +; CHECKZFINX-NEXT: flt.s a2, a0, a1 +; CHECKZFINX-NEXT: bnez a2, .LBB4_2 +; CHECKZFINX-NEXT: # %bb.1: +; CHECKZFINX-NEXT: mv a0, a1 +; CHECKZFINX-NEXT: .LBB4_2: +; CHECKZFINX-NEXT: ret %1 = fcmp olt float %a, %b %2 = select i1 %1, float %a, float %b ret float %2 @@ -79,6 +124,15 @@ ; CHECK-NEXT: fmv.s fa0, fa1 ; CHECK-NEXT: .LBB5_2: ; CHECK-NEXT: ret +; +; CHECKZFINX-LABEL: select_fcmp_ole: +; CHECKZFINX: # %bb.0: +; CHECKZFINX-NEXT: fle.s a2, a0, a1 +; CHECKZFINX-NEXT: bnez a2, .LBB5_2 +; CHECKZFINX-NEXT: # %bb.1: +; CHECKZFINX-NEXT: mv a0, a1 +; CHECKZFINX-NEXT: .LBB5_2: +; CHECKZFINX-NEXT: ret %1 = fcmp ole float %a, %b %2 = select i1 %1, float %a, float %b ret float %2 @@ -95,6 +149,17 @@ ; CHECK-NEXT: fmv.s fa0, fa1 ; CHECK-NEXT: .LBB6_2: ; CHECK-NEXT: ret +; +; CHECKZFINX-LABEL: select_fcmp_one: +; CHECKZFINX: # %bb.0: +; CHECKZFINX-NEXT: flt.s a2, a0, a1 +; CHECKZFINX-NEXT: flt.s a3, a1, a0 +; CHECKZFINX-NEXT: or a2, a3, a2 +; CHECKZFINX-NEXT: bnez a2, .LBB6_2 +; CHECKZFINX-NEXT: # %bb.1: +; CHECKZFINX-NEXT: mv a0, a1 +; CHECKZFINX-NEXT: .LBB6_2: +; CHECKZFINX-NEXT: ret %1 = fcmp one float %a, %b %2 = select i1 %1, float %a, float %b ret float %2 @@ -111,6 +176,17 @@ ; CHECK-NEXT: fmv.s fa0, fa1 ; CHECK-NEXT: .LBB7_2: ; CHECK-NEXT: ret +; +; CHECKZFINX-LABEL: select_fcmp_ord: +; CHECKZFINX: # %bb.0: +; CHECKZFINX-NEXT: feq.s a2, a1, a1 +; CHECKZFINX-NEXT: feq.s a3, a0, a0 +; CHECKZFINX-NEXT: and a2, a3, a2 +; CHECKZFINX-NEXT: bnez a2, .LBB7_2 +; CHECKZFINX-NEXT: # %bb.1: +; CHECKZFINX-NEXT: mv a0, a1 +; CHECKZFINX-NEXT: .LBB7_2: +; CHECKZFINX-NEXT: ret %1 = fcmp ord float %a, %b %2 = select i1 %1, float %a, float %b ret float %2 @@ -127,6 +203,17 @@ ; CHECK-NEXT: fmv.s fa0, fa1 ; CHECK-NEXT: .LBB8_2: ; CHECK-NEXT: ret +; +; CHECKZFINX-LABEL: select_fcmp_ueq: +; CHECKZFINX: # %bb.0: +; CHECKZFINX-NEXT: flt.s a2, a0, a1 +; CHECKZFINX-NEXT: flt.s a3, a1, a0 +; CHECKZFINX-NEXT: or a2, a3, a2 +; CHECKZFINX-NEXT: beqz a2, .LBB8_2 +; CHECKZFINX-NEXT: # %bb.1: +; CHECKZFINX-NEXT: mv a0, a1 +; CHECKZFINX-NEXT: .LBB8_2: +; CHECKZFINX-NEXT: ret %1 = fcmp ueq float %a, %b %2 = select i1 %1, float %a, float %b ret float %2 @@ -141,6 +228,15 @@ ; CHECK-NEXT: fmv.s fa0, fa1 ; CHECK-NEXT: .LBB9_2: ; CHECK-NEXT: ret +; +; CHECKZFINX-LABEL: select_fcmp_ugt: +; CHECKZFINX: # %bb.0: +; CHECKZFINX-NEXT: fle.s a2, a0, a1 +; CHECKZFINX-NEXT: beqz a2, .LBB9_2 +; CHECKZFINX-NEXT: # %bb.1: +; CHECKZFINX-NEXT: mv a0, a1 +; CHECKZFINX-NEXT: .LBB9_2: +; CHECKZFINX-NEXT: ret %1 = fcmp ugt float %a, %b %2 = select i1 %1, float %a, float %b ret float %2 @@ -155,6 +251,15 @@ ; CHECK-NEXT: fmv.s fa0, fa1 ; CHECK-NEXT: .LBB10_2: ; CHECK-NEXT: ret +; +; CHECKZFINX-LABEL: select_fcmp_uge: +; CHECKZFINX: # %bb.0: +; CHECKZFINX-NEXT: flt.s a2, a0, a1 +; CHECKZFINX-NEXT: beqz a2, .LBB10_2 +; CHECKZFINX-NEXT: # %bb.1: +; CHECKZFINX-NEXT: mv a0, a1 +; CHECKZFINX-NEXT: .LBB10_2: +; CHECKZFINX-NEXT: ret %1 = fcmp uge float %a, %b %2 = select i1 %1, float %a, float %b ret float %2 @@ -169,6 +274,15 @@ ; CHECK-NEXT: fmv.s fa0, fa1 ; CHECK-NEXT: .LBB11_2: ; CHECK-NEXT: ret +; +; CHECKZFINX-LABEL: select_fcmp_ult: +; CHECKZFINX: # %bb.0: +; CHECKZFINX-NEXT: fle.s a2, a1, a0 +; CHECKZFINX-NEXT: beqz a2, .LBB11_2 +; CHECKZFINX-NEXT: # %bb.1: +; CHECKZFINX-NEXT: mv a0, a1 +; CHECKZFINX-NEXT: .LBB11_2: +; CHECKZFINX-NEXT: ret %1 = fcmp ult float %a, %b %2 = select i1 %1, float %a, float %b ret float %2 @@ -183,6 +297,15 @@ ; CHECK-NEXT: fmv.s fa0, fa1 ; CHECK-NEXT: .LBB12_2: ; CHECK-NEXT: ret +; +; CHECKZFINX-LABEL: select_fcmp_ule: +; CHECKZFINX: # %bb.0: +; CHECKZFINX-NEXT: flt.s a2, a1, a0 +; CHECKZFINX-NEXT: beqz a2, .LBB12_2 +; CHECKZFINX-NEXT: # %bb.1: +; CHECKZFINX-NEXT: mv a0, a1 +; CHECKZFINX-NEXT: .LBB12_2: +; CHECKZFINX-NEXT: ret %1 = fcmp ule float %a, %b %2 = select i1 %1, float %a, float %b ret float %2 @@ -197,6 +320,15 @@ ; CHECK-NEXT: fmv.s fa0, fa1 ; CHECK-NEXT: .LBB13_2: ; CHECK-NEXT: ret +; +; CHECKZFINX-LABEL: select_fcmp_une: +; CHECKZFINX: # %bb.0: +; CHECKZFINX-NEXT: feq.s a2, a0, a1 +; CHECKZFINX-NEXT: beqz a2, .LBB13_2 +; CHECKZFINX-NEXT: # %bb.1: +; CHECKZFINX-NEXT: mv a0, a1 +; CHECKZFINX-NEXT: .LBB13_2: +; CHECKZFINX-NEXT: ret %1 = fcmp une float %a, %b %2 = select i1 %1, float %a, float %b ret float %2 @@ -213,6 +345,17 @@ ; CHECK-NEXT: fmv.s fa0, fa1 ; CHECK-NEXT: .LBB14_2: ; CHECK-NEXT: ret +; +; CHECKZFINX-LABEL: select_fcmp_uno: +; CHECKZFINX: # %bb.0: +; CHECKZFINX-NEXT: feq.s a2, a1, a1 +; CHECKZFINX-NEXT: feq.s a3, a0, a0 +; CHECKZFINX-NEXT: and a2, a3, a2 +; CHECKZFINX-NEXT: beqz a2, .LBB14_2 +; CHECKZFINX-NEXT: # %bb.1: +; CHECKZFINX-NEXT: mv a0, a1 +; CHECKZFINX-NEXT: .LBB14_2: +; CHECKZFINX-NEXT: ret %1 = fcmp uno float %a, %b %2 = select i1 %1, float %a, float %b ret float %2 @@ -222,6 +365,10 @@ ; CHECK-LABEL: select_fcmp_true: ; CHECK: # %bb.0: ; CHECK-NEXT: ret +; +; CHECKZFINX-LABEL: select_fcmp_true: +; CHECKZFINX: # %bb.0: +; CHECKZFINX-NEXT: ret %1 = fcmp true float %a, %b %2 = select i1 %1, float %a, float %b ret float %2 @@ -237,6 +384,16 @@ ; CHECK-NEXT: mv a0, a1 ; CHECK-NEXT: .LBB16_2: ; CHECK-NEXT: ret +; +; CHECKZFINX-LABEL: i32_select_fcmp_oeq: +; CHECKZFINX: # %bb.0: +; CHECKZFINX-NEXT: feq.s a1, a0, a1 +; CHECKZFINX-NEXT: mv a0, a2 +; CHECKZFINX-NEXT: bnez a1, .LBB16_2 +; CHECKZFINX-NEXT: # %bb.1: +; CHECKZFINX-NEXT: mv a0, a3 +; CHECKZFINX-NEXT: .LBB16_2: +; CHECKZFINX-NEXT: ret %1 = fcmp oeq float %a, %b %2 = select i1 %1, i32 %c, i32 %d ret i32 %2 diff --git a/llvm/test/CodeGen/RISCV/half-arith-strict.ll b/llvm/test/CodeGen/RISCV/half-arith-strict.ll --- a/llvm/test/CodeGen/RISCV/half-arith-strict.ll +++ b/llvm/test/CodeGen/RISCV/half-arith-strict.ll @@ -3,6 +3,12 @@ ; RUN: -disable-strictnode-mutation -target-abi ilp32f < %s | FileCheck %s ; RUN: llc -mtriple=riscv64 -mattr=+zfh -verify-machineinstrs \ ; RUN: -disable-strictnode-mutation -target-abi lp64f < %s | FileCheck %s +; RUN: llc -mtriple=riscv32 -mattr=+zhinx -verify-machineinstrs \ +; RUN: -disable-strictnode-mutation -target-abi ilp32 < %s | \ +; RUN: FileCheck --check-prefixes=CHECKZHINX %s +; RUN: llc -mtriple=riscv64 -mattr=+zhinx -verify-machineinstrs \ +; RUN: -disable-strictnode-mutation -target-abi lp64 < %s | \ +; RUN: FileCheck --check-prefixes=CHECKZHINX %s ; FIXME: We can't test without Zfh because soft promote legalization isn't ; implemented in SelectionDAG for STRICT nodes. @@ -12,6 +18,11 @@ ; CHECK: # %bb.0: ; CHECK-NEXT: fadd.h fa0, fa0, fa1 ; CHECK-NEXT: ret +; +; CHECKZHINX-LABEL: fadd_h: +; CHECKZHINX: # %bb.0: +; CHECKZHINX-NEXT: fadd.h a0, a0, a1 +; CHECKZHINX-NEXT: ret %1 = call half @llvm.experimental.constrained.fadd.f16(half %a, half %b, metadata !"round.dynamic", metadata !"fpexcept.strict") strictfp ret half %1 } @@ -22,6 +33,11 @@ ; CHECK: # %bb.0: ; CHECK-NEXT: fsub.h fa0, fa0, fa1 ; CHECK-NEXT: ret +; +; CHECKZHINX-LABEL: fsub_h: +; CHECKZHINX: # %bb.0: +; CHECKZHINX-NEXT: fsub.h a0, a0, a1 +; CHECKZHINX-NEXT: ret %1 = call half @llvm.experimental.constrained.fsub.f16(half %a, half %b, metadata !"round.dynamic", metadata !"fpexcept.strict") strictfp ret half %1 } @@ -32,6 +48,11 @@ ; CHECK: # %bb.0: ; CHECK-NEXT: fmul.h fa0, fa0, fa1 ; CHECK-NEXT: ret +; +; CHECKZHINX-LABEL: fmul_h: +; CHECKZHINX: # %bb.0: +; CHECKZHINX-NEXT: fmul.h a0, a0, a1 +; CHECKZHINX-NEXT: ret %1 = call half @llvm.experimental.constrained.fmul.f16(half %a, half %b, metadata !"round.dynamic", metadata !"fpexcept.strict") strictfp ret half %1 } @@ -42,6 +63,11 @@ ; CHECK: # %bb.0: ; CHECK-NEXT: fdiv.h fa0, fa0, fa1 ; CHECK-NEXT: ret +; +; CHECKZHINX-LABEL: fdiv_h: +; CHECKZHINX: # %bb.0: +; CHECKZHINX-NEXT: fdiv.h a0, a0, a1 +; CHECKZHINX-NEXT: ret %1 = call half @llvm.experimental.constrained.fdiv.f16(half %a, half %b, metadata !"round.dynamic", metadata !"fpexcept.strict") strictfp ret half %1 } @@ -52,6 +78,11 @@ ; CHECK: # %bb.0: ; CHECK-NEXT: fsqrt.h fa0, fa0 ; CHECK-NEXT: ret +; +; CHECKZHINX-LABEL: fsqrt_h: +; CHECKZHINX: # %bb.0: +; CHECKZHINX-NEXT: fsqrt.h a0, a0 +; CHECKZHINX-NEXT: ret %1 = call half @llvm.experimental.constrained.sqrt.f16(half %a, metadata !"round.dynamic", metadata !"fpexcept.strict") strictfp ret half %1 } @@ -76,6 +107,11 @@ ; CHECK: # %bb.0: ; CHECK-NEXT: fmadd.h fa0, fa0, fa1, fa2 ; CHECK-NEXT: ret +; +; CHECKZHINX-LABEL: fmadd_h: +; CHECKZHINX: # %bb.0: +; CHECKZHINX-NEXT: fmadd.h a0, a0, a1, a2 +; CHECKZHINX-NEXT: ret %1 = call half @llvm.experimental.constrained.fma.f16(half %a, half %b, half %c, metadata !"round.dynamic", metadata !"fpexcept.strict") strictfp ret half %1 } @@ -88,6 +124,12 @@ ; CHECK-NEXT: fadd.h ft0, fa2, ft0 ; CHECK-NEXT: fmsub.h fa0, fa0, fa1, ft0 ; CHECK-NEXT: ret +; +; CHECKZHINX-LABEL: fmsub_h: +; CHECKZHINX: # %bb.0: +; CHECKZHINX-NEXT: fadd.h a2, a2, zero +; CHECKZHINX-NEXT: fmsub.h a0, a0, a1, a2 +; CHECKZHINX-NEXT: ret %c_ = fadd half 0.0, %c ; avoid negation using xor %negc = fneg half %c_ %1 = call half @llvm.experimental.constrained.fma.f16(half %a, half %b, half %negc, metadata !"round.dynamic", metadata !"fpexcept.strict") strictfp @@ -102,6 +144,13 @@ ; CHECK-NEXT: fadd.h ft0, fa2, ft0 ; CHECK-NEXT: fnmadd.h fa0, ft1, fa1, ft0 ; CHECK-NEXT: ret +; +; CHECKZHINX-LABEL: fnmadd_h: +; CHECKZHINX: # %bb.0: +; CHECKZHINX-NEXT: fadd.h a0, a0, zero +; CHECKZHINX-NEXT: fadd.h a2, a2, zero +; CHECKZHINX-NEXT: fnmadd.h a0, a0, a1, a2 +; CHECKZHINX-NEXT: ret %a_ = fadd half 0.0, %a %c_ = fadd half 0.0, %c %nega = fneg half %a_ @@ -118,6 +167,13 @@ ; CHECK-NEXT: fadd.h ft0, fa2, ft0 ; CHECK-NEXT: fnmadd.h fa0, ft1, fa0, ft0 ; CHECK-NEXT: ret +; +; CHECKZHINX-LABEL: fnmadd_h_2: +; CHECKZHINX: # %bb.0: +; CHECKZHINX-NEXT: fadd.h a1, a1, zero +; CHECKZHINX-NEXT: fadd.h a2, a2, zero +; CHECKZHINX-NEXT: fnmadd.h a0, a1, a0, a2 +; CHECKZHINX-NEXT: ret %b_ = fadd half 0.0, %b %c_ = fadd half 0.0, %c %negb = fneg half %b_ @@ -133,6 +189,12 @@ ; CHECK-NEXT: fadd.h ft0, fa0, ft0 ; CHECK-NEXT: fnmsub.h fa0, ft0, fa1, fa2 ; CHECK-NEXT: ret +; +; CHECKZHINX-LABEL: fnmsub_h: +; CHECKZHINX: # %bb.0: +; CHECKZHINX-NEXT: fadd.h a0, a0, zero +; CHECKZHINX-NEXT: fnmsub.h a0, a0, a1, a2 +; CHECKZHINX-NEXT: ret %a_ = fadd half 0.0, %a %nega = fneg half %a_ %1 = call half @llvm.experimental.constrained.fma.f16(half %nega, half %b, half %c, metadata !"round.dynamic", metadata !"fpexcept.strict") strictfp @@ -146,6 +208,12 @@ ; CHECK-NEXT: fadd.h ft0, fa1, ft0 ; CHECK-NEXT: fnmsub.h fa0, ft0, fa0, fa2 ; CHECK-NEXT: ret +; +; CHECKZHINX-LABEL: fnmsub_h_2: +; CHECKZHINX: # %bb.0: +; CHECKZHINX-NEXT: fadd.h a1, a1, zero +; CHECKZHINX-NEXT: fnmsub.h a0, a1, a0, a2 +; CHECKZHINX-NEXT: ret %b_ = fadd half 0.0, %b %negb = fneg half %b_ %1 = call half @llvm.experimental.constrained.fma.f16(half %a, half %negb, half %c, metadata !"round.dynamic", metadata !"fpexcept.strict") strictfp 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 @@ -3,6 +3,10 @@ ; RUN: -target-abi ilp32f < %s | FileCheck -check-prefix=CHECKIZFH %s ; RUN: llc -mtriple=riscv64 -mattr=+zfh -verify-machineinstrs \ ; RUN: -target-abi lp64f < %s | FileCheck -check-prefix=CHECKIZFH %s +; RUN: llc -mtriple=riscv32 -mattr=+zhinx -verify-machineinstrs \ +; RUN: -target-abi ilp32 < %s | FileCheck -check-prefix=CHECKIZHINX %s +; RUN: llc -mtriple=riscv64 -mattr=+zhinx -verify-machineinstrs \ +; RUN: -target-abi lp64 < %s | FileCheck -check-prefix=CHECKIZHINX %s ; RUN: llc -mtriple=riscv32 -verify-machineinstrs < %s \ ; RUN: | FileCheck -check-prefix=RV32I %s ; RUN: llc -mtriple=riscv64 -verify-machineinstrs < %s \ @@ -19,6 +23,11 @@ ; CHECKIZFH-NEXT: fadd.h fa0, fa0, fa1 ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: fadd_s: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: fadd.h a0, a0, a1 +; CHECKIZHINX-NEXT: ret +; ; RV32I-LABEL: fadd_s: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -80,6 +89,11 @@ ; CHECKIZFH-NEXT: fsub.h fa0, fa0, fa1 ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: fsub_s: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: fsub.h a0, a0, a1 +; CHECKIZHINX-NEXT: ret +; ; RV32I-LABEL: fsub_s: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -141,6 +155,11 @@ ; CHECKIZFH-NEXT: fmul.h fa0, fa0, fa1 ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: fmul_s: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: fmul.h a0, a0, a1 +; CHECKIZHINX-NEXT: ret +; ; RV32I-LABEL: fmul_s: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -202,6 +221,11 @@ ; CHECKIZFH-NEXT: fdiv.h fa0, fa0, fa1 ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: fdiv_s: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: fdiv.h a0, a0, a1 +; CHECKIZHINX-NEXT: ret +; ; RV32I-LABEL: fdiv_s: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -265,6 +289,11 @@ ; CHECKIZFH-NEXT: fsqrt.h fa0, fa0 ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: fsqrt_s: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: fsqrt.h a0, a0 +; CHECKIZHINX-NEXT: ret +; ; RV32I-LABEL: fsqrt_s: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -302,6 +331,11 @@ ; CHECKIZFH-NEXT: fsgnj.h fa0, fa0, fa1 ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: fsgnj_s: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: fsgnj.h a0, a0, a1 +; CHECKIZHINX-NEXT: ret +; ; RV32I-LABEL: fsgnj_s: ; RV32I: # %bb.0: ; RV32I-NEXT: lui a2, 1048568 @@ -333,6 +367,13 @@ ; CHECKIZFH-NEXT: feq.h a0, ft0, ft1 ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: fneg_s: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: fadd.h a0, a0, a0 +; CHECKIZHINX-NEXT: fneg.h a1, a0 +; CHECKIZHINX-NEXT: feq.h a0, a0, a1 +; CHECKIZHINX-NEXT: ret +; ; RV32I-LABEL: fneg_s: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -410,6 +451,12 @@ ; CHECKIZFH-NEXT: fsgnjn.h fa0, fa0, ft0 ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: fsgnjn_s: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: fadd.h a1, a0, a1 +; CHECKIZHINX-NEXT: fsgnjn.h a0, a0, a1 +; CHECKIZHINX-NEXT: ret +; ; RV32I-LABEL: fsgnjn_s: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -32 @@ -505,6 +552,13 @@ ; CHECKIZFH-NEXT: fadd.h fa0, ft1, ft0 ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: fabs_s: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: fadd.h a0, a0, a1 +; CHECKIZHINX-NEXT: fabs.h a1, a0 +; CHECKIZHINX-NEXT: fadd.h a0, a1, a0 +; CHECKIZHINX-NEXT: ret +; ; RV32I-LABEL: fabs_s: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -592,6 +646,11 @@ ; CHECKIZFH-NEXT: fmin.h fa0, fa0, fa1 ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: fmin_s: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: fmin.h a0, a0, a1 +; CHECKIZHINX-NEXT: ret +; ; RV32I-LABEL: fmin_s: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -655,6 +714,11 @@ ; CHECKIZFH-NEXT: fmax.h fa0, fa0, fa1 ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: fmax_s: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: fmax.h a0, a0, a1 +; CHECKIZHINX-NEXT: ret +; ; RV32I-LABEL: fmax_s: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -718,6 +782,11 @@ ; CHECKIZFH-NEXT: fmadd.h fa0, fa0, fa1, fa2 ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: fmadd_s: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: fmadd.h a0, a0, a1, a2 +; CHECKIZHINX-NEXT: ret +; ; RV32I-LABEL: fmadd_s: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -32 @@ -795,6 +864,12 @@ ; CHECKIZFH-NEXT: fmsub.h fa0, fa0, fa1, ft0 ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: fmsub_s: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: fadd.h a2, a2, zero +; CHECKIZHINX-NEXT: fmsub.h a0, a0, a1, a2 +; CHECKIZHINX-NEXT: ret +; ; RV32I-LABEL: fmsub_s: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -32 @@ -897,6 +972,13 @@ ; CHECKIZFH-NEXT: fnmadd.h fa0, ft1, fa1, ft0 ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: fnmadd_s: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: fadd.h a0, a0, zero +; CHECKIZHINX-NEXT: fadd.h a2, a2, zero +; CHECKIZHINX-NEXT: fnmadd.h a0, a0, a1, a2 +; CHECKIZHINX-NEXT: ret +; ; RV32I-LABEL: fnmadd_s: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -32 @@ -1029,6 +1111,13 @@ ; CHECKIZFH-NEXT: fnmadd.h fa0, ft1, fa0, ft0 ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: fnmadd_s_2: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: fadd.h a1, a1, zero +; CHECKIZHINX-NEXT: fadd.h a2, a2, zero +; CHECKIZHINX-NEXT: fnmadd.h a0, a1, a0, a2 +; CHECKIZHINX-NEXT: ret +; ; RV32I-LABEL: fnmadd_s_2: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -32 @@ -1153,11 +1242,11 @@ } define half @fnmadd_s_3(half %a, half %b, half %c) nounwind { -; RV32IZFH-LABEL: fnmadd_s_3: -; RV32IZFH: # %bb.0: -; RV32IZFH-NEXT: fmadd.h ft0, fa0, fa1, fa2 -; RV32IZFH-NEXT: fneg.h fa0, ft0 -; RV32IZFH-NEXT: ret +; CHECKIZFH-LABEL: fnmadd_s_3: +; CHECKIZFH: # %bb.0: +; CHECKIZFH-NEXT: fmadd.h ft0, fa0, fa1, fa2 +; CHECKIZFH-NEXT: fneg.h fa0, ft0 +; CHECKIZFH-NEXT: ret ; ; RV64IZFH-LABEL: fnmadd_s_3: ; RV64IZFH: # %bb.0: @@ -1165,12 +1254,6 @@ ; RV64IZFH-NEXT: fneg.h fa0, ft0 ; RV64IZFH-NEXT: ret ; -; CHECKIZFH-LABEL: fnmadd_s_3: -; CHECKIZFH: # %bb.0: -; CHECKIZFH-NEXT: fmadd.h ft0, fa0, fa1, fa2 -; CHECKIZFH-NEXT: fneg.h fa0, ft0 -; CHECKIZFH-NEXT: ret -; ; RV32I-LABEL: fnmadd_s_3: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -32 @@ -1247,21 +1330,16 @@ define half @fnmadd_nsz(half %a, half %b, half %c) nounwind { -; RV32IZFH-LABEL: fnmadd_nsz: -; RV32IZFH: # %bb.0: -; RV32IZFH-NEXT: fnmadd.h fa0, fa0, fa1, fa2 -; RV32IZFH-NEXT: ret +; CHECKIZFH-LABEL: fnmadd_nsz: +; CHECKIZFH: # %bb.0: +; CHECKIZFH-NEXT: fnmadd.h fa0, fa0, fa1, fa2 +; CHECKIZFH-NEXT: ret ; ; RV64IZFH-LABEL: fnmadd_nsz: ; RV64IZFH: # %bb.0: ; RV64IZFH-NEXT: fnmadd.h fa0, fa0, fa1, fa2 ; RV64IZFH-NEXT: ret ; -; CHECKIZFH-LABEL: fnmadd_nsz: -; CHECKIZFH: # %bb.0: -; CHECKIZFH-NEXT: fnmadd.h fa0, fa0, fa1, fa2 -; CHECKIZFH-NEXT: ret -; ; RV32I-LABEL: fnmadd_nsz: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -32 @@ -1344,6 +1422,12 @@ ; CHECKIZFH-NEXT: fnmsub.h fa0, ft0, fa1, fa2 ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: fnmsub_s: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: fadd.h a0, a0, zero +; CHECKIZHINX-NEXT: fnmsub.h a0, a0, a1, a2 +; CHECKIZHINX-NEXT: ret +; ; RV32I-LABEL: fnmsub_s: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -32 @@ -1443,6 +1527,12 @@ ; CHECKIZFH-NEXT: fnmsub.h fa0, ft0, fa0, fa2 ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: fnmsub_s_2: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: fadd.h a1, a1, zero +; CHECKIZHINX-NEXT: fnmsub.h a0, a1, a0, a2 +; CHECKIZHINX-NEXT: ret +; ; RV32I-LABEL: fnmsub_s_2: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -32 @@ -1542,6 +1632,11 @@ ; CHECKIZFH-NEXT: fmadd.h fa0, fa0, fa1, fa2 ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: fmadd_s_contract: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: fmadd.h a0, a0, a1, a2 +; CHECKIZHINX-NEXT: ret +; ; RV32I-LABEL: fmadd_s_contract: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -32 @@ -1630,6 +1725,12 @@ ; CHECKIZFH-NEXT: fmsub.h fa0, fa0, fa1, ft0 ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: fmsub_s_contract: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: fadd.h a2, a2, zero +; CHECKIZHINX-NEXT: fmsub.h a0, a0, a1, a2 +; CHECKIZHINX-NEXT: ret +; ; RV32I-LABEL: fmsub_s_contract: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -32 @@ -1733,6 +1834,14 @@ ; CHECKIZFH-NEXT: fnmadd.h fa0, ft1, ft2, ft0 ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: fnmadd_s_contract: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: fadd.h a0, a0, zero +; CHECKIZHINX-NEXT: fadd.h a1, a1, zero +; CHECKIZHINX-NEXT: fadd.h a2, a2, zero +; CHECKIZHINX-NEXT: fnmadd.h a0, a0, a1, a2 +; CHECKIZHINX-NEXT: ret +; ; RV32I-LABEL: fnmadd_s_contract: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -32 @@ -1872,6 +1981,13 @@ ; CHECKIZFH-NEXT: fnmsub.h fa0, ft1, ft0, fa2 ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: fnmsub_s_contract: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: fadd.h a0, a0, zero +; CHECKIZHINX-NEXT: fadd.h a1, a1, zero +; CHECKIZHINX-NEXT: fnmsub.h a0, a0, a1, a2 +; CHECKIZHINX-NEXT: ret +; ; RV32I-LABEL: fnmsub_s_contract: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -32 diff --git a/llvm/test/CodeGen/RISCV/half-bitmanip-dagcombines.ll b/llvm/test/CodeGen/RISCV/half-bitmanip-dagcombines.ll --- a/llvm/test/CodeGen/RISCV/half-bitmanip-dagcombines.ll +++ b/llvm/test/CodeGen/RISCV/half-bitmanip-dagcombines.ll @@ -7,6 +7,14 @@ ; RUN: | FileCheck -check-prefix=RV64I %s ; RUN: llc -mtriple=riscv64 -mattr=+zfh -verify-machineinstrs \ ; RUN: < %s | FileCheck -check-prefix=RV64IZFH %s +; RUN: llc -mtriple=riscv32 -verify-machineinstrs < %s \ +; RUN: | FileCheck -check-prefix=RV32I %s +; RUN: llc -mtriple=riscv32 -mattr=+zhinx -verify-machineinstrs \ +; RUN: < %s | FileCheck -check-prefix=RV32IZHINX %s +; RUN: llc -mtriple=riscv64 -verify-machineinstrs < %s \ +; RUN: | FileCheck -check-prefix=RV64I %s +; RUN: llc -mtriple=riscv64 -mattr=+zhinx -verify-machineinstrs \ +; RUN: < %s | FileCheck -check-prefix=RV64IZHINX %s ; This file tests cases where simple floating point operations can be ; profitably handled though bit manipulation if a soft-float ABI is being used @@ -38,6 +46,18 @@ ; RV64IZFH-NEXT: lui a1, 1048568 ; RV64IZFH-NEXT: xor a0, a0, a1 ; RV64IZFH-NEXT: ret +; +; RV32IZHINX-LABEL: fneg: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: lui a1, 1048568 +; RV32IZHINX-NEXT: xor a0, a0, a1 +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: fneg: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: lui a1, 1048568 +; RV64IZHINX-NEXT: xor a0, a0, a1 +; RV64IZHINX-NEXT: ret %1 = fneg half %a ret half %1 } @@ -68,6 +88,18 @@ ; RV64IZFH-NEXT: slli a0, a0, 49 ; RV64IZFH-NEXT: srli a0, a0, 49 ; RV64IZFH-NEXT: ret +; +; RV32IZHINX-LABEL: fabs: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: slli a0, a0, 17 +; RV32IZHINX-NEXT: srli a0, a0, 17 +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: fabs: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: slli a0, a0, 49 +; RV64IZHINX-NEXT: srli a0, a0, 49 +; RV64IZHINX-NEXT: ret %1 = call half @llvm.fabs.f16(half %a) ret half %1 } @@ -114,6 +146,16 @@ ; RV64IZFH-NEXT: fsgnjn.h ft0, ft1, ft0 ; RV64IZFH-NEXT: fmv.x.h a0, ft0 ; RV64IZFH-NEXT: ret +; +; RV32IZHINX-LABEL: fcopysign_fneg: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: fsgnjn.h a0, a0, a1 +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: fcopysign_fneg: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: fsgnjn.h a0, a0, a1 +; RV64IZHINX-NEXT: ret %1 = fneg half %b %2 = call half @llvm.copysign.f16(half %a, half %1) ret half %2 diff --git a/llvm/test/CodeGen/RISCV/half-br-fcmp.ll b/llvm/test/CodeGen/RISCV/half-br-fcmp.ll --- a/llvm/test/CodeGen/RISCV/half-br-fcmp.ll +++ b/llvm/test/CodeGen/RISCV/half-br-fcmp.ll @@ -3,6 +3,10 @@ ; RUN: -target-abi ilp32f < %s | FileCheck -check-prefix=RV32IZFH %s ; RUN: llc -mtriple=riscv64 -mattr=+zfh -verify-machineinstrs \ ; RUN: -target-abi lp64f < %s | FileCheck -check-prefix=RV64IZFH %s +; RUN: llc -mtriple=riscv32 -mattr=+zhinx -verify-machineinstrs \ +; RUN: -target-abi ilp32 < %s | FileCheck -check-prefix=RV32IZHINX %s +; RUN: llc -mtriple=riscv64 -mattr=+zhinx -verify-machineinstrs \ +; RUN: -target-abi lp64 < %s | FileCheck -check-prefix=RV64IZHINX %s declare void @abort() declare void @exit(i32) @@ -30,6 +34,28 @@ ; RV64IZFH-NEXT: addi sp, sp, -16 ; RV64IZFH-NEXT: sd ra, 8(sp) # 8-byte Folded Spill ; RV64IZFH-NEXT: call abort@plt +; +; RV32IZHINX-LABEL: br_fcmp_false: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: li a0, 1 +; RV32IZHINX-NEXT: bnez a0, .LBB0_2 +; RV32IZHINX-NEXT: # %bb.1: # %if.then +; RV32IZHINX-NEXT: ret +; RV32IZHINX-NEXT: .LBB0_2: # %if.else +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: call abort@plt +; +; RV64IZHINX-LABEL: br_fcmp_false: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: li a0, 1 +; RV64IZHINX-NEXT: bnez a0, .LBB0_2 +; RV64IZHINX-NEXT: # %bb.1: # %if.then +; RV64IZHINX-NEXT: ret +; RV64IZHINX-NEXT: .LBB0_2: # %if.else +; RV64IZHINX-NEXT: addi sp, sp, -16 +; RV64IZHINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZHINX-NEXT: call abort@plt %1 = fcmp false half %a, %b br i1 %1, label %if.then, label %if.else if.then: @@ -61,6 +87,28 @@ ; RV64IZFH-NEXT: addi sp, sp, -16 ; RV64IZFH-NEXT: sd ra, 8(sp) # 8-byte Folded Spill ; RV64IZFH-NEXT: call abort@plt +; +; RV32IZHINX-LABEL: br_fcmp_oeq: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: feq.h a0, a0, a1 +; RV32IZHINX-NEXT: bnez a0, .LBB1_2 +; RV32IZHINX-NEXT: # %bb.1: # %if.else +; RV32IZHINX-NEXT: ret +; RV32IZHINX-NEXT: .LBB1_2: # %if.then +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: call abort@plt +; +; RV64IZHINX-LABEL: br_fcmp_oeq: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: feq.h a0, a0, a1 +; RV64IZHINX-NEXT: bnez a0, .LBB1_2 +; RV64IZHINX-NEXT: # %bb.1: # %if.else +; RV64IZHINX-NEXT: ret +; RV64IZHINX-NEXT: .LBB1_2: # %if.then +; RV64IZHINX-NEXT: addi sp, sp, -16 +; RV64IZHINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZHINX-NEXT: call abort@plt %1 = fcmp oeq half %a, %b br i1 %1, label %if.then, label %if.else if.else: @@ -95,6 +143,28 @@ ; RV64IZFH-NEXT: addi sp, sp, -16 ; RV64IZFH-NEXT: sd ra, 8(sp) # 8-byte Folded Spill ; RV64IZFH-NEXT: call abort@plt +; +; RV32IZHINX-LABEL: br_fcmp_oeq_alt: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: feq.h a0, a0, a1 +; RV32IZHINX-NEXT: bnez a0, .LBB2_2 +; RV32IZHINX-NEXT: # %bb.1: # %if.else +; RV32IZHINX-NEXT: ret +; RV32IZHINX-NEXT: .LBB2_2: # %if.then +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: call abort@plt +; +; RV64IZHINX-LABEL: br_fcmp_oeq_alt: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: feq.h a0, a0, a1 +; RV64IZHINX-NEXT: bnez a0, .LBB2_2 +; RV64IZHINX-NEXT: # %bb.1: # %if.else +; RV64IZHINX-NEXT: ret +; RV64IZHINX-NEXT: .LBB2_2: # %if.then +; RV64IZHINX-NEXT: addi sp, sp, -16 +; RV64IZHINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZHINX-NEXT: call abort@plt %1 = fcmp oeq half %a, %b br i1 %1, label %if.then, label %if.else if.then: @@ -126,6 +196,28 @@ ; RV64IZFH-NEXT: addi sp, sp, -16 ; RV64IZFH-NEXT: sd ra, 8(sp) # 8-byte Folded Spill ; RV64IZFH-NEXT: call abort@plt +; +; RV32IZHINX-LABEL: br_fcmp_ogt: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: flt.h a0, a1, a0 +; RV32IZHINX-NEXT: bnez a0, .LBB3_2 +; RV32IZHINX-NEXT: # %bb.1: # %if.else +; RV32IZHINX-NEXT: ret +; RV32IZHINX-NEXT: .LBB3_2: # %if.then +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: call abort@plt +; +; RV64IZHINX-LABEL: br_fcmp_ogt: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: flt.h a0, a1, a0 +; RV64IZHINX-NEXT: bnez a0, .LBB3_2 +; RV64IZHINX-NEXT: # %bb.1: # %if.else +; RV64IZHINX-NEXT: ret +; RV64IZHINX-NEXT: .LBB3_2: # %if.then +; RV64IZHINX-NEXT: addi sp, sp, -16 +; RV64IZHINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZHINX-NEXT: call abort@plt %1 = fcmp ogt half %a, %b br i1 %1, label %if.then, label %if.else if.else: @@ -157,6 +249,28 @@ ; RV64IZFH-NEXT: addi sp, sp, -16 ; RV64IZFH-NEXT: sd ra, 8(sp) # 8-byte Folded Spill ; RV64IZFH-NEXT: call abort@plt +; +; RV32IZHINX-LABEL: br_fcmp_oge: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: fle.h a0, a1, a0 +; RV32IZHINX-NEXT: bnez a0, .LBB4_2 +; RV32IZHINX-NEXT: # %bb.1: # %if.else +; RV32IZHINX-NEXT: ret +; RV32IZHINX-NEXT: .LBB4_2: # %if.then +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: call abort@plt +; +; RV64IZHINX-LABEL: br_fcmp_oge: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: fle.h a0, a1, a0 +; RV64IZHINX-NEXT: bnez a0, .LBB4_2 +; RV64IZHINX-NEXT: # %bb.1: # %if.else +; RV64IZHINX-NEXT: ret +; RV64IZHINX-NEXT: .LBB4_2: # %if.then +; RV64IZHINX-NEXT: addi sp, sp, -16 +; RV64IZHINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZHINX-NEXT: call abort@plt %1 = fcmp oge half %a, %b br i1 %1, label %if.then, label %if.else if.else: @@ -188,6 +302,28 @@ ; RV64IZFH-NEXT: addi sp, sp, -16 ; RV64IZFH-NEXT: sd ra, 8(sp) # 8-byte Folded Spill ; RV64IZFH-NEXT: call abort@plt +; +; RV32IZHINX-LABEL: br_fcmp_olt: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: flt.h a0, a0, a1 +; RV32IZHINX-NEXT: bnez a0, .LBB5_2 +; RV32IZHINX-NEXT: # %bb.1: # %if.else +; RV32IZHINX-NEXT: ret +; RV32IZHINX-NEXT: .LBB5_2: # %if.then +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: call abort@plt +; +; RV64IZHINX-LABEL: br_fcmp_olt: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: flt.h a0, a0, a1 +; RV64IZHINX-NEXT: bnez a0, .LBB5_2 +; RV64IZHINX-NEXT: # %bb.1: # %if.else +; RV64IZHINX-NEXT: ret +; RV64IZHINX-NEXT: .LBB5_2: # %if.then +; RV64IZHINX-NEXT: addi sp, sp, -16 +; RV64IZHINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZHINX-NEXT: call abort@plt %1 = fcmp olt half %a, %b br i1 %1, label %if.then, label %if.else if.else: @@ -219,6 +355,28 @@ ; RV64IZFH-NEXT: addi sp, sp, -16 ; RV64IZFH-NEXT: sd ra, 8(sp) # 8-byte Folded Spill ; RV64IZFH-NEXT: call abort@plt +; +; RV32IZHINX-LABEL: br_fcmp_ole: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: fle.h a0, a0, a1 +; RV32IZHINX-NEXT: bnez a0, .LBB6_2 +; RV32IZHINX-NEXT: # %bb.1: # %if.else +; RV32IZHINX-NEXT: ret +; RV32IZHINX-NEXT: .LBB6_2: # %if.then +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: call abort@plt +; +; RV64IZHINX-LABEL: br_fcmp_ole: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: fle.h a0, a0, a1 +; RV64IZHINX-NEXT: bnez a0, .LBB6_2 +; RV64IZHINX-NEXT: # %bb.1: # %if.else +; RV64IZHINX-NEXT: ret +; RV64IZHINX-NEXT: .LBB6_2: # %if.then +; RV64IZHINX-NEXT: addi sp, sp, -16 +; RV64IZHINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZHINX-NEXT: call abort@plt %1 = fcmp ole half %a, %b br i1 %1, label %if.then, label %if.else if.else: @@ -254,6 +412,32 @@ ; RV64IZFH-NEXT: addi sp, sp, -16 ; RV64IZFH-NEXT: sd ra, 8(sp) # 8-byte Folded Spill ; RV64IZFH-NEXT: call abort@plt +; +; RV32IZHINX-LABEL: br_fcmp_one: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: flt.h a2, a0, a1 +; RV32IZHINX-NEXT: flt.h a0, a1, a0 +; RV32IZHINX-NEXT: or a0, a0, a2 +; RV32IZHINX-NEXT: bnez a0, .LBB7_2 +; RV32IZHINX-NEXT: # %bb.1: # %if.else +; RV32IZHINX-NEXT: ret +; RV32IZHINX-NEXT: .LBB7_2: # %if.then +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: call abort@plt +; +; RV64IZHINX-LABEL: br_fcmp_one: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: flt.h a2, a0, a1 +; RV64IZHINX-NEXT: flt.h a0, a1, a0 +; RV64IZHINX-NEXT: or a0, a0, a2 +; RV64IZHINX-NEXT: bnez a0, .LBB7_2 +; RV64IZHINX-NEXT: # %bb.1: # %if.else +; RV64IZHINX-NEXT: ret +; RV64IZHINX-NEXT: .LBB7_2: # %if.then +; RV64IZHINX-NEXT: addi sp, sp, -16 +; RV64IZHINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZHINX-NEXT: call abort@plt %1 = fcmp one half %a, %b br i1 %1, label %if.then, label %if.else if.else: @@ -289,6 +473,32 @@ ; RV64IZFH-NEXT: addi sp, sp, -16 ; RV64IZFH-NEXT: sd ra, 8(sp) # 8-byte Folded Spill ; RV64IZFH-NEXT: call abort@plt +; +; RV32IZHINX-LABEL: br_fcmp_ord: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: feq.h a1, a1, a1 +; RV32IZHINX-NEXT: feq.h a0, a0, a0 +; RV32IZHINX-NEXT: and a0, a0, a1 +; RV32IZHINX-NEXT: bnez a0, .LBB8_2 +; RV32IZHINX-NEXT: # %bb.1: # %if.else +; RV32IZHINX-NEXT: ret +; RV32IZHINX-NEXT: .LBB8_2: # %if.then +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: call abort@plt +; +; RV64IZHINX-LABEL: br_fcmp_ord: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: feq.h a1, a1, a1 +; RV64IZHINX-NEXT: feq.h a0, a0, a0 +; RV64IZHINX-NEXT: and a0, a0, a1 +; RV64IZHINX-NEXT: bnez a0, .LBB8_2 +; RV64IZHINX-NEXT: # %bb.1: # %if.else +; RV64IZHINX-NEXT: ret +; RV64IZHINX-NEXT: .LBB8_2: # %if.then +; RV64IZHINX-NEXT: addi sp, sp, -16 +; RV64IZHINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZHINX-NEXT: call abort@plt %1 = fcmp ord half %a, %b br i1 %1, label %if.then, label %if.else if.else: @@ -324,6 +534,32 @@ ; RV64IZFH-NEXT: addi sp, sp, -16 ; RV64IZFH-NEXT: sd ra, 8(sp) # 8-byte Folded Spill ; RV64IZFH-NEXT: call abort@plt +; +; RV32IZHINX-LABEL: br_fcmp_ueq: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: flt.h a2, a0, a1 +; RV32IZHINX-NEXT: flt.h a0, a1, a0 +; RV32IZHINX-NEXT: or a0, a0, a2 +; RV32IZHINX-NEXT: beqz a0, .LBB9_2 +; RV32IZHINX-NEXT: # %bb.1: # %if.else +; RV32IZHINX-NEXT: ret +; RV32IZHINX-NEXT: .LBB9_2: # %if.then +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: call abort@plt +; +; RV64IZHINX-LABEL: br_fcmp_ueq: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: flt.h a2, a0, a1 +; RV64IZHINX-NEXT: flt.h a0, a1, a0 +; RV64IZHINX-NEXT: or a0, a0, a2 +; RV64IZHINX-NEXT: beqz a0, .LBB9_2 +; RV64IZHINX-NEXT: # %bb.1: # %if.else +; RV64IZHINX-NEXT: ret +; RV64IZHINX-NEXT: .LBB9_2: # %if.then +; RV64IZHINX-NEXT: addi sp, sp, -16 +; RV64IZHINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZHINX-NEXT: call abort@plt %1 = fcmp ueq half %a, %b br i1 %1, label %if.then, label %if.else if.else: @@ -355,6 +591,28 @@ ; RV64IZFH-NEXT: addi sp, sp, -16 ; RV64IZFH-NEXT: sd ra, 8(sp) # 8-byte Folded Spill ; RV64IZFH-NEXT: call abort@plt +; +; RV32IZHINX-LABEL: br_fcmp_ugt: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: fle.h a0, a0, a1 +; RV32IZHINX-NEXT: beqz a0, .LBB10_2 +; RV32IZHINX-NEXT: # %bb.1: # %if.else +; RV32IZHINX-NEXT: ret +; RV32IZHINX-NEXT: .LBB10_2: # %if.then +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: call abort@plt +; +; RV64IZHINX-LABEL: br_fcmp_ugt: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: fle.h a0, a0, a1 +; RV64IZHINX-NEXT: beqz a0, .LBB10_2 +; RV64IZHINX-NEXT: # %bb.1: # %if.else +; RV64IZHINX-NEXT: ret +; RV64IZHINX-NEXT: .LBB10_2: # %if.then +; RV64IZHINX-NEXT: addi sp, sp, -16 +; RV64IZHINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZHINX-NEXT: call abort@plt %1 = fcmp ugt half %a, %b br i1 %1, label %if.then, label %if.else if.else: @@ -386,6 +644,28 @@ ; RV64IZFH-NEXT: addi sp, sp, -16 ; RV64IZFH-NEXT: sd ra, 8(sp) # 8-byte Folded Spill ; RV64IZFH-NEXT: call abort@plt +; +; RV32IZHINX-LABEL: br_fcmp_uge: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: flt.h a0, a0, a1 +; RV32IZHINX-NEXT: beqz a0, .LBB11_2 +; RV32IZHINX-NEXT: # %bb.1: # %if.else +; RV32IZHINX-NEXT: ret +; RV32IZHINX-NEXT: .LBB11_2: # %if.then +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: call abort@plt +; +; RV64IZHINX-LABEL: br_fcmp_uge: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: flt.h a0, a0, a1 +; RV64IZHINX-NEXT: beqz a0, .LBB11_2 +; RV64IZHINX-NEXT: # %bb.1: # %if.else +; RV64IZHINX-NEXT: ret +; RV64IZHINX-NEXT: .LBB11_2: # %if.then +; RV64IZHINX-NEXT: addi sp, sp, -16 +; RV64IZHINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZHINX-NEXT: call abort@plt %1 = fcmp uge half %a, %b br i1 %1, label %if.then, label %if.else if.else: @@ -417,6 +697,28 @@ ; RV64IZFH-NEXT: addi sp, sp, -16 ; RV64IZFH-NEXT: sd ra, 8(sp) # 8-byte Folded Spill ; RV64IZFH-NEXT: call abort@plt +; +; RV32IZHINX-LABEL: br_fcmp_ult: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: fle.h a0, a1, a0 +; RV32IZHINX-NEXT: beqz a0, .LBB12_2 +; RV32IZHINX-NEXT: # %bb.1: # %if.else +; RV32IZHINX-NEXT: ret +; RV32IZHINX-NEXT: .LBB12_2: # %if.then +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: call abort@plt +; +; RV64IZHINX-LABEL: br_fcmp_ult: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: fle.h a0, a1, a0 +; RV64IZHINX-NEXT: beqz a0, .LBB12_2 +; RV64IZHINX-NEXT: # %bb.1: # %if.else +; RV64IZHINX-NEXT: ret +; RV64IZHINX-NEXT: .LBB12_2: # %if.then +; RV64IZHINX-NEXT: addi sp, sp, -16 +; RV64IZHINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZHINX-NEXT: call abort@plt %1 = fcmp ult half %a, %b br i1 %1, label %if.then, label %if.else if.else: @@ -448,6 +750,28 @@ ; RV64IZFH-NEXT: addi sp, sp, -16 ; RV64IZFH-NEXT: sd ra, 8(sp) # 8-byte Folded Spill ; RV64IZFH-NEXT: call abort@plt +; +; RV32IZHINX-LABEL: br_fcmp_ule: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: flt.h a0, a1, a0 +; RV32IZHINX-NEXT: beqz a0, .LBB13_2 +; RV32IZHINX-NEXT: # %bb.1: # %if.else +; RV32IZHINX-NEXT: ret +; RV32IZHINX-NEXT: .LBB13_2: # %if.then +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: call abort@plt +; +; RV64IZHINX-LABEL: br_fcmp_ule: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: flt.h a0, a1, a0 +; RV64IZHINX-NEXT: beqz a0, .LBB13_2 +; RV64IZHINX-NEXT: # %bb.1: # %if.else +; RV64IZHINX-NEXT: ret +; RV64IZHINX-NEXT: .LBB13_2: # %if.then +; RV64IZHINX-NEXT: addi sp, sp, -16 +; RV64IZHINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZHINX-NEXT: call abort@plt %1 = fcmp ule half %a, %b br i1 %1, label %if.then, label %if.else if.else: @@ -479,6 +803,28 @@ ; RV64IZFH-NEXT: addi sp, sp, -16 ; RV64IZFH-NEXT: sd ra, 8(sp) # 8-byte Folded Spill ; RV64IZFH-NEXT: call abort@plt +; +; RV32IZHINX-LABEL: br_fcmp_une: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: feq.h a0, a0, a1 +; RV32IZHINX-NEXT: beqz a0, .LBB14_2 +; RV32IZHINX-NEXT: # %bb.1: # %if.else +; RV32IZHINX-NEXT: ret +; RV32IZHINX-NEXT: .LBB14_2: # %if.then +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: call abort@plt +; +; RV64IZHINX-LABEL: br_fcmp_une: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: feq.h a0, a0, a1 +; RV64IZHINX-NEXT: beqz a0, .LBB14_2 +; RV64IZHINX-NEXT: # %bb.1: # %if.else +; RV64IZHINX-NEXT: ret +; RV64IZHINX-NEXT: .LBB14_2: # %if.then +; RV64IZHINX-NEXT: addi sp, sp, -16 +; RV64IZHINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZHINX-NEXT: call abort@plt %1 = fcmp une half %a, %b br i1 %1, label %if.then, label %if.else if.else: @@ -514,6 +860,32 @@ ; RV64IZFH-NEXT: addi sp, sp, -16 ; RV64IZFH-NEXT: sd ra, 8(sp) # 8-byte Folded Spill ; RV64IZFH-NEXT: call abort@plt +; +; RV32IZHINX-LABEL: br_fcmp_uno: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: feq.h a1, a1, a1 +; RV32IZHINX-NEXT: feq.h a0, a0, a0 +; RV32IZHINX-NEXT: and a0, a0, a1 +; RV32IZHINX-NEXT: beqz a0, .LBB15_2 +; RV32IZHINX-NEXT: # %bb.1: # %if.else +; RV32IZHINX-NEXT: ret +; RV32IZHINX-NEXT: .LBB15_2: # %if.then +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: call abort@plt +; +; RV64IZHINX-LABEL: br_fcmp_uno: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: feq.h a1, a1, a1 +; RV64IZHINX-NEXT: feq.h a0, a0, a0 +; RV64IZHINX-NEXT: and a0, a0, a1 +; RV64IZHINX-NEXT: beqz a0, .LBB15_2 +; RV64IZHINX-NEXT: # %bb.1: # %if.else +; RV64IZHINX-NEXT: ret +; RV64IZHINX-NEXT: .LBB15_2: # %if.then +; RV64IZHINX-NEXT: addi sp, sp, -16 +; RV64IZHINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZHINX-NEXT: call abort@plt %1 = fcmp uno half %a, %b br i1 %1, label %if.then, label %if.else if.else: @@ -545,6 +917,28 @@ ; RV64IZFH-NEXT: addi sp, sp, -16 ; RV64IZFH-NEXT: sd ra, 8(sp) # 8-byte Folded Spill ; RV64IZFH-NEXT: call abort@plt +; +; RV32IZHINX-LABEL: br_fcmp_true: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: li a0, 1 +; RV32IZHINX-NEXT: bnez a0, .LBB16_2 +; RV32IZHINX-NEXT: # %bb.1: # %if.else +; RV32IZHINX-NEXT: ret +; RV32IZHINX-NEXT: .LBB16_2: # %if.then +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: call abort@plt +; +; RV64IZHINX-LABEL: br_fcmp_true: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: li a0, 1 +; RV64IZHINX-NEXT: bnez a0, .LBB16_2 +; RV64IZHINX-NEXT: # %bb.1: # %if.else +; RV64IZHINX-NEXT: ret +; RV64IZHINX-NEXT: .LBB16_2: # %if.then +; RV64IZHINX-NEXT: addi sp, sp, -16 +; RV64IZHINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZHINX-NEXT: call abort@plt %1 = fcmp true half %a, %b br i1 %1, label %if.then, label %if.else if.else: diff --git a/llvm/test/CodeGen/RISCV/half-convert-strict.ll b/llvm/test/CodeGen/RISCV/half-convert-strict.ll --- a/llvm/test/CodeGen/RISCV/half-convert-strict.ll +++ b/llvm/test/CodeGen/RISCV/half-convert-strict.ll @@ -5,6 +5,12 @@ ; RUN: llc -mtriple=riscv64 -mattr=+zfh -verify-machineinstrs \ ; RUN: -target-abi lp64f -disable-strictnode-mutation < %s \ ; RUN: | FileCheck -check-prefixes=CHECKIZFH,RV64IZFH %s +; RUN: llc -mtriple=riscv32 -mattr=+zhinx -verify-machineinstrs \ +; RUN: -target-abi ilp32 -disable-strictnode-mutation < %s \ +; RUN: | FileCheck -check-prefixes=CHECKIZHINX,RV32IZHINX %s +; RUN: llc -mtriple=riscv64 -mattr=+zhinx -verify-machineinstrs \ +; RUN: -target-abi lp64 -disable-strictnode-mutation < %s \ +; RUN: | FileCheck -check-prefixes=CHECKIZHINX,RV64IZHINX %s ; RUN: llc -mtriple=riscv32 -mattr=+d,+zfh -verify-machineinstrs \ ; RUN: -target-abi ilp32d -disable-strictnode-mutation < %s \ ; RUN: | FileCheck -check-prefix=RV32IDZFH %s @@ -27,6 +33,16 @@ ; RV64IZFH-NEXT: fcvt.l.h a0, fa0, rtz ; RV64IZFH-NEXT: ret ; +; RV32IZHINX-LABEL: fcvt_si_h: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: fcvt.w.h a0, a0, rtz +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: fcvt_si_h: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: fcvt.l.h a0, a0, rtz +; RV64IZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_si_h: ; RV32IDZFH: # %bb.0: ; RV32IDZFH-NEXT: fcvt.w.h a0, fa0, rtz @@ -52,6 +68,16 @@ ; RV64IZFH-NEXT: fcvt.lu.h a0, fa0, rtz ; RV64IZFH-NEXT: ret ; +; RV32IZHINX-LABEL: fcvt_ui_h: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: fcvt.wu.h a0, a0, rtz +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: fcvt_ui_h: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: fcvt.lu.h a0, a0, rtz +; RV64IZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_ui_h: ; RV32IDZFH: # %bb.0: ; RV32IDZFH-NEXT: fcvt.wu.h a0, fa0, rtz @@ -72,6 +98,11 @@ ; CHECKIZFH-NEXT: fcvt.w.h a0, fa0, rtz ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: fcvt_w_h: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: fcvt.w.h a0, a0, rtz +; CHECKIZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_w_h: ; RV32IDZFH: # %bb.0: ; RV32IDZFH-NEXT: fcvt.w.h a0, fa0, rtz @@ -92,6 +123,11 @@ ; CHECKIZFH-NEXT: fcvt.wu.h a0, fa0, rtz ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: fcvt_wu_h: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: fcvt.wu.h a0, a0, rtz +; CHECKIZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_wu_h: ; RV32IDZFH: # %bb.0: ; RV32IDZFH-NEXT: fcvt.wu.h a0, fa0, rtz @@ -120,6 +156,16 @@ ; CHECKIZFH-NEXT: .LBB4_2: ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: fcvt_wu_h_multiple_use: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: fcvt.wu.h a1, a0, rtz +; CHECKIZHINX-NEXT: li a0, 1 +; CHECKIZHINX-NEXT: beqz a1, .LBB4_2 +; CHECKIZHINX-NEXT: # %bb.1: +; CHECKIZHINX-NEXT: mv a0, a1 +; CHECKIZHINX-NEXT: .LBB4_2: +; CHECKIZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_wu_h_multiple_use: ; RV32IDZFH: # %bb.0: ; RV32IDZFH-NEXT: fcvt.wu.h a1, fa0, rtz @@ -160,6 +206,20 @@ ; RV64IZFH-NEXT: fcvt.l.h a0, fa0, rtz ; RV64IZFH-NEXT: ret ; +; RV32IZHINX-LABEL: fcvt_l_h: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: call __fixhfdi@plt +; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: addi sp, sp, 16 +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: fcvt_l_h: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: fcvt.l.h a0, a0, rtz +; RV64IZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_l_h: ; RV32IDZFH: # %bb.0: ; RV32IDZFH-NEXT: addi sp, sp, -16 @@ -193,6 +253,20 @@ ; RV64IZFH-NEXT: fcvt.lu.h a0, fa0, rtz ; RV64IZFH-NEXT: ret ; +; RV32IZHINX-LABEL: fcvt_lu_h: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: call __fixunshfdi@plt +; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: addi sp, sp, 16 +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: fcvt_lu_h: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: fcvt.lu.h a0, a0, rtz +; RV64IZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_lu_h: ; RV32IDZFH: # %bb.0: ; RV32IDZFH-NEXT: addi sp, sp, -16 @@ -226,6 +300,20 @@ ; RV64IZFH-NEXT: fcvt.h.w fa0, a0 ; RV64IZFH-NEXT: ret ; +; RV32IZHINX-LABEL: fcvt_h_si: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: slli a0, a0, 16 +; RV32IZHINX-NEXT: srai a0, a0, 16 +; RV32IZHINX-NEXT: fcvt.h.w a0, a0 +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: fcvt_h_si: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: slli a0, a0, 48 +; RV64IZHINX-NEXT: srai a0, a0, 48 +; RV64IZHINX-NEXT: fcvt.h.w a0, a0 +; RV64IZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_h_si: ; RV32IDZFH: # %bb.0: ; RV32IDZFH-NEXT: slli a0, a0, 16 @@ -250,6 +338,11 @@ ; CHECKIZFH-NEXT: fcvt.h.w fa0, a0 ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: fcvt_h_si_signext: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: fcvt.h.w a0, a0 +; CHECKIZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_h_si_signext: ; RV32IDZFH: # %bb.0: ; RV32IDZFH-NEXT: fcvt.h.w fa0, a0 @@ -278,6 +371,20 @@ ; RV64IZFH-NEXT: fcvt.h.wu fa0, a0 ; RV64IZFH-NEXT: ret ; +; RV32IZHINX-LABEL: fcvt_h_ui: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: slli a0, a0, 16 +; RV32IZHINX-NEXT: srli a0, a0, 16 +; RV32IZHINX-NEXT: fcvt.h.wu a0, a0 +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: fcvt_h_ui: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: slli a0, a0, 48 +; RV64IZHINX-NEXT: srli a0, a0, 48 +; RV64IZHINX-NEXT: fcvt.h.wu a0, a0 +; RV64IZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_h_ui: ; RV32IDZFH: # %bb.0: ; RV32IDZFH-NEXT: slli a0, a0, 16 @@ -302,6 +409,11 @@ ; CHECKIZFH-NEXT: fcvt.h.wu fa0, a0 ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: fcvt_h_ui_zeroext: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: fcvt.h.wu a0, a0 +; CHECKIZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_h_ui_zeroext: ; RV32IDZFH: # %bb.0: ; RV32IDZFH-NEXT: fcvt.h.wu fa0, a0 @@ -321,6 +433,11 @@ ; CHECKIZFH-NEXT: fcvt.h.w fa0, a0 ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: fcvt_h_w: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: fcvt.h.w a0, a0 +; CHECKIZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_h_w: ; RV32IDZFH: # %bb.0: ; RV32IDZFH-NEXT: fcvt.h.w fa0, a0 @@ -342,6 +459,12 @@ ; CHECKIZFH-NEXT: fcvt.h.w fa0, a0 ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: fcvt_h_w_load: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: lw a0, 0(a0) +; CHECKIZHINX-NEXT: fcvt.h.w a0, a0 +; CHECKIZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_h_w_load: ; RV32IDZFH: # %bb.0: ; RV32IDZFH-NEXT: lw a0, 0(a0) @@ -364,6 +487,11 @@ ; CHECKIZFH-NEXT: fcvt.h.wu fa0, a0 ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: fcvt_h_wu: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: fcvt.h.wu a0, a0 +; CHECKIZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_h_wu: ; RV32IDZFH: # %bb.0: ; RV32IDZFH-NEXT: fcvt.h.wu fa0, a0 @@ -391,6 +519,18 @@ ; RV64IZFH-NEXT: fcvt.h.wu fa0, a0 ; RV64IZFH-NEXT: ret ; +; RV32IZHINX-LABEL: fcvt_h_wu_load: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: lw a0, 0(a0) +; RV32IZHINX-NEXT: fcvt.h.wu a0, a0 +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: fcvt_h_wu_load: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: lwu a0, 0(a0) +; RV64IZHINX-NEXT: fcvt.h.wu a0, a0 +; RV64IZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_h_wu_load: ; RV32IDZFH: # %bb.0: ; RV32IDZFH-NEXT: lw a0, 0(a0) @@ -422,6 +562,20 @@ ; RV64IZFH-NEXT: fcvt.h.l fa0, a0 ; RV64IZFH-NEXT: ret ; +; RV32IZHINX-LABEL: fcvt_h_l: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: call __floatdihf@plt +; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: addi sp, sp, 16 +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: fcvt_h_l: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: fcvt.h.l a0, a0 +; RV64IZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_h_l: ; RV32IDZFH: # %bb.0: ; RV32IDZFH-NEXT: addi sp, sp, -16 @@ -455,6 +609,20 @@ ; RV64IZFH-NEXT: fcvt.h.lu fa0, a0 ; RV64IZFH-NEXT: ret ; +; RV32IZHINX-LABEL: fcvt_h_lu: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: call __floatundihf@plt +; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: addi sp, sp, 16 +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: fcvt_h_lu: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: fcvt.h.lu a0, a0 +; RV64IZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_h_lu: ; RV32IDZFH: # %bb.0: ; RV32IDZFH-NEXT: addi sp, sp, -16 @@ -479,6 +647,11 @@ ; CHECKIZFH-NEXT: fcvt.h.s fa0, fa0 ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: fcvt_h_s: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: fcvt.h.s a0, a0 +; CHECKIZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_h_s: ; RV32IDZFH: # %bb.0: ; RV32IDZFH-NEXT: fcvt.h.s fa0, fa0 @@ -499,6 +672,11 @@ ; CHECKIZFH-NEXT: fcvt.s.h fa0, fa0 ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: fcvt_s_h: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: fcvt.s.h a0, a0 +; CHECKIZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_s_h: ; RV32IDZFH: # %bb.0: ; RV32IDZFH-NEXT: fcvt.s.h fa0, fa0 @@ -532,6 +710,24 @@ ; RV64IZFH-NEXT: addi sp, sp, 16 ; RV64IZFH-NEXT: ret ; +; RV32IZHINX-LABEL: fcvt_h_d: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: call __truncdfhf2@plt +; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: addi sp, sp, 16 +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: fcvt_h_d: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: addi sp, sp, -16 +; RV64IZHINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZHINX-NEXT: call __truncdfhf2@plt +; RV64IZHINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZHINX-NEXT: addi sp, sp, 16 +; RV64IZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_h_d: ; RV32IDZFH: # %bb.0: ; RV32IDZFH-NEXT: fcvt.h.d fa0, fa0 @@ -567,6 +763,26 @@ ; RV64IZFH-NEXT: addi sp, sp, 16 ; RV64IZFH-NEXT: ret ; +; RV32IZHINX-LABEL: fcvt_d_h: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: fcvt.s.h a0, a0 +; RV32IZHINX-NEXT: call __extendsfdf2@plt +; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: addi sp, sp, 16 +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: fcvt_d_h: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: addi sp, sp, -16 +; RV64IZHINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZHINX-NEXT: fcvt.s.h a0, a0 +; RV64IZHINX-NEXT: call __extendsfdf2@plt +; RV64IZHINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZHINX-NEXT: addi sp, sp, 16 +; RV64IZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_d_h: ; RV32IDZFH: # %bb.0: ; RV32IDZFH-NEXT: fcvt.d.h fa0, fa0 @@ -597,6 +813,22 @@ ; RV64IZFH-NEXT: fsh ft0, 0(a1) ; RV64IZFH-NEXT: ret ; +; RV32IZHINX-LABEL: fcvt_h_w_demanded_bits: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: addi a0, a0, 1 +; RV32IZHINX-NEXT: fcvt.h.w a2, a0 +; RV32IZHINX-NEXT: sh a2, 0(a1) +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: fcvt_h_w_demanded_bits: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: addiw a2, a0, 1 +; RV64IZHINX-NEXT: addi a0, a0, 1 +; RV64IZHINX-NEXT: fcvt.h.w a0, a0 +; RV64IZHINX-NEXT: sh a0, 0(a1) +; RV64IZHINX-NEXT: mv a0, a2 +; RV64IZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_h_w_demanded_bits: ; RV32IDZFH: # %bb.0: ; RV32IDZFH-NEXT: addi a0, a0, 1 @@ -632,6 +864,20 @@ ; RV64IZFH-NEXT: fsh ft0, 0(a1) ; RV64IZFH-NEXT: ret ; +; RV32IZHINX-LABEL: fcvt_h_wu_demanded_bits: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: addi a0, a0, 1 +; RV32IZHINX-NEXT: fcvt.h.wu a2, a0 +; RV32IZHINX-NEXT: sh a2, 0(a1) +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: fcvt_h_wu_demanded_bits: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: addiw a0, a0, 1 +; RV64IZHINX-NEXT: fcvt.h.wu a2, a0 +; RV64IZHINX-NEXT: sh a2, 0(a1) +; RV64IZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_h_wu_demanded_bits: ; RV32IDZFH: # %bb.0: ; RV32IDZFH-NEXT: addi a0, a0, 1 diff --git a/llvm/test/CodeGen/RISCV/half-convert.ll b/llvm/test/CodeGen/RISCV/half-convert.ll --- a/llvm/test/CodeGen/RISCV/half-convert.ll +++ b/llvm/test/CodeGen/RISCV/half-convert.ll @@ -3,6 +3,10 @@ ; RUN: -target-abi ilp32f < %s | FileCheck -check-prefixes=CHECKIZFH,RV32IZFH %s ; RUN: llc -mtriple=riscv64 -mattr=+zfh -verify-machineinstrs \ ; RUN: -target-abi lp64f < %s | FileCheck -check-prefixes=CHECKIZFH,RV64IZFH %s +; RUN: llc -mtriple=riscv32 -mattr=+zhinx -verify-machineinstrs \ +; RUN: -target-abi ilp32 < %s | FileCheck -check-prefixes=CHECKIZHINX,RV32IZHINX %s +; RUN: llc -mtriple=riscv64 -mattr=+zhinx -verify-machineinstrs \ +; RUN: -target-abi lp64 < %s | FileCheck -check-prefixes=CHECKIZHINX,RV64IZHINX %s ; RUN: llc -mtriple=riscv32 -mattr=+d,+zfh -verify-machineinstrs \ ; RUN: -target-abi ilp32d < %s | FileCheck -check-prefix=RV32IDZFH %s ; RUN: llc -mtriple=riscv64 -mattr=+d,+zfh -verify-machineinstrs \ @@ -23,6 +27,16 @@ ; RV64IZFH-NEXT: fcvt.l.h a0, fa0, rtz ; RV64IZFH-NEXT: ret ; +; RV32IZHINX-LABEL: fcvt_si_h: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: fcvt.w.h a0, a0, rtz +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: fcvt_si_h: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: fcvt.l.h a0, a0, rtz +; RV64IZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_si_h: ; RV32IDZFH: # %bb.0: ; RV32IDZFH-NEXT: fcvt.w.h a0, fa0, rtz @@ -93,6 +107,46 @@ ; RV64IZFH-NEXT: .LBB1_2: # %start ; RV64IZFH-NEXT: ret ; +; RV32IZHINX-LABEL: fcvt_si_h_sat: +; RV32IZHINX: # %bb.0: # %start +; RV32IZHINX-NEXT: fcvt.s.h a0, a0 +; RV32IZHINX-NEXT: feq.s a1, a0, a0 +; RV32IZHINX-NEXT: bnez a1, .LBB1_2 +; RV32IZHINX-NEXT: # %bb.1: # %start +; RV32IZHINX-NEXT: li a0, 0 +; RV32IZHINX-NEXT: ret +; RV32IZHINX-NEXT: .LBB1_2: +; RV32IZHINX-NEXT: lui a1, %hi(.LCPI1_0) +; RV32IZHINX-NEXT: addi a1, a1, %lo(.LCPI1_0) +; RV32IZHINX-NEXT: lw a1, 0(a1) +; RV32IZHINX-NEXT: lui a2, %hi(.LCPI1_1) +; RV32IZHINX-NEXT: addi a2, a2, %lo(.LCPI1_1) +; RV32IZHINX-NEXT: lw a2, 0(a2) +; RV32IZHINX-NEXT: fmax.s a0, a0, a1 +; RV32IZHINX-NEXT: fmin.s a0, a0, a2 +; RV32IZHINX-NEXT: fcvt.w.s a0, a0, rtz +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: fcvt_si_h_sat: +; RV64IZHINX: # %bb.0: # %start +; RV64IZHINX-NEXT: fcvt.s.h a0, a0 +; RV64IZHINX-NEXT: feq.s a1, a0, a0 +; RV64IZHINX-NEXT: bnez a1, .LBB1_2 +; RV64IZHINX-NEXT: # %bb.1: # %start +; RV64IZHINX-NEXT: li a0, 0 +; RV64IZHINX-NEXT: ret +; RV64IZHINX-NEXT: .LBB1_2: +; RV64IZHINX-NEXT: lui a1, %hi(.LCPI1_0) +; RV64IZHINX-NEXT: addi a1, a1, %lo(.LCPI1_0) +; RV64IZHINX-NEXT: lw a1, 0(a1) +; RV64IZHINX-NEXT: lui a2, %hi(.LCPI1_1) +; RV64IZHINX-NEXT: addi a2, a2, %lo(.LCPI1_1) +; RV64IZHINX-NEXT: lw a2, 0(a2) +; RV64IZHINX-NEXT: fmax.s a0, a0, a1 +; RV64IZHINX-NEXT: fmin.s a0, a0, a2 +; RV64IZHINX-NEXT: fcvt.l.s a0, a0, rtz +; RV64IZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_si_h_sat: ; RV32IDZFH: # %bb.0: # %start ; RV32IDZFH-NEXT: fcvt.s.h ft0, fa0 @@ -233,6 +287,16 @@ ; RV64IZFH-NEXT: fcvt.lu.h a0, fa0, rtz ; RV64IZFH-NEXT: ret ; +; RV32IZHINX-LABEL: fcvt_ui_h: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: fcvt.wu.h a0, a0, rtz +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: fcvt_ui_h: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: fcvt.lu.h a0, a0, rtz +; RV64IZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_ui_h: ; RV32IDZFH: # %bb.0: ; RV32IDZFH-NEXT: fcvt.wu.h a0, fa0, rtz @@ -293,6 +357,28 @@ ; RV64IZFH-NEXT: fcvt.lu.s a0, ft0, rtz ; RV64IZFH-NEXT: ret ; +; RV32IZHINX-LABEL: fcvt_ui_h_sat: +; RV32IZHINX: # %bb.0: # %start +; RV32IZHINX-NEXT: lui a1, %hi(.LCPI3_0) +; RV32IZHINX-NEXT: addi a1, a1, %lo(.LCPI3_0) +; RV32IZHINX-NEXT: lw a1, 0(a1) +; RV32IZHINX-NEXT: fcvt.s.h a0, a0 +; RV32IZHINX-NEXT: fmax.s a0, a0, zero +; RV32IZHINX-NEXT: fmin.s a0, a0, a1 +; RV32IZHINX-NEXT: fcvt.wu.s a0, a0, rtz +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: fcvt_ui_h_sat: +; RV64IZHINX: # %bb.0: # %start +; RV64IZHINX-NEXT: lui a1, %hi(.LCPI3_0) +; RV64IZHINX-NEXT: addi a1, a1, %lo(.LCPI3_0) +; RV64IZHINX-NEXT: lw a1, 0(a1) +; RV64IZHINX-NEXT: fcvt.s.h a0, a0 +; RV64IZHINX-NEXT: fmax.s a0, a0, zero +; RV64IZHINX-NEXT: fmin.s a0, a0, a1 +; RV64IZHINX-NEXT: fcvt.lu.s a0, a0, rtz +; RV64IZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_ui_h_sat: ; RV32IDZFH: # %bb.0: # %start ; RV32IDZFH-NEXT: lui a0, %hi(.LCPI3_0) @@ -406,6 +492,11 @@ ; CHECKIZFH-NEXT: fcvt.w.h a0, fa0, rtz ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: fcvt_w_h: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: fcvt.w.h a0, a0, rtz +; CHECKIZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_w_h: ; RV32IDZFH: # %bb.0: ; RV32IDZFH-NEXT: fcvt.w.h a0, fa0, rtz @@ -453,6 +544,17 @@ ; CHECKIZFH-NEXT: .LBB5_2: # %start ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: fcvt_w_h_sat: +; CHECKIZHINX: # %bb.0: # %start +; CHECKIZHINX-NEXT: feq.h a1, a0, a0 +; CHECKIZHINX-NEXT: bnez a1, .LBB5_2 +; CHECKIZHINX-NEXT: # %bb.1: # %start +; CHECKIZHINX-NEXT: li a0, 0 +; CHECKIZHINX-NEXT: ret +; CHECKIZHINX-NEXT: .LBB5_2: +; CHECKIZHINX-NEXT: fcvt.w.h a0, a0, rtz +; CHECKIZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_w_h_sat: ; RV32IDZFH: # %bb.0: # %start ; RV32IDZFH-NEXT: feq.h a0, fa0, fa0 @@ -578,6 +680,11 @@ ; CHECKIZFH-NEXT: fcvt.wu.h a0, fa0, rtz ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: fcvt_wu_h: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: fcvt.wu.h a0, a0, rtz +; CHECKIZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_wu_h: ; RV32IDZFH: # %bb.0: ; RV32IDZFH-NEXT: fcvt.wu.h a0, fa0, rtz @@ -628,6 +735,16 @@ ; CHECKIZFH-NEXT: .LBB7_2: ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: fcvt_wu_h_multiple_use: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: fcvt.wu.h a1, a0, rtz +; CHECKIZHINX-NEXT: li a0, 1 +; CHECKIZHINX-NEXT: beqz a1, .LBB7_2 +; CHECKIZHINX-NEXT: # %bb.1: +; CHECKIZHINX-NEXT: mv a0, a1 +; CHECKIZHINX-NEXT: .LBB7_2: +; CHECKIZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_wu_h_multiple_use: ; RV32IDZFH: # %bb.0: ; RV32IDZFH-NEXT: fcvt.wu.h a1, fa0, rtz @@ -710,6 +827,30 @@ ; RV64IZFH-NEXT: .LBB8_2: # %start ; RV64IZFH-NEXT: ret ; +; RV32IZHINX-LABEL: fcvt_wu_h_sat: +; RV32IZHINX: # %bb.0: # %start +; RV32IZHINX-NEXT: feq.h a1, a0, a0 +; RV32IZHINX-NEXT: bnez a1, .LBB8_2 +; RV32IZHINX-NEXT: # %bb.1: # %start +; RV32IZHINX-NEXT: li a0, 0 +; RV32IZHINX-NEXT: ret +; RV32IZHINX-NEXT: .LBB8_2: +; RV32IZHINX-NEXT: fcvt.wu.h a0, a0, rtz +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: fcvt_wu_h_sat: +; RV64IZHINX: # %bb.0: # %start +; RV64IZHINX-NEXT: feq.h a1, a0, a0 +; RV64IZHINX-NEXT: bnez a1, .LBB8_2 +; RV64IZHINX-NEXT: # %bb.1: # %start +; RV64IZHINX-NEXT: li a0, 0 +; RV64IZHINX-NEXT: ret +; RV64IZHINX-NEXT: .LBB8_2: +; RV64IZHINX-NEXT: fcvt.wu.h a0, a0, rtz +; RV64IZHINX-NEXT: slli a0, a0, 32 +; RV64IZHINX-NEXT: srli a0, a0, 32 +; RV64IZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_wu_h_sat: ; RV32IDZFH: # %bb.0: # %start ; RV32IDZFH-NEXT: feq.h a0, fa0, fa0 @@ -823,6 +964,20 @@ ; RV64IZFH-NEXT: fcvt.l.h a0, fa0, rtz ; RV64IZFH-NEXT: ret ; +; RV32IZHINX-LABEL: fcvt_l_h: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: call __fixhfdi@plt +; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: addi sp, sp, 16 +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: fcvt_l_h: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: fcvt.l.h a0, a0, rtz +; RV64IZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_l_h: ; RV32IDZFH: # %bb.0: ; RV32IDZFH-NEXT: addi sp, sp, -16 @@ -917,6 +1072,62 @@ ; RV64IZFH-NEXT: .LBB10_2: # %start ; RV64IZFH-NEXT: ret ; +; RV32IZHINX-LABEL: fcvt_l_h_sat: +; RV32IZHINX: # %bb.0: # %start +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: sw s0, 8(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: sw s1, 4(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: lui a1, %hi(.LCPI10_0) +; RV32IZHINX-NEXT: addi a1, a1, %lo(.LCPI10_0) +; RV32IZHINX-NEXT: lw a1, 0(a1) +; RV32IZHINX-NEXT: fcvt.s.h s0, a0 +; RV32IZHINX-NEXT: fle.s s1, a1, s0 +; RV32IZHINX-NEXT: mv a0, s0 +; RV32IZHINX-NEXT: call __fixsfdi@plt +; RV32IZHINX-NEXT: lui a3, 524288 +; RV32IZHINX-NEXT: bnez s1, .LBB10_2 +; RV32IZHINX-NEXT: # %bb.1: # %start +; RV32IZHINX-NEXT: lui a1, 524288 +; RV32IZHINX-NEXT: .LBB10_2: # %start +; RV32IZHINX-NEXT: lui a2, %hi(.LCPI10_1) +; RV32IZHINX-NEXT: addi a2, a2, %lo(.LCPI10_1) +; RV32IZHINX-NEXT: lw a2, 0(a2) +; RV32IZHINX-NEXT: flt.s a2, a2, s0 +; RV32IZHINX-NEXT: beqz a2, .LBB10_4 +; RV32IZHINX-NEXT: # %bb.3: +; RV32IZHINX-NEXT: addi a1, a3, -1 +; RV32IZHINX-NEXT: .LBB10_4: # %start +; RV32IZHINX-NEXT: feq.s a3, s0, s0 +; RV32IZHINX-NEXT: bnez a3, .LBB10_6 +; RV32IZHINX-NEXT: # %bb.5: # %start +; RV32IZHINX-NEXT: li a1, 0 +; RV32IZHINX-NEXT: li a0, 0 +; RV32IZHINX-NEXT: j .LBB10_7 +; RV32IZHINX-NEXT: .LBB10_6: +; RV32IZHINX-NEXT: neg a3, s1 +; RV32IZHINX-NEXT: and a0, a3, a0 +; RV32IZHINX-NEXT: seqz a2, a2 +; RV32IZHINX-NEXT: addi a2, a2, -1 +; RV32IZHINX-NEXT: or a0, a0, a2 +; RV32IZHINX-NEXT: .LBB10_7: # %start +; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: lw s0, 8(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: lw s1, 4(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: addi sp, sp, 16 +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: fcvt_l_h_sat: +; RV64IZHINX: # %bb.0: # %start +; RV64IZHINX-NEXT: feq.h a1, a0, a0 +; RV64IZHINX-NEXT: bnez a1, .LBB10_2 +; RV64IZHINX-NEXT: # %bb.1: # %start +; RV64IZHINX-NEXT: li a0, 0 +; RV64IZHINX-NEXT: ret +; RV64IZHINX-NEXT: .LBB10_2: +; RV64IZHINX-NEXT: fcvt.l.h a0, a0, rtz +; RV64IZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_l_h_sat: ; RV32IDZFH: # %bb.0: # %start ; RV32IDZFH-NEXT: addi sp, sp, -16 @@ -1117,6 +1328,20 @@ ; RV64IZFH-NEXT: fcvt.lu.h a0, fa0, rtz ; RV64IZFH-NEXT: ret ; +; RV32IZHINX-LABEL: fcvt_lu_h: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: call __fixunshfdi@plt +; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: addi sp, sp, 16 +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: fcvt_lu_h: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: fcvt.lu.h a0, a0, rtz +; RV64IZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_lu_h: ; RV32IDZFH: # %bb.0: ; RV32IDZFH-NEXT: addi sp, sp, -16 @@ -1195,6 +1420,44 @@ ; RV64IZFH-NEXT: .LBB12_2: # %start ; RV64IZFH-NEXT: ret ; +; RV32IZHINX-LABEL: fcvt_lu_h_sat: +; RV32IZHINX: # %bb.0: # %start +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: sw s0, 8(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: sw s1, 4(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: fcvt.s.h s0, a0 +; RV32IZHINX-NEXT: fle.s a0, zero, s0 +; RV32IZHINX-NEXT: neg s1, a0 +; RV32IZHINX-NEXT: mv a0, s0 +; RV32IZHINX-NEXT: call __fixunssfdi@plt +; RV32IZHINX-NEXT: lui a2, %hi(.LCPI12_0) +; RV32IZHINX-NEXT: addi a2, a2, %lo(.LCPI12_0) +; RV32IZHINX-NEXT: lw a2, 0(a2) +; RV32IZHINX-NEXT: and a0, s1, a0 +; RV32IZHINX-NEXT: flt.s a2, a2, s0 +; RV32IZHINX-NEXT: seqz a2, a2 +; RV32IZHINX-NEXT: addi a2, a2, -1 +; RV32IZHINX-NEXT: or a0, a0, a2 +; RV32IZHINX-NEXT: and a1, s1, a1 +; RV32IZHINX-NEXT: or a1, a1, a2 +; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: lw s0, 8(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: lw s1, 4(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: addi sp, sp, 16 +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: fcvt_lu_h_sat: +; RV64IZHINX: # %bb.0: # %start +; RV64IZHINX-NEXT: feq.h a1, a0, a0 +; RV64IZHINX-NEXT: bnez a1, .LBB12_2 +; RV64IZHINX-NEXT: # %bb.1: # %start +; RV64IZHINX-NEXT: li a0, 0 +; RV64IZHINX-NEXT: ret +; RV64IZHINX-NEXT: .LBB12_2: +; RV64IZHINX-NEXT: fcvt.lu.h a0, a0, rtz +; RV64IZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_lu_h_sat: ; RV32IDZFH: # %bb.0: # %start ; RV32IDZFH-NEXT: addi sp, sp, -16 @@ -1340,6 +1603,20 @@ ; RV64IZFH-NEXT: fcvt.h.w fa0, a0 ; RV64IZFH-NEXT: ret ; +; RV32IZHINX-LABEL: fcvt_h_si: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: slli a0, a0, 16 +; RV32IZHINX-NEXT: srai a0, a0, 16 +; RV32IZHINX-NEXT: fcvt.h.w a0, a0 +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: fcvt_h_si: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: slli a0, a0, 48 +; RV64IZHINX-NEXT: srai a0, a0, 48 +; RV64IZHINX-NEXT: fcvt.h.w a0, a0 +; RV64IZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_h_si: ; RV32IDZFH: # %bb.0: ; RV32IDZFH-NEXT: slli a0, a0, 16 @@ -1387,6 +1664,11 @@ ; CHECKIZFH-NEXT: fcvt.h.w fa0, a0 ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: fcvt_h_si_signext: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: fcvt.h.w a0, a0 +; CHECKIZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_h_si_signext: ; RV32IDZFH: # %bb.0: ; RV32IDZFH-NEXT: fcvt.h.w fa0, a0 @@ -1435,6 +1717,20 @@ ; RV64IZFH-NEXT: fcvt.h.wu fa0, a0 ; RV64IZFH-NEXT: ret ; +; RV32IZHINX-LABEL: fcvt_h_ui: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: slli a0, a0, 16 +; RV32IZHINX-NEXT: srli a0, a0, 16 +; RV32IZHINX-NEXT: fcvt.h.wu a0, a0 +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: fcvt_h_ui: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: slli a0, a0, 48 +; RV64IZHINX-NEXT: srli a0, a0, 48 +; RV64IZHINX-NEXT: fcvt.h.wu a0, a0 +; RV64IZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_h_ui: ; RV32IDZFH: # %bb.0: ; RV32IDZFH-NEXT: slli a0, a0, 16 @@ -1482,6 +1778,11 @@ ; CHECKIZFH-NEXT: fcvt.h.wu fa0, a0 ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: fcvt_h_ui_zeroext: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: fcvt.h.wu a0, a0 +; CHECKIZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_h_ui_zeroext: ; RV32IDZFH: # %bb.0: ; RV32IDZFH-NEXT: fcvt.h.wu fa0, a0 @@ -1521,6 +1822,11 @@ ; CHECKIZFH-NEXT: fcvt.h.w fa0, a0 ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: fcvt_h_w: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: fcvt.h.w a0, a0 +; CHECKIZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_h_w: ; RV32IDZFH: # %bb.0: ; RV32IDZFH-NEXT: fcvt.h.w fa0, a0 @@ -1562,6 +1868,12 @@ ; CHECKIZFH-NEXT: fcvt.h.w fa0, a0 ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: fcvt_h_w_load: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: lw a0, 0(a0) +; CHECKIZHINX-NEXT: fcvt.h.w a0, a0 +; CHECKIZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_h_w_load: ; RV32IDZFH: # %bb.0: ; RV32IDZFH-NEXT: lw a0, 0(a0) @@ -1606,6 +1918,11 @@ ; CHECKIZFH-NEXT: fcvt.h.wu fa0, a0 ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: fcvt_h_wu: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: fcvt.h.wu a0, a0 +; CHECKIZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_h_wu: ; RV32IDZFH: # %bb.0: ; RV32IDZFH-NEXT: fcvt.h.wu fa0, a0 @@ -1653,6 +1970,18 @@ ; RV64IZFH-NEXT: fcvt.h.wu fa0, a0 ; RV64IZFH-NEXT: ret ; +; RV32IZHINX-LABEL: fcvt_h_wu_load: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: lw a0, 0(a0) +; RV32IZHINX-NEXT: fcvt.h.wu a0, a0 +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: fcvt_h_wu_load: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: lwu a0, 0(a0) +; RV64IZHINX-NEXT: fcvt.h.wu a0, a0 +; RV64IZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_h_wu_load: ; RV32IDZFH: # %bb.0: ; RV32IDZFH-NEXT: lw a0, 0(a0) @@ -1706,6 +2035,20 @@ ; RV64IZFH-NEXT: fcvt.h.l fa0, a0 ; RV64IZFH-NEXT: ret ; +; RV32IZHINX-LABEL: fcvt_h_l: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: call __floatdihf@plt +; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: addi sp, sp, 16 +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: fcvt_h_l: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: fcvt.h.l a0, a0 +; RV64IZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_h_l: ; RV32IDZFH: # %bb.0: ; RV32IDZFH-NEXT: addi sp, sp, -16 @@ -1758,6 +2101,20 @@ ; RV64IZFH-NEXT: fcvt.h.lu fa0, a0 ; RV64IZFH-NEXT: ret ; +; RV32IZHINX-LABEL: fcvt_h_lu: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: call __floatundihf@plt +; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: addi sp, sp, 16 +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: fcvt_h_lu: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: fcvt.h.lu a0, a0 +; RV64IZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_h_lu: ; RV32IDZFH: # %bb.0: ; RV32IDZFH-NEXT: addi sp, sp, -16 @@ -1801,6 +2158,11 @@ ; CHECKIZFH-NEXT: fcvt.h.s fa0, fa0 ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: fcvt_h_s: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: fcvt.h.s a0, a0 +; CHECKIZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_h_s: ; RV32IDZFH: # %bb.0: ; RV32IDZFH-NEXT: fcvt.h.s fa0, fa0 @@ -1838,6 +2200,11 @@ ; CHECKIZFH-NEXT: fcvt.s.h fa0, fa0 ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: fcvt_s_h: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: fcvt.s.h a0, a0 +; CHECKIZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_s_h: ; RV32IDZFH: # %bb.0: ; RV32IDZFH-NEXT: fcvt.s.h fa0, fa0 @@ -1892,6 +2259,24 @@ ; RV64IZFH-NEXT: addi sp, sp, 16 ; RV64IZFH-NEXT: ret ; +; RV32IZHINX-LABEL: fcvt_h_d: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: call __truncdfhf2@plt +; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: addi sp, sp, 16 +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: fcvt_h_d: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: addi sp, sp, -16 +; RV64IZHINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZHINX-NEXT: call __truncdfhf2@plt +; RV64IZHINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZHINX-NEXT: addi sp, sp, 16 +; RV64IZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_h_d: ; RV32IDZFH: # %bb.0: ; RV32IDZFH-NEXT: fcvt.h.d fa0, fa0 @@ -1944,6 +2329,26 @@ ; RV64IZFH-NEXT: addi sp, sp, 16 ; RV64IZFH-NEXT: ret ; +; RV32IZHINX-LABEL: fcvt_d_h: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: fcvt.s.h a0, a0 +; RV32IZHINX-NEXT: call __extendsfdf2@plt +; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: addi sp, sp, 16 +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: fcvt_d_h: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: addi sp, sp, -16 +; RV64IZHINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZHINX-NEXT: fcvt.s.h a0, a0 +; RV64IZHINX-NEXT: call __extendsfdf2@plt +; RV64IZHINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZHINX-NEXT: addi sp, sp, 16 +; RV64IZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_d_h: ; RV32IDZFH: # %bb.0: ; RV32IDZFH-NEXT: fcvt.d.h fa0, fa0 @@ -1989,6 +2394,10 @@ ; CHECKIZFH-NEXT: fmv.h.x fa0, a0 ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: bitcast_h_i16: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: bitcast_h_i16: ; RV32IDZFH: # %bb.0: ; RV32IDZFH-NEXT: fmv.h.x fa0, a0 @@ -2016,6 +2425,10 @@ ; CHECKIZFH-NEXT: fmv.x.h a0, fa0 ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: bitcast_i16_h: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: bitcast_i16_h: ; RV32IDZFH: # %bb.0: ; RV32IDZFH-NEXT: fmv.x.h a0, fa0 @@ -2053,6 +2466,22 @@ ; RV64IZFH-NEXT: fsh ft0, 0(a1) ; RV64IZFH-NEXT: ret ; +; RV32IZHINX-LABEL: fcvt_h_w_demanded_bits: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: addi a0, a0, 1 +; RV32IZHINX-NEXT: fcvt.h.w a2, a0 +; RV32IZHINX-NEXT: sh a2, 0(a1) +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: fcvt_h_w_demanded_bits: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: addiw a2, a0, 1 +; RV64IZHINX-NEXT: addi a0, a0, 1 +; RV64IZHINX-NEXT: fcvt.h.w a0, a0 +; RV64IZHINX-NEXT: sh a0, 0(a1) +; RV64IZHINX-NEXT: mv a0, a2 +; RV64IZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_h_w_demanded_bits: ; RV32IDZFH: # %bb.0: ; RV32IDZFH-NEXT: addi a0, a0, 1 @@ -2126,6 +2555,20 @@ ; RV64IZFH-NEXT: fsh ft0, 0(a1) ; RV64IZFH-NEXT: ret ; +; RV32IZHINX-LABEL: fcvt_h_wu_demanded_bits: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: addi a0, a0, 1 +; RV32IZHINX-NEXT: fcvt.h.wu a2, a0 +; RV32IZHINX-NEXT: sh a2, 0(a1) +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: fcvt_h_wu_demanded_bits: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: addiw a0, a0, 1 +; RV64IZHINX-NEXT: fcvt.h.wu a2, a0 +; RV64IZHINX-NEXT: sh a2, 0(a1) +; RV64IZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_h_wu_demanded_bits: ; RV32IDZFH: # %bb.0: ; RV32IDZFH-NEXT: addi a0, a0, 1 @@ -2194,6 +2637,16 @@ ; RV64IZFH-NEXT: fcvt.l.h a0, fa0, rtz ; RV64IZFH-NEXT: ret ; +; RV32IZHINX-LABEL: fcvt_w_s_i16: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: fcvt.w.h a0, a0, rtz +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: fcvt_w_s_i16: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: fcvt.l.h a0, a0, rtz +; RV64IZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_w_s_i16: ; RV32IDZFH: # %bb.0: ; RV32IDZFH-NEXT: fcvt.w.h a0, fa0, rtz @@ -2264,6 +2717,46 @@ ; RV64IZFH-NEXT: .LBB32_2: # %start ; RV64IZFH-NEXT: ret ; +; RV32IZHINX-LABEL: fcvt_w_s_sat_i16: +; RV32IZHINX: # %bb.0: # %start +; RV32IZHINX-NEXT: fcvt.s.h a0, a0 +; RV32IZHINX-NEXT: feq.s a1, a0, a0 +; RV32IZHINX-NEXT: bnez a1, .LBB32_2 +; RV32IZHINX-NEXT: # %bb.1: # %start +; RV32IZHINX-NEXT: li a0, 0 +; RV32IZHINX-NEXT: ret +; RV32IZHINX-NEXT: .LBB32_2: +; RV32IZHINX-NEXT: lui a1, %hi(.LCPI32_0) +; RV32IZHINX-NEXT: addi a1, a1, %lo(.LCPI32_0) +; RV32IZHINX-NEXT: lw a1, 0(a1) +; RV32IZHINX-NEXT: lui a2, %hi(.LCPI32_1) +; RV32IZHINX-NEXT: addi a2, a2, %lo(.LCPI32_1) +; RV32IZHINX-NEXT: lw a2, 0(a2) +; RV32IZHINX-NEXT: fmax.s a0, a0, a1 +; RV32IZHINX-NEXT: fmin.s a0, a0, a2 +; RV32IZHINX-NEXT: fcvt.w.s a0, a0, rtz +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: fcvt_w_s_sat_i16: +; RV64IZHINX: # %bb.0: # %start +; RV64IZHINX-NEXT: fcvt.s.h a0, a0 +; RV64IZHINX-NEXT: feq.s a1, a0, a0 +; RV64IZHINX-NEXT: bnez a1, .LBB32_2 +; RV64IZHINX-NEXT: # %bb.1: # %start +; RV64IZHINX-NEXT: li a0, 0 +; RV64IZHINX-NEXT: ret +; RV64IZHINX-NEXT: .LBB32_2: +; RV64IZHINX-NEXT: lui a1, %hi(.LCPI32_0) +; RV64IZHINX-NEXT: addi a1, a1, %lo(.LCPI32_0) +; RV64IZHINX-NEXT: lw a1, 0(a1) +; RV64IZHINX-NEXT: lui a2, %hi(.LCPI32_1) +; RV64IZHINX-NEXT: addi a2, a2, %lo(.LCPI32_1) +; RV64IZHINX-NEXT: lw a2, 0(a2) +; RV64IZHINX-NEXT: fmax.s a0, a0, a1 +; RV64IZHINX-NEXT: fmin.s a0, a0, a2 +; RV64IZHINX-NEXT: fcvt.l.s a0, a0, rtz +; RV64IZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_w_s_sat_i16: ; RV32IDZFH: # %bb.0: # %start ; RV32IDZFH-NEXT: fcvt.s.h ft0, fa0 @@ -2405,6 +2898,16 @@ ; RV64IZFH-NEXT: fcvt.lu.h a0, fa0, rtz ; RV64IZFH-NEXT: ret ; +; RV32IZHINX-LABEL: fcvt_wu_s_i16: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: fcvt.wu.h a0, a0, rtz +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: fcvt_wu_s_i16: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: fcvt.lu.h a0, a0, rtz +; RV64IZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_wu_s_i16: ; RV32IDZFH: # %bb.0: ; RV32IDZFH-NEXT: fcvt.wu.h a0, fa0, rtz @@ -2465,6 +2968,28 @@ ; RV64IZFH-NEXT: fcvt.lu.s a0, ft0, rtz ; RV64IZFH-NEXT: ret ; +; RV32IZHINX-LABEL: fcvt_wu_s_sat_i16: +; RV32IZHINX: # %bb.0: # %start +; RV32IZHINX-NEXT: lui a1, %hi(.LCPI34_0) +; RV32IZHINX-NEXT: addi a1, a1, %lo(.LCPI34_0) +; RV32IZHINX-NEXT: lw a1, 0(a1) +; RV32IZHINX-NEXT: fcvt.s.h a0, a0 +; RV32IZHINX-NEXT: fmax.s a0, a0, zero +; RV32IZHINX-NEXT: fmin.s a0, a0, a1 +; RV32IZHINX-NEXT: fcvt.wu.s a0, a0, rtz +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: fcvt_wu_s_sat_i16: +; RV64IZHINX: # %bb.0: # %start +; RV64IZHINX-NEXT: lui a1, %hi(.LCPI34_0) +; RV64IZHINX-NEXT: addi a1, a1, %lo(.LCPI34_0) +; RV64IZHINX-NEXT: lw a1, 0(a1) +; RV64IZHINX-NEXT: fcvt.s.h a0, a0 +; RV64IZHINX-NEXT: fmax.s a0, a0, zero +; RV64IZHINX-NEXT: fmin.s a0, a0, a1 +; RV64IZHINX-NEXT: fcvt.lu.s a0, a0, rtz +; RV64IZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_wu_s_sat_i16: ; RV32IDZFH: # %bb.0: # %start ; RV32IDZFH-NEXT: lui a0, %hi(.LCPI34_0) @@ -2584,6 +3109,16 @@ ; RV64IZFH-NEXT: fcvt.l.h a0, fa0, rtz ; RV64IZFH-NEXT: ret ; +; RV32IZHINX-LABEL: fcvt_w_s_i8: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: fcvt.w.h a0, a0, rtz +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: fcvt_w_s_i8: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: fcvt.l.h a0, a0, rtz +; RV64IZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_w_s_i8: ; RV32IDZFH: # %bb.0: ; RV32IDZFH-NEXT: fcvt.w.h a0, fa0, rtz @@ -2654,6 +3189,46 @@ ; RV64IZFH-NEXT: .LBB36_2: # %start ; RV64IZFH-NEXT: ret ; +; RV32IZHINX-LABEL: fcvt_w_s_sat_i8: +; RV32IZHINX: # %bb.0: # %start +; RV32IZHINX-NEXT: fcvt.s.h a0, a0 +; RV32IZHINX-NEXT: feq.s a1, a0, a0 +; RV32IZHINX-NEXT: bnez a1, .LBB36_2 +; RV32IZHINX-NEXT: # %bb.1: # %start +; RV32IZHINX-NEXT: li a0, 0 +; RV32IZHINX-NEXT: ret +; RV32IZHINX-NEXT: .LBB36_2: +; RV32IZHINX-NEXT: lui a1, %hi(.LCPI36_0) +; RV32IZHINX-NEXT: addi a1, a1, %lo(.LCPI36_0) +; RV32IZHINX-NEXT: lw a1, 0(a1) +; RV32IZHINX-NEXT: lui a2, %hi(.LCPI36_1) +; RV32IZHINX-NEXT: addi a2, a2, %lo(.LCPI36_1) +; RV32IZHINX-NEXT: lw a2, 0(a2) +; RV32IZHINX-NEXT: fmax.s a0, a0, a1 +; RV32IZHINX-NEXT: fmin.s a0, a0, a2 +; RV32IZHINX-NEXT: fcvt.w.s a0, a0, rtz +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: fcvt_w_s_sat_i8: +; RV64IZHINX: # %bb.0: # %start +; RV64IZHINX-NEXT: fcvt.s.h a0, a0 +; RV64IZHINX-NEXT: feq.s a1, a0, a0 +; RV64IZHINX-NEXT: bnez a1, .LBB36_2 +; RV64IZHINX-NEXT: # %bb.1: # %start +; RV64IZHINX-NEXT: li a0, 0 +; RV64IZHINX-NEXT: ret +; RV64IZHINX-NEXT: .LBB36_2: +; RV64IZHINX-NEXT: lui a1, %hi(.LCPI36_0) +; RV64IZHINX-NEXT: addi a1, a1, %lo(.LCPI36_0) +; RV64IZHINX-NEXT: lw a1, 0(a1) +; RV64IZHINX-NEXT: lui a2, %hi(.LCPI36_1) +; RV64IZHINX-NEXT: addi a2, a2, %lo(.LCPI36_1) +; RV64IZHINX-NEXT: lw a2, 0(a2) +; RV64IZHINX-NEXT: fmax.s a0, a0, a1 +; RV64IZHINX-NEXT: fmin.s a0, a0, a2 +; RV64IZHINX-NEXT: fcvt.l.s a0, a0, rtz +; RV64IZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_w_s_sat_i8: ; RV32IDZFH: # %bb.0: # %start ; RV32IDZFH-NEXT: fcvt.s.h ft0, fa0 @@ -2794,6 +3369,16 @@ ; RV64IZFH-NEXT: fcvt.lu.h a0, fa0, rtz ; RV64IZFH-NEXT: ret ; +; RV32IZHINX-LABEL: fcvt_wu_s_i8: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: fcvt.wu.h a0, a0, rtz +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: fcvt_wu_s_i8: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: fcvt.lu.h a0, a0, rtz +; RV64IZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_wu_s_i8: ; RV32IDZFH: # %bb.0: ; RV32IDZFH-NEXT: fcvt.wu.h a0, fa0, rtz @@ -2854,6 +3439,28 @@ ; RV64IZFH-NEXT: fcvt.lu.s a0, ft0, rtz ; RV64IZFH-NEXT: ret ; +; RV32IZHINX-LABEL: fcvt_wu_s_sat_i8: +; RV32IZHINX: # %bb.0: # %start +; RV32IZHINX-NEXT: lui a1, %hi(.LCPI38_0) +; RV32IZHINX-NEXT: addi a1, a1, %lo(.LCPI38_0) +; RV32IZHINX-NEXT: lw a1, 0(a1) +; RV32IZHINX-NEXT: fcvt.s.h a0, a0 +; RV32IZHINX-NEXT: fmax.s a0, a0, zero +; RV32IZHINX-NEXT: fmin.s a0, a0, a1 +; RV32IZHINX-NEXT: fcvt.wu.s a0, a0, rtz +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: fcvt_wu_s_sat_i8: +; RV64IZHINX: # %bb.0: # %start +; RV64IZHINX-NEXT: lui a1, %hi(.LCPI38_0) +; RV64IZHINX-NEXT: addi a1, a1, %lo(.LCPI38_0) +; RV64IZHINX-NEXT: lw a1, 0(a1) +; RV64IZHINX-NEXT: fcvt.s.h a0, a0 +; RV64IZHINX-NEXT: fmax.s a0, a0, zero +; RV64IZHINX-NEXT: fmin.s a0, a0, a1 +; RV64IZHINX-NEXT: fcvt.lu.s a0, a0, rtz +; RV64IZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_wu_s_sat_i8: ; RV32IDZFH: # %bb.0: # %start ; RV32IDZFH-NEXT: lui a0, %hi(.LCPI38_0) @@ -2976,6 +3583,30 @@ ; RV64IZFH-NEXT: .LBB39_2: # %start ; RV64IZFH-NEXT: ret ; +; RV32IZHINX-LABEL: fcvt_wu_h_sat_zext: +; RV32IZHINX: # %bb.0: # %start +; RV32IZHINX-NEXT: feq.h a1, a0, a0 +; RV32IZHINX-NEXT: bnez a1, .LBB39_2 +; RV32IZHINX-NEXT: # %bb.1: # %start +; RV32IZHINX-NEXT: li a0, 0 +; RV32IZHINX-NEXT: ret +; RV32IZHINX-NEXT: .LBB39_2: +; RV32IZHINX-NEXT: fcvt.wu.h a0, a0, rtz +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: fcvt_wu_h_sat_zext: +; RV64IZHINX: # %bb.0: # %start +; RV64IZHINX-NEXT: feq.h a1, a0, a0 +; RV64IZHINX-NEXT: bnez a1, .LBB39_2 +; RV64IZHINX-NEXT: # %bb.1: # %start +; RV64IZHINX-NEXT: li a0, 0 +; RV64IZHINX-NEXT: ret +; RV64IZHINX-NEXT: .LBB39_2: +; RV64IZHINX-NEXT: fcvt.wu.h a0, a0, rtz +; RV64IZHINX-NEXT: slli a0, a0, 32 +; RV64IZHINX-NEXT: srli a0, a0, 32 +; RV64IZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_wu_h_sat_zext: ; RV32IDZFH: # %bb.0: # %start ; RV32IDZFH-NEXT: feq.h a0, fa0, fa0 @@ -3084,6 +3715,17 @@ ; CHECKIZFH-NEXT: .LBB40_2: # %start ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: fcvt_w_h_sat_sext: +; CHECKIZHINX: # %bb.0: # %start +; CHECKIZHINX-NEXT: feq.h a1, a0, a0 +; CHECKIZHINX-NEXT: bnez a1, .LBB40_2 +; CHECKIZHINX-NEXT: # %bb.1: # %start +; CHECKIZHINX-NEXT: li a0, 0 +; CHECKIZHINX-NEXT: ret +; CHECKIZHINX-NEXT: .LBB40_2: +; CHECKIZHINX-NEXT: fcvt.w.h a0, a0, rtz +; CHECKIZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: fcvt_w_h_sat_sext: ; RV32IDZFH: # %bb.0: # %start ; RV32IDZFH-NEXT: feq.h a0, fa0, fa0 diff --git a/llvm/test/CodeGen/RISCV/half-fcmp-strict.ll b/llvm/test/CodeGen/RISCV/half-fcmp-strict.ll --- a/llvm/test/CodeGen/RISCV/half-fcmp-strict.ll +++ b/llvm/test/CodeGen/RISCV/half-fcmp-strict.ll @@ -3,12 +3,23 @@ ; RUN: -target-abi ilp32f -disable-strictnode-mutation < %s | FileCheck %s ; RUN: llc -mtriple=riscv64 -mattr=+zfh -verify-machineinstrs \ ; RUN: -target-abi lp64f -disable-strictnode-mutation < %s | FileCheck %s +; RUN: llc -mtriple=riscv32 -mattr=+zhinx -verify-machineinstrs \ +; RUN: -target-abi ilp32 -disable-strictnode-mutation < %s | \ +; RUN: FileCheck --check-prefix=CHECKZHINX %s +; RUN: llc -mtriple=riscv64 -mattr=+zhinx -verify-machineinstrs \ +; RUN: -target-abi lp64 -disable-strictnode-mutation < %s | \ +; RUN: FileCheck --check-prefix=CHECKZHINX %s define i32 @fcmp_oeq(half %a, half %b) nounwind strictfp { ; CHECK-LABEL: fcmp_oeq: ; CHECK: # %bb.0: ; CHECK-NEXT: feq.h a0, fa0, fa1 ; CHECK-NEXT: ret +; +; CHECKZHINX-LABEL: fcmp_oeq: +; CHECKZHINX: # %bb.0: +; CHECKZHINX-NEXT: feq.h a0, a0, a1 +; CHECKZHINX-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmp.f16(half %a, half %b, metadata !"oeq", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 @@ -23,6 +34,15 @@ ; CHECK-NEXT: fsflags a1 ; CHECK-NEXT: feq.h zero, fa1, fa0 ; CHECK-NEXT: ret +; +; CHECKZHINX-LABEL: fcmp_ogt: +; CHECKZHINX: # %bb.0: +; CHECKZHINX-NEXT: frflags a3 +; CHECKZHINX-NEXT: flt.h a2, a1, a0 +; CHECKZHINX-NEXT: fsflags a3 +; CHECKZHINX-NEXT: feq.h zero, a1, a0 +; CHECKZHINX-NEXT: mv a0, a2 +; CHECKZHINX-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmp.f16(half %a, half %b, metadata !"ogt", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 @@ -36,6 +56,15 @@ ; CHECK-NEXT: fsflags a1 ; CHECK-NEXT: feq.h zero, fa1, fa0 ; CHECK-NEXT: ret +; +; CHECKZHINX-LABEL: fcmp_oge: +; CHECKZHINX: # %bb.0: +; CHECKZHINX-NEXT: frflags a3 +; CHECKZHINX-NEXT: fle.h a2, a1, a0 +; CHECKZHINX-NEXT: fsflags a3 +; CHECKZHINX-NEXT: feq.h zero, a1, a0 +; CHECKZHINX-NEXT: mv a0, a2 +; CHECKZHINX-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmp.f16(half %a, half %b, metadata !"oge", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 @@ -49,6 +78,15 @@ ; CHECK-NEXT: fsflags a1 ; CHECK-NEXT: feq.h zero, fa0, fa1 ; CHECK-NEXT: ret +; +; CHECKZHINX-LABEL: fcmp_olt: +; CHECKZHINX: # %bb.0: +; CHECKZHINX-NEXT: frflags a3 +; CHECKZHINX-NEXT: flt.h a2, a0, a1 +; CHECKZHINX-NEXT: fsflags a3 +; CHECKZHINX-NEXT: feq.h zero, a0, a1 +; CHECKZHINX-NEXT: mv a0, a2 +; CHECKZHINX-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmp.f16(half %a, half %b, metadata !"olt", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 @@ -62,6 +100,15 @@ ; CHECK-NEXT: fsflags a1 ; CHECK-NEXT: feq.h zero, fa0, fa1 ; CHECK-NEXT: ret +; +; CHECKZHINX-LABEL: fcmp_ole: +; CHECKZHINX: # %bb.0: +; CHECKZHINX-NEXT: frflags a3 +; CHECKZHINX-NEXT: fle.h a2, a0, a1 +; CHECKZHINX-NEXT: fsflags a3 +; CHECKZHINX-NEXT: feq.h zero, a0, a1 +; CHECKZHINX-NEXT: mv a0, a2 +; CHECKZHINX-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmp.f16(half %a, half %b, metadata !"ole", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 @@ -82,6 +129,20 @@ ; CHECK-NEXT: or a0, a2, a1 ; CHECK-NEXT: feq.h zero, fa1, fa0 ; CHECK-NEXT: ret +; +; CHECKZHINX-LABEL: fcmp_one: +; CHECKZHINX: # %bb.0: +; CHECKZHINX-NEXT: frflags a2 +; CHECKZHINX-NEXT: flt.h a3, a0, a1 +; CHECKZHINX-NEXT: fsflags a2 +; CHECKZHINX-NEXT: feq.h zero, a0, a1 +; CHECKZHINX-NEXT: frflags a2 +; CHECKZHINX-NEXT: flt.h a4, a1, a0 +; CHECKZHINX-NEXT: fsflags a2 +; CHECKZHINX-NEXT: or a2, a4, a3 +; CHECKZHINX-NEXT: feq.h zero, a1, a0 +; CHECKZHINX-NEXT: mv a0, a2 +; CHECKZHINX-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmp.f16(half %a, half %b, metadata !"one", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 @@ -94,6 +155,13 @@ ; CHECK-NEXT: feq.h a1, fa0, fa0 ; CHECK-NEXT: and a0, a1, a0 ; CHECK-NEXT: ret +; +; CHECKZHINX-LABEL: fcmp_ord: +; CHECKZHINX: # %bb.0: +; CHECKZHINX-NEXT: feq.h a1, a1, a1 +; CHECKZHINX-NEXT: feq.h a0, a0, a0 +; CHECKZHINX-NEXT: and a0, a0, a1 +; CHECKZHINX-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmp.f16(half %a, half %b, metadata !"ord", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 @@ -115,6 +183,21 @@ ; CHECK-NEXT: xori a0, a0, 1 ; CHECK-NEXT: feq.h zero, fa1, fa0 ; CHECK-NEXT: ret +; +; CHECKZHINX-LABEL: fcmp_ueq: +; CHECKZHINX: # %bb.0: +; CHECKZHINX-NEXT: frflags a2 +; CHECKZHINX-NEXT: flt.h a3, a0, a1 +; CHECKZHINX-NEXT: fsflags a2 +; CHECKZHINX-NEXT: feq.h zero, a0, a1 +; CHECKZHINX-NEXT: frflags a2 +; CHECKZHINX-NEXT: flt.h a4, a1, a0 +; CHECKZHINX-NEXT: fsflags a2 +; CHECKZHINX-NEXT: or a2, a4, a3 +; CHECKZHINX-NEXT: xori a2, a2, 1 +; CHECKZHINX-NEXT: feq.h zero, a1, a0 +; CHECKZHINX-NEXT: mv a0, a2 +; CHECKZHINX-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmp.f16(half %a, half %b, metadata !"ueq", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 @@ -129,6 +212,16 @@ ; CHECK-NEXT: xori a0, a1, 1 ; CHECK-NEXT: feq.h zero, fa0, fa1 ; CHECK-NEXT: ret +; +; CHECKZHINX-LABEL: fcmp_ugt: +; CHECKZHINX: # %bb.0: +; CHECKZHINX-NEXT: frflags a2 +; CHECKZHINX-NEXT: fle.h a3, a0, a1 +; CHECKZHINX-NEXT: fsflags a2 +; CHECKZHINX-NEXT: xori a2, a3, 1 +; CHECKZHINX-NEXT: feq.h zero, a0, a1 +; CHECKZHINX-NEXT: mv a0, a2 +; CHECKZHINX-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmp.f16(half %a, half %b, metadata !"ugt", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 @@ -143,6 +236,16 @@ ; CHECK-NEXT: xori a0, a1, 1 ; CHECK-NEXT: feq.h zero, fa0, fa1 ; CHECK-NEXT: ret +; +; CHECKZHINX-LABEL: fcmp_uge: +; CHECKZHINX: # %bb.0: +; CHECKZHINX-NEXT: frflags a2 +; CHECKZHINX-NEXT: flt.h a3, a0, a1 +; CHECKZHINX-NEXT: fsflags a2 +; CHECKZHINX-NEXT: xori a2, a3, 1 +; CHECKZHINX-NEXT: feq.h zero, a0, a1 +; CHECKZHINX-NEXT: mv a0, a2 +; CHECKZHINX-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmp.f16(half %a, half %b, metadata !"uge", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 @@ -157,6 +260,16 @@ ; CHECK-NEXT: xori a0, a1, 1 ; CHECK-NEXT: feq.h zero, fa1, fa0 ; CHECK-NEXT: ret +; +; CHECKZHINX-LABEL: fcmp_ult: +; CHECKZHINX: # %bb.0: +; CHECKZHINX-NEXT: frflags a2 +; CHECKZHINX-NEXT: fle.h a3, a1, a0 +; CHECKZHINX-NEXT: fsflags a2 +; CHECKZHINX-NEXT: xori a2, a3, 1 +; CHECKZHINX-NEXT: feq.h zero, a1, a0 +; CHECKZHINX-NEXT: mv a0, a2 +; CHECKZHINX-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmp.f16(half %a, half %b, metadata !"ult", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 @@ -171,6 +284,16 @@ ; CHECK-NEXT: xori a0, a1, 1 ; CHECK-NEXT: feq.h zero, fa1, fa0 ; CHECK-NEXT: ret +; +; CHECKZHINX-LABEL: fcmp_ule: +; CHECKZHINX: # %bb.0: +; CHECKZHINX-NEXT: frflags a2 +; CHECKZHINX-NEXT: flt.h a3, a1, a0 +; CHECKZHINX-NEXT: fsflags a2 +; CHECKZHINX-NEXT: xori a2, a3, 1 +; CHECKZHINX-NEXT: feq.h zero, a1, a0 +; CHECKZHINX-NEXT: mv a0, a2 +; CHECKZHINX-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmp.f16(half %a, half %b, metadata !"ule", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 @@ -182,6 +305,12 @@ ; CHECK-NEXT: feq.h a0, fa0, fa1 ; CHECK-NEXT: xori a0, a0, 1 ; CHECK-NEXT: ret +; +; CHECKZHINX-LABEL: fcmp_une: +; CHECKZHINX: # %bb.0: +; CHECKZHINX-NEXT: feq.h a0, a0, a1 +; CHECKZHINX-NEXT: xori a0, a0, 1 +; CHECKZHINX-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmp.f16(half %a, half %b, metadata !"une", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 @@ -195,6 +324,14 @@ ; CHECK-NEXT: and a0, a1, a0 ; CHECK-NEXT: xori a0, a0, 1 ; CHECK-NEXT: ret +; +; CHECKZHINX-LABEL: fcmp_uno: +; CHECKZHINX: # %bb.0: +; CHECKZHINX-NEXT: feq.h a1, a1, a1 +; CHECKZHINX-NEXT: feq.h a0, a0, a0 +; CHECKZHINX-NEXT: and a0, a0, a1 +; CHECKZHINX-NEXT: xori a0, a0, 1 +; CHECKZHINX-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmp.f16(half %a, half %b, metadata !"uno", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 @@ -207,6 +344,13 @@ ; CHECK-NEXT: fle.h a1, fa0, fa1 ; CHECK-NEXT: and a0, a1, a0 ; CHECK-NEXT: ret +; +; CHECKZHINX-LABEL: fcmps_oeq: +; CHECKZHINX: # %bb.0: +; CHECKZHINX-NEXT: fle.h a2, a1, a0 +; CHECKZHINX-NEXT: fle.h a0, a0, a1 +; CHECKZHINX-NEXT: and a0, a0, a2 +; CHECKZHINX-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmps.f16(half %a, half %b, metadata !"oeq", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 @@ -218,6 +362,11 @@ ; CHECK: # %bb.0: ; CHECK-NEXT: flt.h a0, fa1, fa0 ; CHECK-NEXT: ret +; +; CHECKZHINX-LABEL: fcmps_ogt: +; CHECKZHINX: # %bb.0: +; CHECKZHINX-NEXT: flt.h a0, a1, a0 +; CHECKZHINX-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmps.f16(half %a, half %b, metadata !"ogt", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 @@ -228,6 +377,11 @@ ; CHECK: # %bb.0: ; CHECK-NEXT: fle.h a0, fa1, fa0 ; CHECK-NEXT: ret +; +; CHECKZHINX-LABEL: fcmps_oge: +; CHECKZHINX: # %bb.0: +; CHECKZHINX-NEXT: fle.h a0, a1, a0 +; CHECKZHINX-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmps.f16(half %a, half %b, metadata !"oge", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 @@ -238,6 +392,11 @@ ; CHECK: # %bb.0: ; CHECK-NEXT: flt.h a0, fa0, fa1 ; CHECK-NEXT: ret +; +; CHECKZHINX-LABEL: fcmps_olt: +; CHECKZHINX: # %bb.0: +; CHECKZHINX-NEXT: flt.h a0, a0, a1 +; CHECKZHINX-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmps.f16(half %a, half %b, metadata !"olt", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 @@ -248,6 +407,11 @@ ; CHECK: # %bb.0: ; CHECK-NEXT: fle.h a0, fa0, fa1 ; CHECK-NEXT: ret +; +; CHECKZHINX-LABEL: fcmps_ole: +; CHECKZHINX: # %bb.0: +; CHECKZHINX-NEXT: fle.h a0, a0, a1 +; CHECKZHINX-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmps.f16(half %a, half %b, metadata !"ole", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 @@ -260,6 +424,13 @@ ; CHECK-NEXT: flt.h a1, fa1, fa0 ; CHECK-NEXT: or a0, a1, a0 ; CHECK-NEXT: ret +; +; CHECKZHINX-LABEL: fcmps_one: +; CHECKZHINX: # %bb.0: +; CHECKZHINX-NEXT: flt.h a2, a0, a1 +; CHECKZHINX-NEXT: flt.h a0, a1, a0 +; CHECKZHINX-NEXT: or a0, a0, a2 +; CHECKZHINX-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmps.f16(half %a, half %b, metadata !"one", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 @@ -272,6 +443,13 @@ ; CHECK-NEXT: fle.h a1, fa0, fa0 ; CHECK-NEXT: and a0, a1, a0 ; CHECK-NEXT: ret +; +; CHECKZHINX-LABEL: fcmps_ord: +; CHECKZHINX: # %bb.0: +; CHECKZHINX-NEXT: fle.h a1, a1, a1 +; CHECKZHINX-NEXT: fle.h a0, a0, a0 +; CHECKZHINX-NEXT: and a0, a0, a1 +; CHECKZHINX-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmps.f16(half %a, half %b, metadata !"ord", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 @@ -285,6 +463,14 @@ ; CHECK-NEXT: or a0, a1, a0 ; CHECK-NEXT: xori a0, a0, 1 ; CHECK-NEXT: ret +; +; CHECKZHINX-LABEL: fcmps_ueq: +; CHECKZHINX: # %bb.0: +; CHECKZHINX-NEXT: flt.h a2, a0, a1 +; CHECKZHINX-NEXT: flt.h a0, a1, a0 +; CHECKZHINX-NEXT: or a0, a0, a2 +; CHECKZHINX-NEXT: xori a0, a0, 1 +; CHECKZHINX-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmps.f16(half %a, half %b, metadata !"ueq", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 @@ -296,6 +482,12 @@ ; CHECK-NEXT: fle.h a0, fa0, fa1 ; CHECK-NEXT: xori a0, a0, 1 ; CHECK-NEXT: ret +; +; CHECKZHINX-LABEL: fcmps_ugt: +; CHECKZHINX: # %bb.0: +; CHECKZHINX-NEXT: fle.h a0, a0, a1 +; CHECKZHINX-NEXT: xori a0, a0, 1 +; CHECKZHINX-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmps.f16(half %a, half %b, metadata !"ugt", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 @@ -307,6 +499,12 @@ ; CHECK-NEXT: flt.h a0, fa0, fa1 ; CHECK-NEXT: xori a0, a0, 1 ; CHECK-NEXT: ret +; +; CHECKZHINX-LABEL: fcmps_uge: +; CHECKZHINX: # %bb.0: +; CHECKZHINX-NEXT: flt.h a0, a0, a1 +; CHECKZHINX-NEXT: xori a0, a0, 1 +; CHECKZHINX-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmps.f16(half %a, half %b, metadata !"uge", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 @@ -318,6 +516,12 @@ ; CHECK-NEXT: fle.h a0, fa1, fa0 ; CHECK-NEXT: xori a0, a0, 1 ; CHECK-NEXT: ret +; +; CHECKZHINX-LABEL: fcmps_ult: +; CHECKZHINX: # %bb.0: +; CHECKZHINX-NEXT: fle.h a0, a1, a0 +; CHECKZHINX-NEXT: xori a0, a0, 1 +; CHECKZHINX-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmps.f16(half %a, half %b, metadata !"ult", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 @@ -329,6 +533,12 @@ ; CHECK-NEXT: flt.h a0, fa1, fa0 ; CHECK-NEXT: xori a0, a0, 1 ; CHECK-NEXT: ret +; +; CHECKZHINX-LABEL: fcmps_ule: +; CHECKZHINX: # %bb.0: +; CHECKZHINX-NEXT: flt.h a0, a1, a0 +; CHECKZHINX-NEXT: xori a0, a0, 1 +; CHECKZHINX-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmps.f16(half %a, half %b, metadata !"ule", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 @@ -342,6 +552,14 @@ ; CHECK-NEXT: and a0, a1, a0 ; CHECK-NEXT: xori a0, a0, 1 ; CHECK-NEXT: ret +; +; CHECKZHINX-LABEL: fcmps_une: +; CHECKZHINX: # %bb.0: +; CHECKZHINX-NEXT: fle.h a2, a1, a0 +; CHECKZHINX-NEXT: fle.h a0, a0, a1 +; CHECKZHINX-NEXT: and a0, a0, a2 +; CHECKZHINX-NEXT: xori a0, a0, 1 +; CHECKZHINX-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmps.f16(half %a, half %b, metadata !"une", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 @@ -355,6 +573,14 @@ ; CHECK-NEXT: and a0, a1, a0 ; CHECK-NEXT: xori a0, a0, 1 ; CHECK-NEXT: ret +; +; CHECKZHINX-LABEL: fcmps_uno: +; CHECKZHINX: # %bb.0: +; CHECKZHINX-NEXT: fle.h a1, a1, a1 +; CHECKZHINX-NEXT: fle.h a0, a0, a0 +; CHECKZHINX-NEXT: and a0, a0, a1 +; CHECKZHINX-NEXT: xori a0, a0, 1 +; CHECKZHINX-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmps.f16(half %a, half %b, metadata !"uno", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 diff --git a/llvm/test/CodeGen/RISCV/half-fcmp.ll b/llvm/test/CodeGen/RISCV/half-fcmp.ll --- a/llvm/test/CodeGen/RISCV/half-fcmp.ll +++ b/llvm/test/CodeGen/RISCV/half-fcmp.ll @@ -3,6 +3,10 @@ ; RUN: -target-abi ilp32f < %s | FileCheck -check-prefix=CHECKIZFH %s ; RUN: llc -mtriple=riscv64 -mattr=+zfh -verify-machineinstrs \ ; RUN: -target-abi lp64f < %s | FileCheck -check-prefix=CHECKIZFH %s +; RUN: llc -mtriple=riscv32 -mattr=+zhinx -verify-machineinstrs \ +; RUN: -target-abi ilp32 < %s | FileCheck -check-prefix=CHECKIZHINX %s +; RUN: llc -mtriple=riscv64 -mattr=+zhinx -verify-machineinstrs \ +; RUN: -target-abi lp64 < %s | FileCheck -check-prefix=CHECKIZHINX %s ; RUN: llc -mtriple=riscv32 -mattr=+zfh -verify-machineinstrs \ ; RUN: < %s | FileCheck -check-prefix=RV32I %s ; RUN: llc -mtriple=riscv64 -mattr=+zfh -verify-machineinstrs \ @@ -14,6 +18,11 @@ ; CHECKIZFH-NEXT: li a0, 0 ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: fcmp_false: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: li a0, 0 +; CHECKIZHINX-NEXT: ret +; ; RV32I-LABEL: fcmp_false: ; RV32I: # %bb.0: ; RV32I-NEXT: li a0, 0 @@ -34,6 +43,11 @@ ; CHECKIZFH-NEXT: feq.h a0, fa0, fa1 ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: fcmp_oeq: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: feq.h a0, a0, a1 +; CHECKIZHINX-NEXT: ret +; ; RV32I-LABEL: fcmp_oeq: ; RV32I: # %bb.0: ; RV32I-NEXT: fmv.h.x ft0, a1 @@ -58,6 +72,11 @@ ; CHECKIZFH-NEXT: flt.h a0, fa1, fa0 ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: fcmp_ogt: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: flt.h a0, a1, a0 +; CHECKIZHINX-NEXT: ret +; ; RV32I-LABEL: fcmp_ogt: ; RV32I: # %bb.0: ; RV32I-NEXT: fmv.h.x ft0, a0 @@ -82,6 +101,11 @@ ; CHECKIZFH-NEXT: fle.h a0, fa1, fa0 ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: fcmp_oge: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: fle.h a0, a1, a0 +; CHECKIZHINX-NEXT: ret +; ; RV32I-LABEL: fcmp_oge: ; RV32I: # %bb.0: ; RV32I-NEXT: fmv.h.x ft0, a0 @@ -106,6 +130,11 @@ ; CHECKIZFH-NEXT: flt.h a0, fa0, fa1 ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: fcmp_olt: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: flt.h a0, a0, a1 +; CHECKIZHINX-NEXT: ret +; ; RV32I-LABEL: fcmp_olt: ; RV32I: # %bb.0: ; RV32I-NEXT: fmv.h.x ft0, a1 @@ -130,6 +159,11 @@ ; CHECKIZFH-NEXT: fle.h a0, fa0, fa1 ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: fcmp_ole: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: fle.h a0, a0, a1 +; CHECKIZHINX-NEXT: ret +; ; RV32I-LABEL: fcmp_ole: ; RV32I: # %bb.0: ; RV32I-NEXT: fmv.h.x ft0, a1 @@ -156,6 +190,13 @@ ; CHECKIZFH-NEXT: or a0, a1, a0 ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: fcmp_one: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: flt.h a2, a0, a1 +; CHECKIZHINX-NEXT: flt.h a0, a1, a0 +; CHECKIZHINX-NEXT: or a0, a0, a2 +; CHECKIZHINX-NEXT: ret +; ; RV32I-LABEL: fcmp_one: ; RV32I: # %bb.0: ; RV32I-NEXT: fmv.h.x ft0, a1 @@ -186,6 +227,13 @@ ; CHECKIZFH-NEXT: and a0, a1, a0 ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: fcmp_ord: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: feq.h a1, a1, a1 +; CHECKIZHINX-NEXT: feq.h a0, a0, a0 +; CHECKIZHINX-NEXT: and a0, a0, a1 +; CHECKIZHINX-NEXT: ret +; ; RV32I-LABEL: fcmp_ord: ; RV32I: # %bb.0: ; RV32I-NEXT: fmv.h.x ft0, a0 @@ -217,6 +265,14 @@ ; CHECKIZFH-NEXT: xori a0, a0, 1 ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: fcmp_ueq: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: flt.h a2, a0, a1 +; CHECKIZHINX-NEXT: flt.h a0, a1, a0 +; CHECKIZHINX-NEXT: or a0, a0, a2 +; CHECKIZHINX-NEXT: xori a0, a0, 1 +; CHECKIZHINX-NEXT: ret +; ; RV32I-LABEL: fcmp_ueq: ; RV32I: # %bb.0: ; RV32I-NEXT: fmv.h.x ft0, a1 @@ -248,6 +304,12 @@ ; CHECKIZFH-NEXT: xori a0, a0, 1 ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: fcmp_ugt: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: fle.h a0, a0, a1 +; CHECKIZHINX-NEXT: xori a0, a0, 1 +; CHECKIZHINX-NEXT: ret +; ; RV32I-LABEL: fcmp_ugt: ; RV32I: # %bb.0: ; RV32I-NEXT: fmv.h.x ft0, a1 @@ -275,6 +337,12 @@ ; CHECKIZFH-NEXT: xori a0, a0, 1 ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: fcmp_uge: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: flt.h a0, a0, a1 +; CHECKIZHINX-NEXT: xori a0, a0, 1 +; CHECKIZHINX-NEXT: ret +; ; RV32I-LABEL: fcmp_uge: ; RV32I: # %bb.0: ; RV32I-NEXT: fmv.h.x ft0, a1 @@ -302,6 +370,12 @@ ; CHECKIZFH-NEXT: xori a0, a0, 1 ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: fcmp_ult: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: fle.h a0, a1, a0 +; CHECKIZHINX-NEXT: xori a0, a0, 1 +; CHECKIZHINX-NEXT: ret +; ; RV32I-LABEL: fcmp_ult: ; RV32I: # %bb.0: ; RV32I-NEXT: fmv.h.x ft0, a0 @@ -329,6 +403,12 @@ ; CHECKIZFH-NEXT: xori a0, a0, 1 ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: fcmp_ule: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: flt.h a0, a1, a0 +; CHECKIZHINX-NEXT: xori a0, a0, 1 +; CHECKIZHINX-NEXT: ret +; ; RV32I-LABEL: fcmp_ule: ; RV32I: # %bb.0: ; RV32I-NEXT: fmv.h.x ft0, a0 @@ -356,6 +436,12 @@ ; CHECKIZFH-NEXT: xori a0, a0, 1 ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: fcmp_une: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: feq.h a0, a0, a1 +; CHECKIZHINX-NEXT: xori a0, a0, 1 +; CHECKIZHINX-NEXT: ret +; ; RV32I-LABEL: fcmp_une: ; RV32I: # %bb.0: ; RV32I-NEXT: fmv.h.x ft0, a1 @@ -385,6 +471,14 @@ ; CHECKIZFH-NEXT: xori a0, a0, 1 ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: fcmp_uno: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: feq.h a1, a1, a1 +; CHECKIZHINX-NEXT: feq.h a0, a0, a0 +; CHECKIZHINX-NEXT: and a0, a0, a1 +; CHECKIZHINX-NEXT: xori a0, a0, 1 +; CHECKIZHINX-NEXT: ret +; ; RV32I-LABEL: fcmp_uno: ; RV32I: # %bb.0: ; RV32I-NEXT: fmv.h.x ft0, a0 @@ -415,6 +509,11 @@ ; CHECKIZFH-NEXT: li a0, 1 ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: fcmp_true: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: li a0, 1 +; CHECKIZHINX-NEXT: ret +; ; RV32I-LABEL: fcmp_true: ; RV32I: # %bb.0: ; RV32I-NEXT: li a0, 1 diff --git a/llvm/test/CodeGen/RISCV/half-frem.ll b/llvm/test/CodeGen/RISCV/half-frem.ll --- a/llvm/test/CodeGen/RISCV/half-frem.ll +++ b/llvm/test/CodeGen/RISCV/half-frem.ll @@ -5,6 +5,12 @@ ; RUN: llc -mtriple=riscv64 -mattr=+zfh -verify-machineinstrs \ ; RUN: -target-abi lp64f < %s \ ; RUN: | FileCheck -check-prefix=RV64IZFH %s +; RUN: llc -mtriple=riscv32 -mattr=+zhinx -verify-machineinstrs \ +; RUN: -target-abi ilp32 < %s \ +; RUN: | FileCheck -check-prefix=RV32IZHINX %s +; RUN: llc -mtriple=riscv64 -mattr=+zhinx -verify-machineinstrs \ +; RUN: -target-abi lp64 < %s \ +; RUN: | FileCheck -check-prefix=RV64IZHINX %s define half @frem_f16(half %a, half %b) nounwind { ; RV32IZFH-LABEL: frem_f16: @@ -30,6 +36,30 @@ ; RV64IZFH-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64IZFH-NEXT: addi sp, sp, 16 ; RV64IZFH-NEXT: ret +; +; RV32IZHINX-LABEL: frem_f16: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: fcvt.s.h a0, a0 +; RV32IZHINX-NEXT: fcvt.s.h a1, a1 +; RV32IZHINX-NEXT: call fmodf@plt +; RV32IZHINX-NEXT: fcvt.h.s a0, a0 +; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: addi sp, sp, 16 +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: frem_f16: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: addi sp, sp, -16 +; RV64IZHINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZHINX-NEXT: fcvt.s.h a0, a0 +; RV64IZHINX-NEXT: fcvt.s.h a1, a1 +; RV64IZHINX-NEXT: call fmodf@plt +; RV64IZHINX-NEXT: fcvt.h.s a0, a0 +; RV64IZHINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZHINX-NEXT: addi sp, sp, 16 +; RV64IZHINX-NEXT: ret %1 = frem half %a, %b ret half %1 } diff --git a/llvm/test/CodeGen/RISCV/half-imm.ll b/llvm/test/CodeGen/RISCV/half-imm.ll --- a/llvm/test/CodeGen/RISCV/half-imm.ll +++ b/llvm/test/CodeGen/RISCV/half-imm.ll @@ -3,6 +3,10 @@ ; RUN: -target-abi ilp32f < %s | FileCheck %s ; RUN: llc -mtriple=riscv64 -mattr=+zfh -verify-machineinstrs \ ; RUN: -target-abi lp64f < %s | FileCheck %s +; RUN: llc -mtriple=riscv32 -mattr=+zhinx -verify-machineinstrs \ +; RUN: -target-abi ilp32 < %s | FileCheck --check-prefix=CHECKZHINX %s +; RUN: llc -mtriple=riscv64 -mattr=+zhinx -verify-machineinstrs \ +; RUN: -target-abi lp64 < %s | FileCheck --check-prefix=CHECKZHINX %s ; TODO: constant pool shouldn't be necessary for RV32IZfh and RV64IZfh define half @half_imm() nounwind { @@ -11,6 +15,13 @@ ; CHECK-NEXT: lui a0, %hi(.LCPI0_0) ; CHECK-NEXT: flh fa0, %lo(.LCPI0_0)(a0) ; CHECK-NEXT: ret +; +; CHECKZHINX-LABEL: half_imm: +; CHECKZHINX: # %bb.0: +; CHECKZHINX-NEXT: lui a0, %hi(.LCPI0_0) +; CHECKZHINX-NEXT: addi a0, a0, %lo(.LCPI0_0) +; CHECKZHINX-NEXT: lh a0, 0(a0) +; CHECKZHINX-NEXT: ret ret half 3.0 } @@ -21,6 +32,14 @@ ; CHECK-NEXT: flh ft0, %lo(.LCPI1_0)(a0) ; CHECK-NEXT: fadd.h fa0, fa0, ft0 ; CHECK-NEXT: ret +; +; CHECKZHINX-LABEL: half_imm_op: +; CHECKZHINX: # %bb.0: +; CHECKZHINX-NEXT: lui a1, %hi(.LCPI1_0) +; CHECKZHINX-NEXT: addi a1, a1, %lo(.LCPI1_0) +; CHECKZHINX-NEXT: lh a1, 0(a1) +; CHECKZHINX-NEXT: fadd.h a0, a0, a1 +; CHECKZHINX-NEXT: ret %1 = fadd half %a, 1.0 ret half %1 } 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 @@ -5,6 +5,12 @@ ; RUN: sed 's/iXLen/i64/g' %s | llc -mtriple=riscv64 -mattr=+zfh \ ; RUN: -verify-machineinstrs -target-abi lp64f | \ ; RUN: FileCheck -check-prefixes=CHECKIZFH,RV64IZFH,RV64IFZFH %s +; RUN: sed 's/iXLen/i32/g' %s | llc -mtriple=riscv32 -mattr=+zhinx \ +; RUN: -verify-machineinstrs -target-abi ilp32 | \ +; RUN: FileCheck -check-prefixes=CHECKIZHINX,RV32IZHINX %s +; RUN: sed 's/iXLen/i64/g' %s | llc -mtriple=riscv64 -mattr=+zhinx \ +; RUN: -verify-machineinstrs -target-abi lp64 | \ +; RUN: FileCheck -check-prefixes=CHECKIZHINX,RV64IZHINX %s ; RUN: sed 's/iXLen/i32/g' %s | llc -mtriple=riscv32 -mattr=+d \ ; RUN: -mattr=+zfh -verify-machineinstrs -target-abi ilp32d | \ ; RUN: FileCheck -check-prefixes=CHECKIZFH,RV32IZFH,RV32IDZFH %s @@ -26,6 +32,11 @@ ; CHECKIZFH-NEXT: fsqrt.h fa0, fa0 ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: sqrt_f16: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: fsqrt.h a0, a0 +; CHECKIZHINX-NEXT: ret +; ; RV32I-LABEL: sqrt_f16: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -81,6 +92,29 @@ ; RV64IZFH-NEXT: addi sp, sp, 16 ; RV64IZFH-NEXT: ret ; +; RV32IZHINX-LABEL: powi_f16: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: fcvt.s.h a0, a0 +; RV32IZHINX-NEXT: call __powisf2@plt +; RV32IZHINX-NEXT: fcvt.h.s a0, a0 +; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: addi sp, sp, 16 +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: powi_f16: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: addi sp, sp, -16 +; RV64IZHINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZHINX-NEXT: sext.w a1, a1 +; RV64IZHINX-NEXT: fcvt.s.h a0, a0 +; RV64IZHINX-NEXT: call __powisf2@plt +; RV64IZHINX-NEXT: fcvt.h.s a0, a0 +; RV64IZHINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZHINX-NEXT: addi sp, sp, 16 +; RV64IZHINX-NEXT: ret +; ; RV32I-LABEL: powi_f16: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -143,6 +177,28 @@ ; RV64IZFH-NEXT: addi sp, sp, 16 ; RV64IZFH-NEXT: ret ; +; RV32IZHINX-LABEL: sin_f16: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: fcvt.s.h a0, a0 +; RV32IZHINX-NEXT: call sinf@plt +; RV32IZHINX-NEXT: fcvt.h.s a0, a0 +; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: addi sp, sp, 16 +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: sin_f16: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: addi sp, sp, -16 +; RV64IZHINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZHINX-NEXT: fcvt.s.h a0, a0 +; RV64IZHINX-NEXT: call sinf@plt +; RV64IZHINX-NEXT: fcvt.h.s a0, a0 +; RV64IZHINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZHINX-NEXT: addi sp, sp, 16 +; RV64IZHINX-NEXT: ret +; ; RV32I-LABEL: sin_f16: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -197,6 +253,28 @@ ; RV64IZFH-NEXT: addi sp, sp, 16 ; RV64IZFH-NEXT: ret ; +; RV32IZHINX-LABEL: cos_f16: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: fcvt.s.h a0, a0 +; RV32IZHINX-NEXT: call cosf@plt +; RV32IZHINX-NEXT: fcvt.h.s a0, a0 +; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: addi sp, sp, 16 +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: cos_f16: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: addi sp, sp, -16 +; RV64IZHINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZHINX-NEXT: fcvt.s.h a0, a0 +; RV64IZHINX-NEXT: call cosf@plt +; RV64IZHINX-NEXT: fcvt.h.s a0, a0 +; RV64IZHINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZHINX-NEXT: addi sp, sp, 16 +; RV64IZHINX-NEXT: ret +; ; RV32I-LABEL: cos_f16: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -268,6 +346,46 @@ ; RV64IFZFH-NEXT: addi sp, sp, 16 ; RV64IFZFH-NEXT: ret ; +; RV32IZHINX-LABEL: sincos_f16: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: sw s0, 8(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: sw s1, 4(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: fcvt.s.h s0, a0 +; RV32IZHINX-NEXT: mv a0, s0 +; RV32IZHINX-NEXT: call sinf@plt +; RV32IZHINX-NEXT: fcvt.h.s s1, a0 +; RV32IZHINX-NEXT: mv a0, s0 +; RV32IZHINX-NEXT: call cosf@plt +; RV32IZHINX-NEXT: fcvt.h.s a0, a0 +; RV32IZHINX-NEXT: fadd.h a0, s1, a0 +; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: lw s0, 8(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: lw s1, 4(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: addi sp, sp, 16 +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: sincos_f16: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: addi sp, sp, -32 +; RV64IZHINX-NEXT: sd ra, 24(sp) # 8-byte Folded Spill +; RV64IZHINX-NEXT: sd s0, 16(sp) # 8-byte Folded Spill +; RV64IZHINX-NEXT: sd s1, 8(sp) # 8-byte Folded Spill +; RV64IZHINX-NEXT: fcvt.s.h s0, a0 +; RV64IZHINX-NEXT: mv a0, s0 +; RV64IZHINX-NEXT: call sinf@plt +; RV64IZHINX-NEXT: fcvt.h.s s1, a0 +; RV64IZHINX-NEXT: mv a0, s0 +; RV64IZHINX-NEXT: call cosf@plt +; RV64IZHINX-NEXT: fcvt.h.s a0, a0 +; RV64IZHINX-NEXT: fadd.h a0, s1, a0 +; RV64IZHINX-NEXT: ld ra, 24(sp) # 8-byte Folded Reload +; RV64IZHINX-NEXT: ld s0, 16(sp) # 8-byte Folded Reload +; RV64IZHINX-NEXT: ld s1, 8(sp) # 8-byte Folded Reload +; RV64IZHINX-NEXT: addi sp, sp, 32 +; RV64IZHINX-NEXT: ret +; ; RV32IDZFH-LABEL: sincos_f16: ; RV32IDZFH: # %bb.0: ; RV32IDZFH-NEXT: addi sp, sp, -32 @@ -410,6 +528,30 @@ ; RV64IZFH-NEXT: addi sp, sp, 16 ; RV64IZFH-NEXT: ret ; +; RV32IZHINX-LABEL: pow_f16: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: fcvt.s.h a0, a0 +; RV32IZHINX-NEXT: fcvt.s.h a1, a1 +; RV32IZHINX-NEXT: call powf@plt +; RV32IZHINX-NEXT: fcvt.h.s a0, a0 +; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: addi sp, sp, 16 +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: pow_f16: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: addi sp, sp, -16 +; RV64IZHINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZHINX-NEXT: fcvt.s.h a0, a0 +; RV64IZHINX-NEXT: fcvt.s.h a1, a1 +; RV64IZHINX-NEXT: call powf@plt +; RV64IZHINX-NEXT: fcvt.h.s a0, a0 +; RV64IZHINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZHINX-NEXT: addi sp, sp, 16 +; RV64IZHINX-NEXT: ret +; ; RV32I-LABEL: pow_f16: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -490,6 +632,28 @@ ; RV64IZFH-NEXT: addi sp, sp, 16 ; RV64IZFH-NEXT: ret ; +; RV32IZHINX-LABEL: exp_f16: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: fcvt.s.h a0, a0 +; RV32IZHINX-NEXT: call expf@plt +; RV32IZHINX-NEXT: fcvt.h.s a0, a0 +; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: addi sp, sp, 16 +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: exp_f16: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: addi sp, sp, -16 +; RV64IZHINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZHINX-NEXT: fcvt.s.h a0, a0 +; RV64IZHINX-NEXT: call expf@plt +; RV64IZHINX-NEXT: fcvt.h.s a0, a0 +; RV64IZHINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZHINX-NEXT: addi sp, sp, 16 +; RV64IZHINX-NEXT: ret +; ; RV32I-LABEL: exp_f16: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -544,6 +708,28 @@ ; RV64IZFH-NEXT: addi sp, sp, 16 ; RV64IZFH-NEXT: ret ; +; RV32IZHINX-LABEL: exp2_f16: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: fcvt.s.h a0, a0 +; RV32IZHINX-NEXT: call exp2f@plt +; RV32IZHINX-NEXT: fcvt.h.s a0, a0 +; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: addi sp, sp, 16 +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: exp2_f16: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: addi sp, sp, -16 +; RV64IZHINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZHINX-NEXT: fcvt.s.h a0, a0 +; RV64IZHINX-NEXT: call exp2f@plt +; RV64IZHINX-NEXT: fcvt.h.s a0, a0 +; RV64IZHINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZHINX-NEXT: addi sp, sp, 16 +; RV64IZHINX-NEXT: ret +; ; RV32I-LABEL: exp2_f16: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -598,6 +784,28 @@ ; RV64IZFH-NEXT: addi sp, sp, 16 ; RV64IZFH-NEXT: ret ; +; RV32IZHINX-LABEL: log_f16: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: fcvt.s.h a0, a0 +; RV32IZHINX-NEXT: call logf@plt +; RV32IZHINX-NEXT: fcvt.h.s a0, a0 +; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: addi sp, sp, 16 +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: log_f16: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: addi sp, sp, -16 +; RV64IZHINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZHINX-NEXT: fcvt.s.h a0, a0 +; RV64IZHINX-NEXT: call logf@plt +; RV64IZHINX-NEXT: fcvt.h.s a0, a0 +; RV64IZHINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZHINX-NEXT: addi sp, sp, 16 +; RV64IZHINX-NEXT: ret +; ; RV32I-LABEL: log_f16: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -652,6 +860,28 @@ ; RV64IZFH-NEXT: addi sp, sp, 16 ; RV64IZFH-NEXT: ret ; +; RV32IZHINX-LABEL: log10_f16: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: fcvt.s.h a0, a0 +; RV32IZHINX-NEXT: call log10f@plt +; RV32IZHINX-NEXT: fcvt.h.s a0, a0 +; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: addi sp, sp, 16 +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: log10_f16: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: addi sp, sp, -16 +; RV64IZHINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZHINX-NEXT: fcvt.s.h a0, a0 +; RV64IZHINX-NEXT: call log10f@plt +; RV64IZHINX-NEXT: fcvt.h.s a0, a0 +; RV64IZHINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZHINX-NEXT: addi sp, sp, 16 +; RV64IZHINX-NEXT: ret +; ; RV32I-LABEL: log10_f16: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -706,6 +936,28 @@ ; RV64IZFH-NEXT: addi sp, sp, 16 ; RV64IZFH-NEXT: ret ; +; RV32IZHINX-LABEL: log2_f16: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: fcvt.s.h a0, a0 +; RV32IZHINX-NEXT: call log2f@plt +; RV32IZHINX-NEXT: fcvt.h.s a0, a0 +; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: addi sp, sp, 16 +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: log2_f16: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: addi sp, sp, -16 +; RV64IZHINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZHINX-NEXT: fcvt.s.h a0, a0 +; RV64IZHINX-NEXT: call log2f@plt +; RV64IZHINX-NEXT: fcvt.h.s a0, a0 +; RV64IZHINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZHINX-NEXT: addi sp, sp, 16 +; RV64IZHINX-NEXT: ret +; ; RV32I-LABEL: log2_f16: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -743,6 +995,11 @@ ; CHECKIZFH-NEXT: fmadd.h fa0, fa0, fa1, fa2 ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: fma_f16: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: fmadd.h a0, a0, a1, a2 +; CHECKIZHINX-NEXT: ret +; ; RV32I-LABEL: fma_f16: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -32 @@ -820,6 +1077,11 @@ ; CHECKIZFH-NEXT: fmadd.h fa0, fa0, fa1, fa2 ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: fmuladd_f16: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: fmadd.h a0, a0, a1, a2 +; CHECKIZHINX-NEXT: ret +; ; RV32I-LABEL: fmuladd_f16: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -32 @@ -907,6 +1169,18 @@ ; CHECKIZFH-NEXT: fabs.h fa0, fa0 ; CHECKIZFH-NEXT: ret ; +; RV32IZHINX-LABEL: fabs_f16: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: slli a0, a0, 17 +; RV32IZHINX-NEXT: srli a0, a0, 17 +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: fabs_f16: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: slli a0, a0, 49 +; RV64IZHINX-NEXT: srli a0, a0, 49 +; RV64IZHINX-NEXT: ret +; ; RV32I-LABEL: fabs_f16: ; RV32I: # %bb.0: ; RV32I-NEXT: slli a0, a0, 17 @@ -930,6 +1204,11 @@ ; CHECKIZFH-NEXT: fmin.h fa0, fa0, fa1 ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: minnum_f16: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: fmin.h a0, a0, a1 +; CHECKIZHINX-NEXT: ret +; ; RV32I-LABEL: minnum_f16: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -993,6 +1272,11 @@ ; CHECKIZFH-NEXT: fmax.h fa0, fa0, fa1 ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: maxnum_f16: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: fmax.h a0, a0, a1 +; CHECKIZHINX-NEXT: ret +; ; RV32I-LABEL: maxnum_f16: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -1073,6 +1357,11 @@ ; CHECKIZFH-NEXT: fsgnj.h fa0, fa0, fa1 ; CHECKIZFH-NEXT: ret ; +; CHECKIZHINX-LABEL: copysign_f16: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: fsgnj.h a0, a0, a1 +; CHECKIZHINX-NEXT: ret +; ; RV32I-LABEL: copysign_f16: ; RV32I: # %bb.0: ; RV32I-NEXT: lui a2, 1048568 @@ -1119,6 +1408,28 @@ ; RV64IZFH-NEXT: addi sp, sp, 16 ; RV64IZFH-NEXT: ret ; +; RV32IZHINX-LABEL: floor_f16: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: fcvt.s.h a0, a0 +; RV32IZHINX-NEXT: call floorf@plt +; RV32IZHINX-NEXT: fcvt.h.s a0, a0 +; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: addi sp, sp, 16 +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: floor_f16: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: addi sp, sp, -16 +; RV64IZHINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZHINX-NEXT: fcvt.s.h a0, a0 +; RV64IZHINX-NEXT: call floorf@plt +; RV64IZHINX-NEXT: fcvt.h.s a0, a0 +; RV64IZHINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZHINX-NEXT: addi sp, sp, 16 +; RV64IZHINX-NEXT: ret +; ; RV32I-LABEL: floor_f16: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -1173,6 +1484,28 @@ ; RV64IZFH-NEXT: addi sp, sp, 16 ; RV64IZFH-NEXT: ret ; +; RV32IZHINX-LABEL: ceil_f16: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: fcvt.s.h a0, a0 +; RV32IZHINX-NEXT: call ceilf@plt +; RV32IZHINX-NEXT: fcvt.h.s a0, a0 +; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: addi sp, sp, 16 +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: ceil_f16: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: addi sp, sp, -16 +; RV64IZHINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZHINX-NEXT: fcvt.s.h a0, a0 +; RV64IZHINX-NEXT: call ceilf@plt +; RV64IZHINX-NEXT: fcvt.h.s a0, a0 +; RV64IZHINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZHINX-NEXT: addi sp, sp, 16 +; RV64IZHINX-NEXT: ret +; ; RV32I-LABEL: ceil_f16: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -1227,6 +1560,28 @@ ; RV64IZFH-NEXT: addi sp, sp, 16 ; RV64IZFH-NEXT: ret ; +; RV32IZHINX-LABEL: trunc_f16: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: fcvt.s.h a0, a0 +; RV32IZHINX-NEXT: call truncf@plt +; RV32IZHINX-NEXT: fcvt.h.s a0, a0 +; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: addi sp, sp, 16 +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: trunc_f16: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: addi sp, sp, -16 +; RV64IZHINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZHINX-NEXT: fcvt.s.h a0, a0 +; RV64IZHINX-NEXT: call truncf@plt +; RV64IZHINX-NEXT: fcvt.h.s a0, a0 +; RV64IZHINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZHINX-NEXT: addi sp, sp, 16 +; RV64IZHINX-NEXT: ret +; ; RV32I-LABEL: trunc_f16: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -1281,6 +1636,28 @@ ; RV64IZFH-NEXT: addi sp, sp, 16 ; RV64IZFH-NEXT: ret ; +; RV32IZHINX-LABEL: rint_f16: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: fcvt.s.h a0, a0 +; RV32IZHINX-NEXT: call rintf@plt +; RV32IZHINX-NEXT: fcvt.h.s a0, a0 +; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: addi sp, sp, 16 +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: rint_f16: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: addi sp, sp, -16 +; RV64IZHINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZHINX-NEXT: fcvt.s.h a0, a0 +; RV64IZHINX-NEXT: call rintf@plt +; RV64IZHINX-NEXT: fcvt.h.s a0, a0 +; RV64IZHINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZHINX-NEXT: addi sp, sp, 16 +; RV64IZHINX-NEXT: ret +; ; RV32I-LABEL: rint_f16: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -1335,6 +1712,28 @@ ; RV64IZFH-NEXT: addi sp, sp, 16 ; RV64IZFH-NEXT: ret ; +; RV32IZHINX-LABEL: nearbyint_f16: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: fcvt.s.h a0, a0 +; RV32IZHINX-NEXT: call nearbyintf@plt +; RV32IZHINX-NEXT: fcvt.h.s a0, a0 +; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: addi sp, sp, 16 +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: nearbyint_f16: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: addi sp, sp, -16 +; RV64IZHINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZHINX-NEXT: fcvt.s.h a0, a0 +; RV64IZHINX-NEXT: call nearbyintf@plt +; RV64IZHINX-NEXT: fcvt.h.s a0, a0 +; RV64IZHINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZHINX-NEXT: addi sp, sp, 16 +; RV64IZHINX-NEXT: ret +; ; RV32I-LABEL: nearbyint_f16: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -1389,6 +1788,28 @@ ; RV64IZFH-NEXT: addi sp, sp, 16 ; RV64IZFH-NEXT: ret ; +; RV32IZHINX-LABEL: round_f16: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: fcvt.s.h a0, a0 +; RV32IZHINX-NEXT: call roundf@plt +; RV32IZHINX-NEXT: fcvt.h.s a0, a0 +; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: addi sp, sp, 16 +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: round_f16: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: addi sp, sp, -16 +; RV64IZHINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZHINX-NEXT: fcvt.s.h a0, a0 +; RV64IZHINX-NEXT: call roundf@plt +; RV64IZHINX-NEXT: fcvt.h.s a0, a0 +; RV64IZHINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZHINX-NEXT: addi sp, sp, 16 +; RV64IZHINX-NEXT: ret +; ; RV32I-LABEL: round_f16: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 @@ -1443,6 +1864,28 @@ ; RV64IZFH-NEXT: addi sp, sp, 16 ; RV64IZFH-NEXT: ret ; +; RV32IZHINX-LABEL: roundeven_f16: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: fcvt.s.h a0, a0 +; RV32IZHINX-NEXT: call roundevenf@plt +; RV32IZHINX-NEXT: fcvt.h.s a0, a0 +; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: addi sp, sp, 16 +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: roundeven_f16: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: addi sp, sp, -16 +; RV64IZHINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZHINX-NEXT: fcvt.s.h a0, a0 +; RV64IZHINX-NEXT: call roundevenf@plt +; RV64IZHINX-NEXT: fcvt.h.s a0, a0 +; RV64IZHINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZHINX-NEXT: addi sp, sp, 16 +; RV64IZHINX-NEXT: ret +; ; RV32I-LABEL: roundeven_f16: ; RV32I: # %bb.0: ; RV32I-NEXT: addi sp, sp, -16 diff --git a/llvm/test/CodeGen/RISCV/half-isnan.ll b/llvm/test/CodeGen/RISCV/half-isnan.ll --- a/llvm/test/CodeGen/RISCV/half-isnan.ll +++ b/llvm/test/CodeGen/RISCV/half-isnan.ll @@ -3,6 +3,10 @@ ; RUN: -target-abi ilp32f < %s | FileCheck %s ; RUN: llc -mtriple=riscv64 -mattr=+zfh -verify-machineinstrs \ ; RUN: -target-abi lp64f < %s | FileCheck %s +; RUN: llc -mtriple=riscv32 -mattr=+zhinx -verify-machineinstrs \ +; RUN: -target-abi ilp32 < %s | FileCheck --check-prefix=CHECKZHINX %s +; RUN: llc -mtriple=riscv64 -mattr=+zhinx -verify-machineinstrs \ +; RUN: -target-abi lp64 < %s | FileCheck --check-prefix=CHECKZHINX %s define zeroext i1 @half_is_nan(half %a) nounwind { ; CHECK-LABEL: half_is_nan: @@ -10,6 +14,12 @@ ; CHECK-NEXT: feq.h a0, fa0, fa0 ; CHECK-NEXT: xori a0, a0, 1 ; CHECK-NEXT: ret +; +; CHECKZHINX-LABEL: half_is_nan: +; CHECKZHINX: # %bb.0: +; CHECKZHINX-NEXT: feq.h a0, a0, a0 +; CHECKZHINX-NEXT: xori a0, a0, 1 +; CHECKZHINX-NEXT: ret %1 = fcmp uno half %a, 0.000000e+00 ret i1 %1 } @@ -19,6 +29,11 @@ ; CHECK: # %bb.0: ; CHECK-NEXT: feq.h a0, fa0, fa0 ; CHECK-NEXT: ret +; +; CHECKZHINX-LABEL: half_not_nan: +; CHECKZHINX: # %bb.0: +; CHECKZHINX-NEXT: feq.h a0, a0, a0 +; CHECKZHINX-NEXT: ret %1 = fcmp ord half %a, 0.000000e+00 ret i1 %1 } diff --git a/llvm/test/CodeGen/RISCV/half-mem.ll b/llvm/test/CodeGen/RISCV/half-mem.ll --- a/llvm/test/CodeGen/RISCV/half-mem.ll +++ b/llvm/test/CodeGen/RISCV/half-mem.ll @@ -3,6 +3,10 @@ ; RUN: -target-abi ilp32f < %s | FileCheck -check-prefixes=CHECKIZFH,RV32IZFH %s ; RUN: llc -mtriple=riscv64 -mattr=+zfh -verify-machineinstrs \ ; RUN: -target-abi lp64f < %s | FileCheck -check-prefixes=CHECKIZFH,RV64IZFH %s +; RUN: llc -mtriple=riscv32 -mattr=+zhinx -verify-machineinstrs \ +; RUN: -target-abi ilp32 < %s | FileCheck -check-prefixes=CHECKIZHINX,RV32IZHINX %s +; RUN: llc -mtriple=riscv64 -mattr=+zhinx -verify-machineinstrs \ +; RUN: -target-abi lp64 < %s | FileCheck -check-prefixes=CHECKIZHINX,RV64IZHINX %s define half @flh(half *%a) nounwind { ; CHECKIZFH-LABEL: flh: @@ -11,6 +15,14 @@ ; CHECKIZFH-NEXT: flh ft1, 6(a0) ; CHECKIZFH-NEXT: fadd.h fa0, ft0, ft1 ; CHECKIZFH-NEXT: ret +; +; CHECKIZHINX-LABEL: flh: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: lh a1, 0(a0) +; CHECKIZHINX-NEXT: addi a0, a0, 6 +; CHECKIZHINX-NEXT: lh a0, 0(a0) +; CHECKIZHINX-NEXT: fadd.h a0, a1, a0 +; CHECKIZHINX-NEXT: ret %1 = load half, half* %a %2 = getelementptr half, half* %a, i32 3 %3 = load half, half* %2 @@ -29,6 +41,14 @@ ; CHECKIZFH-NEXT: fsh ft0, 0(a0) ; CHECKIZFH-NEXT: fsh ft0, 16(a0) ; CHECKIZFH-NEXT: ret +; +; CHECKIZHINX-LABEL: fsh: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: fadd.h a1, a1, a2 +; CHECKIZHINX-NEXT: sh a1, 0(a0) +; CHECKIZHINX-NEXT: addi a0, a0, 16 +; CHECKIZHINX-NEXT: sh a1, 0(a0) +; CHECKIZHINX-NEXT: ret %1 = fadd half %b, %c store half %1, half* %a %2 = getelementptr half, half* %a, i32 8 @@ -52,6 +72,18 @@ ; CHECKIZFH-NEXT: flh ft0, 18(a1) ; CHECKIZFH-NEXT: fsh fa0, 18(a1) ; CHECKIZFH-NEXT: ret +; +; CHECKIZHINX-LABEL: flh_fsh_global: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: fadd.h a0, a0, a1 +; CHECKIZHINX-NEXT: lui a1, %hi(G) +; CHECKIZHINX-NEXT: addi a1, a1, %lo(G) +; CHECKIZHINX-NEXT: lh a2, 0(a1) +; CHECKIZHINX-NEXT: sh a0, 0(a1) +; CHECKIZHINX-NEXT: addi a1, a1, 18 +; CHECKIZHINX-NEXT: lh a2, 0(a1) +; CHECKIZHINX-NEXT: sh a0, 0(a1) +; CHECKIZHINX-NEXT: ret %1 = fadd half %a, %b %2 = load volatile half, half* @G store half %1, half* @G @@ -79,6 +111,25 @@ ; RV64IZFH-NEXT: fadd.h fa0, fa0, ft0 ; RV64IZFH-NEXT: fsh fa0, -273(a0) ; RV64IZFH-NEXT: ret +; +; RV32IZHINX-LABEL: flh_fsh_constant: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: lui a1, 912092 +; RV32IZHINX-NEXT: addi a1, a1, -273 +; RV32IZHINX-NEXT: lh a2, 0(a1) +; RV32IZHINX-NEXT: fadd.h a0, a0, a2 +; RV32IZHINX-NEXT: sh a0, 0(a1) +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: flh_fsh_constant: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: lui a1, 228023 +; RV64IZHINX-NEXT: slli a1, a1, 2 +; RV64IZHINX-NEXT: addi a1, a1, -273 +; RV64IZHINX-NEXT: lh a2, 0(a1) +; RV64IZHINX-NEXT: fadd.h a0, a0, a2 +; RV64IZHINX-NEXT: sh a0, 0(a1) +; RV64IZHINX-NEXT: ret %1 = inttoptr i32 3735928559 to half* %2 = load volatile half, half* %1 %3 = fadd half %a, %2 @@ -118,6 +169,42 @@ ; RV64IZFH-NEXT: flw fs0, 4(sp) # 4-byte Folded Reload ; RV64IZFH-NEXT: addi sp, sp, 16 ; RV64IZFH-NEXT: ret +; +; RV32IZHINX-LABEL: flh_stack: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: sw s0, 8(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: sw s1, 4(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: mv s0, a0 +; RV32IZHINX-NEXT: mv a0, sp +; RV32IZHINX-NEXT: mv s1, sp +; RV32IZHINX-NEXT: call notdead@plt +; RV32IZHINX-NEXT: lh a0, 0(s1) +; RV32IZHINX-NEXT: fadd.h a0, a0, s0 +; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: lw s0, 8(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: lw s1, 4(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: addi sp, sp, 16 +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: flh_stack: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: addi sp, sp, -32 +; RV64IZHINX-NEXT: sd ra, 24(sp) # 8-byte Folded Spill +; RV64IZHINX-NEXT: sd s0, 16(sp) # 8-byte Folded Spill +; RV64IZHINX-NEXT: sd s1, 8(sp) # 8-byte Folded Spill +; RV64IZHINX-NEXT: mv s0, a0 +; RV64IZHINX-NEXT: addi a0, sp, 4 +; RV64IZHINX-NEXT: addi s1, sp, 4 +; RV64IZHINX-NEXT: call notdead@plt +; RV64IZHINX-NEXT: lh a0, 0(s1) +; RV64IZHINX-NEXT: fadd.h a0, a0, s0 +; RV64IZHINX-NEXT: ld ra, 24(sp) # 8-byte Folded Reload +; RV64IZHINX-NEXT: ld s0, 16(sp) # 8-byte Folded Reload +; RV64IZHINX-NEXT: ld s1, 8(sp) # 8-byte Folded Reload +; RV64IZHINX-NEXT: addi sp, sp, 32 +; RV64IZHINX-NEXT: ret %1 = alloca half, align 4 %2 = bitcast half* %1 to i8* call void @notdead(i8* %2) @@ -150,6 +237,32 @@ ; RV64IZFH-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64IZFH-NEXT: addi sp, sp, 16 ; RV64IZFH-NEXT: ret +; +; RV32IZHINX-LABEL: fsh_stack: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: fadd.h a0, a0, a1 +; RV32IZHINX-NEXT: addi a1, sp, 8 +; RV32IZHINX-NEXT: sh a0, 0(a1) +; RV32IZHINX-NEXT: addi a0, sp, 8 +; RV32IZHINX-NEXT: call notdead@plt +; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: addi sp, sp, 16 +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: fsh_stack: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: addi sp, sp, -16 +; RV64IZHINX-NEXT: sd ra, 8(sp) # 8-byte Folded Spill +; RV64IZHINX-NEXT: fadd.h a0, a0, a1 +; RV64IZHINX-NEXT: addi a1, sp, 4 +; RV64IZHINX-NEXT: sh a0, 0(a1) +; RV64IZHINX-NEXT: addi a0, sp, 4 +; RV64IZHINX-NEXT: call notdead@plt +; RV64IZHINX-NEXT: ld ra, 8(sp) # 8-byte Folded Reload +; RV64IZHINX-NEXT: addi sp, sp, 16 +; RV64IZHINX-NEXT: ret %1 = fadd half %a, %b ; force store from FPR16 %2 = alloca half, align 4 store half %1, half* %2 diff --git a/llvm/test/CodeGen/RISCV/half-round-conv-sat.ll b/llvm/test/CodeGen/RISCV/half-round-conv-sat.ll --- a/llvm/test/CodeGen/RISCV/half-round-conv-sat.ll +++ b/llvm/test/CodeGen/RISCV/half-round-conv-sat.ll @@ -3,6 +3,10 @@ ; RUN: -target-abi=ilp32f | FileCheck -check-prefixes=CHECKIZFH,RV32IZFH %s ; RUN: llc -mtriple=riscv64 -mattr=+zfh -verify-machineinstrs < %s \ ; RUN: -target-abi=lp64f | FileCheck -check-prefixes=CHECKIZFH,RV64IZFH %s +; RUN: llc -mtriple=riscv32 -mattr=+zhinx -verify-machineinstrs < %s \ +; RUN: -target-abi=ilp32 | FileCheck -check-prefixes=CHECKIZHINX,RV32IZHINX %s +; RUN: llc -mtriple=riscv64 -mattr=+zhinx -verify-machineinstrs < %s \ +; RUN: -target-abi=lp64 | FileCheck -check-prefixes=CHECKIZHINX,RV64IZHINX %s define signext i32 @test_floor_si32(half %x) { ; CHECKIZFH-LABEL: test_floor_si32: @@ -13,6 +17,17 @@ ; CHECKIZFH-NEXT: fcvt.w.h a0, fa0, rdn ; CHECKIZFH-NEXT: .LBB0_2: ; CHECKIZFH-NEXT: ret +; +; CHECKIZHINX-LABEL: test_floor_si32: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: feq.h a1, a0, a0 +; CHECKIZHINX-NEXT: bnez a1, .LBB0_2 +; CHECKIZHINX-NEXT: # %bb.1: +; CHECKIZHINX-NEXT: li a0, 0 +; CHECKIZHINX-NEXT: ret +; CHECKIZHINX-NEXT: .LBB0_2: +; CHECKIZHINX-NEXT: fcvt.w.h a0, a0, rdn +; CHECKIZHINX-NEXT: ret %a = call half @llvm.floor.f16(half %x) %b = call i32 @llvm.fptosi.sat.i32.f16(half %a) ret i32 %b @@ -73,6 +88,71 @@ ; RV64IZFH-NEXT: fcvt.l.h a0, fa0, rdn ; RV64IZFH-NEXT: .LBB1_2: ; RV64IZFH-NEXT: ret +; +; RV32IZHINX-LABEL: test_floor_si64: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: sw s0, 8(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: sw s1, 4(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: fcvt.s.h a0, a0 +; RV32IZHINX-NEXT: call floorf@plt +; RV32IZHINX-NEXT: lui a1, %hi(.LCPI1_0) +; RV32IZHINX-NEXT: addi a1, a1, %lo(.LCPI1_0) +; RV32IZHINX-NEXT: lw a1, 0(a1) +; RV32IZHINX-NEXT: fcvt.h.s a0, a0 +; RV32IZHINX-NEXT: fcvt.s.h s0, a0 +; RV32IZHINX-NEXT: fle.s s1, a1, s0 +; RV32IZHINX-NEXT: mv a0, s0 +; RV32IZHINX-NEXT: call __fixsfdi@plt +; RV32IZHINX-NEXT: lui a2, %hi(.LCPI1_1) +; RV32IZHINX-NEXT: addi a2, a2, %lo(.LCPI1_1) +; RV32IZHINX-NEXT: lw a3, 0(a2) +; RV32IZHINX-NEXT: feq.s a2, s0, s0 +; RV32IZHINX-NEXT: flt.s a3, a3, s0 +; RV32IZHINX-NEXT: bnez a2, .LBB1_2 +; RV32IZHINX-NEXT: # %bb.1: +; RV32IZHINX-NEXT: li a0, 0 +; RV32IZHINX-NEXT: lui a4, 524288 +; RV32IZHINX-NEXT: beqz s1, .LBB1_3 +; RV32IZHINX-NEXT: j .LBB1_4 +; RV32IZHINX-NEXT: .LBB1_2: +; RV32IZHINX-NEXT: neg a4, s1 +; RV32IZHINX-NEXT: and a0, a4, a0 +; RV32IZHINX-NEXT: seqz a4, a3 +; RV32IZHINX-NEXT: addi a4, a4, -1 +; RV32IZHINX-NEXT: or a0, a0, a4 +; RV32IZHINX-NEXT: lui a4, 524288 +; RV32IZHINX-NEXT: bnez s1, .LBB1_4 +; RV32IZHINX-NEXT: .LBB1_3: +; RV32IZHINX-NEXT: lui a1, 524288 +; RV32IZHINX-NEXT: .LBB1_4: +; RV32IZHINX-NEXT: bnez a3, .LBB1_8 +; RV32IZHINX-NEXT: # %bb.5: +; RV32IZHINX-NEXT: bnez a2, .LBB1_7 +; RV32IZHINX-NEXT: .LBB1_6: +; RV32IZHINX-NEXT: li a1, 0 +; RV32IZHINX-NEXT: .LBB1_7: +; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: lw s0, 8(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: lw s1, 4(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: addi sp, sp, 16 +; RV32IZHINX-NEXT: ret +; RV32IZHINX-NEXT: .LBB1_8: +; RV32IZHINX-NEXT: addi a1, a4, -1 +; RV32IZHINX-NEXT: beqz a2, .LBB1_6 +; RV32IZHINX-NEXT: j .LBB1_7 +; +; RV64IZHINX-LABEL: test_floor_si64: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: feq.h a1, a0, a0 +; RV64IZHINX-NEXT: bnez a1, .LBB1_2 +; RV64IZHINX-NEXT: # %bb.1: +; RV64IZHINX-NEXT: li a0, 0 +; RV64IZHINX-NEXT: ret +; RV64IZHINX-NEXT: .LBB1_2: +; RV64IZHINX-NEXT: fcvt.l.h a0, a0, rdn +; RV64IZHINX-NEXT: ret %a = call half @llvm.floor.f16(half %x) %b = call i64 @llvm.fptosi.sat.i64.f16(half %a) ret i64 %b @@ -87,6 +167,17 @@ ; CHECKIZFH-NEXT: fcvt.wu.h a0, fa0, rdn ; CHECKIZFH-NEXT: .LBB2_2: ; CHECKIZFH-NEXT: ret +; +; CHECKIZHINX-LABEL: test_floor_ui32: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: feq.h a1, a0, a0 +; CHECKIZHINX-NEXT: bnez a1, .LBB2_2 +; CHECKIZHINX-NEXT: # %bb.1: +; CHECKIZHINX-NEXT: li a0, 0 +; CHECKIZHINX-NEXT: ret +; CHECKIZHINX-NEXT: .LBB2_2: +; CHECKIZHINX-NEXT: fcvt.wu.h a0, a0, rdn +; CHECKIZHINX-NEXT: ret %a = call half @llvm.floor.f16(half %x) %b = call i32 @llvm.fptoui.sat.i32.f16(half %a) ret i32 %b @@ -131,6 +222,47 @@ ; RV64IZFH-NEXT: fcvt.lu.h a0, fa0, rdn ; RV64IZFH-NEXT: .LBB3_2: ; RV64IZFH-NEXT: ret +; +; RV32IZHINX-LABEL: test_floor_ui64: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: sw s0, 8(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: sw s1, 4(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: fcvt.s.h a0, a0 +; RV32IZHINX-NEXT: call floorf@plt +; RV32IZHINX-NEXT: fcvt.h.s a0, a0 +; RV32IZHINX-NEXT: fcvt.s.h s0, a0 +; RV32IZHINX-NEXT: fle.s a0, zero, s0 +; RV32IZHINX-NEXT: neg s1, a0 +; RV32IZHINX-NEXT: mv a0, s0 +; RV32IZHINX-NEXT: call __fixunssfdi@plt +; RV32IZHINX-NEXT: lui a2, %hi(.LCPI3_0) +; RV32IZHINX-NEXT: addi a2, a2, %lo(.LCPI3_0) +; RV32IZHINX-NEXT: lw a2, 0(a2) +; RV32IZHINX-NEXT: and a0, s1, a0 +; RV32IZHINX-NEXT: flt.s a2, a2, s0 +; RV32IZHINX-NEXT: seqz a2, a2 +; RV32IZHINX-NEXT: addi a2, a2, -1 +; RV32IZHINX-NEXT: or a0, a0, a2 +; RV32IZHINX-NEXT: and a1, s1, a1 +; RV32IZHINX-NEXT: or a1, a1, a2 +; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: lw s0, 8(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: lw s1, 4(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: addi sp, sp, 16 +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: test_floor_ui64: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: feq.h a1, a0, a0 +; RV64IZHINX-NEXT: bnez a1, .LBB3_2 +; RV64IZHINX-NEXT: # %bb.1: +; RV64IZHINX-NEXT: li a0, 0 +; RV64IZHINX-NEXT: ret +; RV64IZHINX-NEXT: .LBB3_2: +; RV64IZHINX-NEXT: fcvt.lu.h a0, a0, rdn +; RV64IZHINX-NEXT: ret %a = call half @llvm.floor.f16(half %x) %b = call i64 @llvm.fptoui.sat.i64.f16(half %a) ret i64 %b @@ -145,6 +277,17 @@ ; CHECKIZFH-NEXT: fcvt.w.h a0, fa0, rup ; CHECKIZFH-NEXT: .LBB4_2: ; CHECKIZFH-NEXT: ret +; +; CHECKIZHINX-LABEL: test_ceil_si32: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: feq.h a1, a0, a0 +; CHECKIZHINX-NEXT: bnez a1, .LBB4_2 +; CHECKIZHINX-NEXT: # %bb.1: +; CHECKIZHINX-NEXT: li a0, 0 +; CHECKIZHINX-NEXT: ret +; CHECKIZHINX-NEXT: .LBB4_2: +; CHECKIZHINX-NEXT: fcvt.w.h a0, a0, rup +; CHECKIZHINX-NEXT: ret %a = call half @llvm.ceil.f16(half %x) %b = call i32 @llvm.fptosi.sat.i32.f16(half %a) ret i32 %b @@ -205,6 +348,71 @@ ; RV64IZFH-NEXT: fcvt.l.h a0, fa0, rup ; RV64IZFH-NEXT: .LBB5_2: ; RV64IZFH-NEXT: ret +; +; RV32IZHINX-LABEL: test_ceil_si64: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: sw s0, 8(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: sw s1, 4(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: fcvt.s.h a0, a0 +; RV32IZHINX-NEXT: call ceilf@plt +; RV32IZHINX-NEXT: lui a1, %hi(.LCPI5_0) +; RV32IZHINX-NEXT: addi a1, a1, %lo(.LCPI5_0) +; RV32IZHINX-NEXT: lw a1, 0(a1) +; RV32IZHINX-NEXT: fcvt.h.s a0, a0 +; RV32IZHINX-NEXT: fcvt.s.h s0, a0 +; RV32IZHINX-NEXT: fle.s s1, a1, s0 +; RV32IZHINX-NEXT: mv a0, s0 +; RV32IZHINX-NEXT: call __fixsfdi@plt +; RV32IZHINX-NEXT: lui a2, %hi(.LCPI5_1) +; RV32IZHINX-NEXT: addi a2, a2, %lo(.LCPI5_1) +; RV32IZHINX-NEXT: lw a3, 0(a2) +; RV32IZHINX-NEXT: feq.s a2, s0, s0 +; RV32IZHINX-NEXT: flt.s a3, a3, s0 +; RV32IZHINX-NEXT: bnez a2, .LBB5_2 +; RV32IZHINX-NEXT: # %bb.1: +; RV32IZHINX-NEXT: li a0, 0 +; RV32IZHINX-NEXT: lui a4, 524288 +; RV32IZHINX-NEXT: beqz s1, .LBB5_3 +; RV32IZHINX-NEXT: j .LBB5_4 +; RV32IZHINX-NEXT: .LBB5_2: +; RV32IZHINX-NEXT: neg a4, s1 +; RV32IZHINX-NEXT: and a0, a4, a0 +; RV32IZHINX-NEXT: seqz a4, a3 +; RV32IZHINX-NEXT: addi a4, a4, -1 +; RV32IZHINX-NEXT: or a0, a0, a4 +; RV32IZHINX-NEXT: lui a4, 524288 +; RV32IZHINX-NEXT: bnez s1, .LBB5_4 +; RV32IZHINX-NEXT: .LBB5_3: +; RV32IZHINX-NEXT: lui a1, 524288 +; RV32IZHINX-NEXT: .LBB5_4: +; RV32IZHINX-NEXT: bnez a3, .LBB5_8 +; RV32IZHINX-NEXT: # %bb.5: +; RV32IZHINX-NEXT: bnez a2, .LBB5_7 +; RV32IZHINX-NEXT: .LBB5_6: +; RV32IZHINX-NEXT: li a1, 0 +; RV32IZHINX-NEXT: .LBB5_7: +; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: lw s0, 8(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: lw s1, 4(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: addi sp, sp, 16 +; RV32IZHINX-NEXT: ret +; RV32IZHINX-NEXT: .LBB5_8: +; RV32IZHINX-NEXT: addi a1, a4, -1 +; RV32IZHINX-NEXT: beqz a2, .LBB5_6 +; RV32IZHINX-NEXT: j .LBB5_7 +; +; RV64IZHINX-LABEL: test_ceil_si64: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: feq.h a1, a0, a0 +; RV64IZHINX-NEXT: bnez a1, .LBB5_2 +; RV64IZHINX-NEXT: # %bb.1: +; RV64IZHINX-NEXT: li a0, 0 +; RV64IZHINX-NEXT: ret +; RV64IZHINX-NEXT: .LBB5_2: +; RV64IZHINX-NEXT: fcvt.l.h a0, a0, rup +; RV64IZHINX-NEXT: ret %a = call half @llvm.ceil.f16(half %x) %b = call i64 @llvm.fptosi.sat.i64.f16(half %a) ret i64 %b @@ -219,6 +427,17 @@ ; CHECKIZFH-NEXT: fcvt.wu.h a0, fa0, rup ; CHECKIZFH-NEXT: .LBB6_2: ; CHECKIZFH-NEXT: ret +; +; CHECKIZHINX-LABEL: test_ceil_ui32: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: feq.h a1, a0, a0 +; CHECKIZHINX-NEXT: bnez a1, .LBB6_2 +; CHECKIZHINX-NEXT: # %bb.1: +; CHECKIZHINX-NEXT: li a0, 0 +; CHECKIZHINX-NEXT: ret +; CHECKIZHINX-NEXT: .LBB6_2: +; CHECKIZHINX-NEXT: fcvt.wu.h a0, a0, rup +; CHECKIZHINX-NEXT: ret %a = call half @llvm.ceil.f16(half %x) %b = call i32 @llvm.fptoui.sat.i32.f16(half %a) ret i32 %b @@ -263,6 +482,47 @@ ; RV64IZFH-NEXT: fcvt.lu.h a0, fa0, rup ; RV64IZFH-NEXT: .LBB7_2: ; RV64IZFH-NEXT: ret +; +; RV32IZHINX-LABEL: test_ceil_ui64: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: sw s0, 8(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: sw s1, 4(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: fcvt.s.h a0, a0 +; RV32IZHINX-NEXT: call ceilf@plt +; RV32IZHINX-NEXT: fcvt.h.s a0, a0 +; RV32IZHINX-NEXT: fcvt.s.h s0, a0 +; RV32IZHINX-NEXT: fle.s a0, zero, s0 +; RV32IZHINX-NEXT: neg s1, a0 +; RV32IZHINX-NEXT: mv a0, s0 +; RV32IZHINX-NEXT: call __fixunssfdi@plt +; RV32IZHINX-NEXT: lui a2, %hi(.LCPI7_0) +; RV32IZHINX-NEXT: addi a2, a2, %lo(.LCPI7_0) +; RV32IZHINX-NEXT: lw a2, 0(a2) +; RV32IZHINX-NEXT: and a0, s1, a0 +; RV32IZHINX-NEXT: flt.s a2, a2, s0 +; RV32IZHINX-NEXT: seqz a2, a2 +; RV32IZHINX-NEXT: addi a2, a2, -1 +; RV32IZHINX-NEXT: or a0, a0, a2 +; RV32IZHINX-NEXT: and a1, s1, a1 +; RV32IZHINX-NEXT: or a1, a1, a2 +; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: lw s0, 8(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: lw s1, 4(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: addi sp, sp, 16 +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: test_ceil_ui64: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: feq.h a1, a0, a0 +; RV64IZHINX-NEXT: bnez a1, .LBB7_2 +; RV64IZHINX-NEXT: # %bb.1: +; RV64IZHINX-NEXT: li a0, 0 +; RV64IZHINX-NEXT: ret +; RV64IZHINX-NEXT: .LBB7_2: +; RV64IZHINX-NEXT: fcvt.lu.h a0, a0, rup +; RV64IZHINX-NEXT: ret %a = call half @llvm.ceil.f16(half %x) %b = call i64 @llvm.fptoui.sat.i64.f16(half %a) ret i64 %b @@ -277,6 +537,17 @@ ; CHECKIZFH-NEXT: fcvt.w.h a0, fa0, rtz ; CHECKIZFH-NEXT: .LBB8_2: ; CHECKIZFH-NEXT: ret +; +; CHECKIZHINX-LABEL: test_trunc_si32: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: feq.h a1, a0, a0 +; CHECKIZHINX-NEXT: bnez a1, .LBB8_2 +; CHECKIZHINX-NEXT: # %bb.1: +; CHECKIZHINX-NEXT: li a0, 0 +; CHECKIZHINX-NEXT: ret +; CHECKIZHINX-NEXT: .LBB8_2: +; CHECKIZHINX-NEXT: fcvt.w.h a0, a0, rtz +; CHECKIZHINX-NEXT: ret %a = call half @llvm.trunc.f16(half %x) %b = call i32 @llvm.fptosi.sat.i32.f16(half %a) ret i32 %b @@ -337,6 +608,71 @@ ; RV64IZFH-NEXT: fcvt.l.h a0, fa0, rtz ; RV64IZFH-NEXT: .LBB9_2: ; RV64IZFH-NEXT: ret +; +; RV32IZHINX-LABEL: test_trunc_si64: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: sw s0, 8(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: sw s1, 4(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: fcvt.s.h a0, a0 +; RV32IZHINX-NEXT: call truncf@plt +; RV32IZHINX-NEXT: lui a1, %hi(.LCPI9_0) +; RV32IZHINX-NEXT: addi a1, a1, %lo(.LCPI9_0) +; RV32IZHINX-NEXT: lw a1, 0(a1) +; RV32IZHINX-NEXT: fcvt.h.s a0, a0 +; RV32IZHINX-NEXT: fcvt.s.h s0, a0 +; RV32IZHINX-NEXT: fle.s s1, a1, s0 +; RV32IZHINX-NEXT: mv a0, s0 +; RV32IZHINX-NEXT: call __fixsfdi@plt +; RV32IZHINX-NEXT: lui a2, %hi(.LCPI9_1) +; RV32IZHINX-NEXT: addi a2, a2, %lo(.LCPI9_1) +; RV32IZHINX-NEXT: lw a3, 0(a2) +; RV32IZHINX-NEXT: feq.s a2, s0, s0 +; RV32IZHINX-NEXT: flt.s a3, a3, s0 +; RV32IZHINX-NEXT: bnez a2, .LBB9_2 +; RV32IZHINX-NEXT: # %bb.1: +; RV32IZHINX-NEXT: li a0, 0 +; RV32IZHINX-NEXT: lui a4, 524288 +; RV32IZHINX-NEXT: beqz s1, .LBB9_3 +; RV32IZHINX-NEXT: j .LBB9_4 +; RV32IZHINX-NEXT: .LBB9_2: +; RV32IZHINX-NEXT: neg a4, s1 +; RV32IZHINX-NEXT: and a0, a4, a0 +; RV32IZHINX-NEXT: seqz a4, a3 +; RV32IZHINX-NEXT: addi a4, a4, -1 +; RV32IZHINX-NEXT: or a0, a0, a4 +; RV32IZHINX-NEXT: lui a4, 524288 +; RV32IZHINX-NEXT: bnez s1, .LBB9_4 +; RV32IZHINX-NEXT: .LBB9_3: +; RV32IZHINX-NEXT: lui a1, 524288 +; RV32IZHINX-NEXT: .LBB9_4: +; RV32IZHINX-NEXT: bnez a3, .LBB9_8 +; RV32IZHINX-NEXT: # %bb.5: +; RV32IZHINX-NEXT: bnez a2, .LBB9_7 +; RV32IZHINX-NEXT: .LBB9_6: +; RV32IZHINX-NEXT: li a1, 0 +; RV32IZHINX-NEXT: .LBB9_7: +; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: lw s0, 8(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: lw s1, 4(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: addi sp, sp, 16 +; RV32IZHINX-NEXT: ret +; RV32IZHINX-NEXT: .LBB9_8: +; RV32IZHINX-NEXT: addi a1, a4, -1 +; RV32IZHINX-NEXT: beqz a2, .LBB9_6 +; RV32IZHINX-NEXT: j .LBB9_7 +; +; RV64IZHINX-LABEL: test_trunc_si64: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: feq.h a1, a0, a0 +; RV64IZHINX-NEXT: bnez a1, .LBB9_2 +; RV64IZHINX-NEXT: # %bb.1: +; RV64IZHINX-NEXT: li a0, 0 +; RV64IZHINX-NEXT: ret +; RV64IZHINX-NEXT: .LBB9_2: +; RV64IZHINX-NEXT: fcvt.l.h a0, a0, rtz +; RV64IZHINX-NEXT: ret %a = call half @llvm.trunc.f16(half %x) %b = call i64 @llvm.fptosi.sat.i64.f16(half %a) ret i64 %b @@ -351,6 +687,17 @@ ; CHECKIZFH-NEXT: fcvt.wu.h a0, fa0, rtz ; CHECKIZFH-NEXT: .LBB10_2: ; CHECKIZFH-NEXT: ret +; +; CHECKIZHINX-LABEL: test_trunc_ui32: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: feq.h a1, a0, a0 +; CHECKIZHINX-NEXT: bnez a1, .LBB10_2 +; CHECKIZHINX-NEXT: # %bb.1: +; CHECKIZHINX-NEXT: li a0, 0 +; CHECKIZHINX-NEXT: ret +; CHECKIZHINX-NEXT: .LBB10_2: +; CHECKIZHINX-NEXT: fcvt.wu.h a0, a0, rtz +; CHECKIZHINX-NEXT: ret %a = call half @llvm.trunc.f16(half %x) %b = call i32 @llvm.fptoui.sat.i32.f16(half %a) ret i32 %b @@ -395,6 +742,47 @@ ; RV64IZFH-NEXT: fcvt.lu.h a0, fa0, rtz ; RV64IZFH-NEXT: .LBB11_2: ; RV64IZFH-NEXT: ret +; +; RV32IZHINX-LABEL: test_trunc_ui64: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: sw s0, 8(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: sw s1, 4(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: fcvt.s.h a0, a0 +; RV32IZHINX-NEXT: call truncf@plt +; RV32IZHINX-NEXT: fcvt.h.s a0, a0 +; RV32IZHINX-NEXT: fcvt.s.h s0, a0 +; RV32IZHINX-NEXT: fle.s a0, zero, s0 +; RV32IZHINX-NEXT: neg s1, a0 +; RV32IZHINX-NEXT: mv a0, s0 +; RV32IZHINX-NEXT: call __fixunssfdi@plt +; RV32IZHINX-NEXT: lui a2, %hi(.LCPI11_0) +; RV32IZHINX-NEXT: addi a2, a2, %lo(.LCPI11_0) +; RV32IZHINX-NEXT: lw a2, 0(a2) +; RV32IZHINX-NEXT: and a0, s1, a0 +; RV32IZHINX-NEXT: flt.s a2, a2, s0 +; RV32IZHINX-NEXT: seqz a2, a2 +; RV32IZHINX-NEXT: addi a2, a2, -1 +; RV32IZHINX-NEXT: or a0, a0, a2 +; RV32IZHINX-NEXT: and a1, s1, a1 +; RV32IZHINX-NEXT: or a1, a1, a2 +; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: lw s0, 8(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: lw s1, 4(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: addi sp, sp, 16 +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: test_trunc_ui64: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: feq.h a1, a0, a0 +; RV64IZHINX-NEXT: bnez a1, .LBB11_2 +; RV64IZHINX-NEXT: # %bb.1: +; RV64IZHINX-NEXT: li a0, 0 +; RV64IZHINX-NEXT: ret +; RV64IZHINX-NEXT: .LBB11_2: +; RV64IZHINX-NEXT: fcvt.lu.h a0, a0, rtz +; RV64IZHINX-NEXT: ret %a = call half @llvm.trunc.f16(half %x) %b = call i64 @llvm.fptoui.sat.i64.f16(half %a) ret i64 %b @@ -409,6 +797,17 @@ ; CHECKIZFH-NEXT: fcvt.w.h a0, fa0, rmm ; CHECKIZFH-NEXT: .LBB12_2: ; CHECKIZFH-NEXT: ret +; +; CHECKIZHINX-LABEL: test_round_si32: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: feq.h a1, a0, a0 +; CHECKIZHINX-NEXT: bnez a1, .LBB12_2 +; CHECKIZHINX-NEXT: # %bb.1: +; CHECKIZHINX-NEXT: li a0, 0 +; CHECKIZHINX-NEXT: ret +; CHECKIZHINX-NEXT: .LBB12_2: +; CHECKIZHINX-NEXT: fcvt.w.h a0, a0, rmm +; CHECKIZHINX-NEXT: ret %a = call half @llvm.round.f16(half %x) %b = call i32 @llvm.fptosi.sat.i32.f16(half %a) ret i32 %b @@ -469,6 +868,71 @@ ; RV64IZFH-NEXT: fcvt.l.h a0, fa0, rmm ; RV64IZFH-NEXT: .LBB13_2: ; RV64IZFH-NEXT: ret +; +; RV32IZHINX-LABEL: test_round_si64: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: sw s0, 8(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: sw s1, 4(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: fcvt.s.h a0, a0 +; RV32IZHINX-NEXT: call roundf@plt +; RV32IZHINX-NEXT: lui a1, %hi(.LCPI13_0) +; RV32IZHINX-NEXT: addi a1, a1, %lo(.LCPI13_0) +; RV32IZHINX-NEXT: lw a1, 0(a1) +; RV32IZHINX-NEXT: fcvt.h.s a0, a0 +; RV32IZHINX-NEXT: fcvt.s.h s0, a0 +; RV32IZHINX-NEXT: fle.s s1, a1, s0 +; RV32IZHINX-NEXT: mv a0, s0 +; RV32IZHINX-NEXT: call __fixsfdi@plt +; RV32IZHINX-NEXT: lui a2, %hi(.LCPI13_1) +; RV32IZHINX-NEXT: addi a2, a2, %lo(.LCPI13_1) +; RV32IZHINX-NEXT: lw a3, 0(a2) +; RV32IZHINX-NEXT: feq.s a2, s0, s0 +; RV32IZHINX-NEXT: flt.s a3, a3, s0 +; RV32IZHINX-NEXT: bnez a2, .LBB13_2 +; RV32IZHINX-NEXT: # %bb.1: +; RV32IZHINX-NEXT: li a0, 0 +; RV32IZHINX-NEXT: lui a4, 524288 +; RV32IZHINX-NEXT: beqz s1, .LBB13_3 +; RV32IZHINX-NEXT: j .LBB13_4 +; RV32IZHINX-NEXT: .LBB13_2: +; RV32IZHINX-NEXT: neg a4, s1 +; RV32IZHINX-NEXT: and a0, a4, a0 +; RV32IZHINX-NEXT: seqz a4, a3 +; RV32IZHINX-NEXT: addi a4, a4, -1 +; RV32IZHINX-NEXT: or a0, a0, a4 +; RV32IZHINX-NEXT: lui a4, 524288 +; RV32IZHINX-NEXT: bnez s1, .LBB13_4 +; RV32IZHINX-NEXT: .LBB13_3: +; RV32IZHINX-NEXT: lui a1, 524288 +; RV32IZHINX-NEXT: .LBB13_4: +; RV32IZHINX-NEXT: bnez a3, .LBB13_8 +; RV32IZHINX-NEXT: # %bb.5: +; RV32IZHINX-NEXT: bnez a2, .LBB13_7 +; RV32IZHINX-NEXT: .LBB13_6: +; RV32IZHINX-NEXT: li a1, 0 +; RV32IZHINX-NEXT: .LBB13_7: +; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: lw s0, 8(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: lw s1, 4(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: addi sp, sp, 16 +; RV32IZHINX-NEXT: ret +; RV32IZHINX-NEXT: .LBB13_8: +; RV32IZHINX-NEXT: addi a1, a4, -1 +; RV32IZHINX-NEXT: beqz a2, .LBB13_6 +; RV32IZHINX-NEXT: j .LBB13_7 +; +; RV64IZHINX-LABEL: test_round_si64: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: feq.h a1, a0, a0 +; RV64IZHINX-NEXT: bnez a1, .LBB13_2 +; RV64IZHINX-NEXT: # %bb.1: +; RV64IZHINX-NEXT: li a0, 0 +; RV64IZHINX-NEXT: ret +; RV64IZHINX-NEXT: .LBB13_2: +; RV64IZHINX-NEXT: fcvt.l.h a0, a0, rmm +; RV64IZHINX-NEXT: ret %a = call half @llvm.round.f16(half %x) %b = call i64 @llvm.fptosi.sat.i64.f16(half %a) ret i64 %b @@ -483,6 +947,17 @@ ; CHECKIZFH-NEXT: fcvt.wu.h a0, fa0, rmm ; CHECKIZFH-NEXT: .LBB14_2: ; CHECKIZFH-NEXT: ret +; +; CHECKIZHINX-LABEL: test_round_ui32: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: feq.h a1, a0, a0 +; CHECKIZHINX-NEXT: bnez a1, .LBB14_2 +; CHECKIZHINX-NEXT: # %bb.1: +; CHECKIZHINX-NEXT: li a0, 0 +; CHECKIZHINX-NEXT: ret +; CHECKIZHINX-NEXT: .LBB14_2: +; CHECKIZHINX-NEXT: fcvt.wu.h a0, a0, rmm +; CHECKIZHINX-NEXT: ret %a = call half @llvm.round.f16(half %x) %b = call i32 @llvm.fptoui.sat.i32.f16(half %a) ret i32 %b @@ -527,6 +1002,47 @@ ; RV64IZFH-NEXT: fcvt.lu.h a0, fa0, rmm ; RV64IZFH-NEXT: .LBB15_2: ; RV64IZFH-NEXT: ret +; +; RV32IZHINX-LABEL: test_round_ui64: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: sw s0, 8(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: sw s1, 4(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: fcvt.s.h a0, a0 +; RV32IZHINX-NEXT: call roundf@plt +; RV32IZHINX-NEXT: fcvt.h.s a0, a0 +; RV32IZHINX-NEXT: fcvt.s.h s0, a0 +; RV32IZHINX-NEXT: fle.s a0, zero, s0 +; RV32IZHINX-NEXT: neg s1, a0 +; RV32IZHINX-NEXT: mv a0, s0 +; RV32IZHINX-NEXT: call __fixunssfdi@plt +; RV32IZHINX-NEXT: lui a2, %hi(.LCPI15_0) +; RV32IZHINX-NEXT: addi a2, a2, %lo(.LCPI15_0) +; RV32IZHINX-NEXT: lw a2, 0(a2) +; RV32IZHINX-NEXT: and a0, s1, a0 +; RV32IZHINX-NEXT: flt.s a2, a2, s0 +; RV32IZHINX-NEXT: seqz a2, a2 +; RV32IZHINX-NEXT: addi a2, a2, -1 +; RV32IZHINX-NEXT: or a0, a0, a2 +; RV32IZHINX-NEXT: and a1, s1, a1 +; RV32IZHINX-NEXT: or a1, a1, a2 +; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: lw s0, 8(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: lw s1, 4(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: addi sp, sp, 16 +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: test_round_ui64: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: feq.h a1, a0, a0 +; RV64IZHINX-NEXT: bnez a1, .LBB15_2 +; RV64IZHINX-NEXT: # %bb.1: +; RV64IZHINX-NEXT: li a0, 0 +; RV64IZHINX-NEXT: ret +; RV64IZHINX-NEXT: .LBB15_2: +; RV64IZHINX-NEXT: fcvt.lu.h a0, a0, rmm +; RV64IZHINX-NEXT: ret %a = call half @llvm.round.f16(half %x) %b = call i64 @llvm.fptoui.sat.i64.f16(half %a) ret i64 %b @@ -541,6 +1057,17 @@ ; CHECKIZFH-NEXT: fcvt.w.h a0, fa0, rne ; CHECKIZFH-NEXT: .LBB16_2: ; CHECKIZFH-NEXT: ret +; +; CHECKIZHINX-LABEL: test_roundeven_si32: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: feq.h a1, a0, a0 +; CHECKIZHINX-NEXT: bnez a1, .LBB16_2 +; CHECKIZHINX-NEXT: # %bb.1: +; CHECKIZHINX-NEXT: li a0, 0 +; CHECKIZHINX-NEXT: ret +; CHECKIZHINX-NEXT: .LBB16_2: +; CHECKIZHINX-NEXT: fcvt.w.h a0, a0, rne +; CHECKIZHINX-NEXT: ret %a = call half @llvm.roundeven.f16(half %x) %b = call i32 @llvm.fptosi.sat.i32.f16(half %a) ret i32 %b @@ -601,6 +1128,71 @@ ; RV64IZFH-NEXT: fcvt.l.h a0, fa0, rne ; RV64IZFH-NEXT: .LBB17_2: ; RV64IZFH-NEXT: ret +; +; RV32IZHINX-LABEL: test_roundeven_si64: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: sw s0, 8(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: sw s1, 4(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: fcvt.s.h a0, a0 +; RV32IZHINX-NEXT: call roundevenf@plt +; RV32IZHINX-NEXT: lui a1, %hi(.LCPI17_0) +; RV32IZHINX-NEXT: addi a1, a1, %lo(.LCPI17_0) +; RV32IZHINX-NEXT: lw a1, 0(a1) +; RV32IZHINX-NEXT: fcvt.h.s a0, a0 +; RV32IZHINX-NEXT: fcvt.s.h s0, a0 +; RV32IZHINX-NEXT: fle.s s1, a1, s0 +; RV32IZHINX-NEXT: mv a0, s0 +; RV32IZHINX-NEXT: call __fixsfdi@plt +; RV32IZHINX-NEXT: lui a2, %hi(.LCPI17_1) +; RV32IZHINX-NEXT: addi a2, a2, %lo(.LCPI17_1) +; RV32IZHINX-NEXT: lw a3, 0(a2) +; RV32IZHINX-NEXT: feq.s a2, s0, s0 +; RV32IZHINX-NEXT: flt.s a3, a3, s0 +; RV32IZHINX-NEXT: bnez a2, .LBB17_2 +; RV32IZHINX-NEXT: # %bb.1: +; RV32IZHINX-NEXT: li a0, 0 +; RV32IZHINX-NEXT: lui a4, 524288 +; RV32IZHINX-NEXT: beqz s1, .LBB17_3 +; RV32IZHINX-NEXT: j .LBB17_4 +; RV32IZHINX-NEXT: .LBB17_2: +; RV32IZHINX-NEXT: neg a4, s1 +; RV32IZHINX-NEXT: and a0, a4, a0 +; RV32IZHINX-NEXT: seqz a4, a3 +; RV32IZHINX-NEXT: addi a4, a4, -1 +; RV32IZHINX-NEXT: or a0, a0, a4 +; RV32IZHINX-NEXT: lui a4, 524288 +; RV32IZHINX-NEXT: bnez s1, .LBB17_4 +; RV32IZHINX-NEXT: .LBB17_3: +; RV32IZHINX-NEXT: lui a1, 524288 +; RV32IZHINX-NEXT: .LBB17_4: +; RV32IZHINX-NEXT: bnez a3, .LBB17_8 +; RV32IZHINX-NEXT: # %bb.5: +; RV32IZHINX-NEXT: bnez a2, .LBB17_7 +; RV32IZHINX-NEXT: .LBB17_6: +; RV32IZHINX-NEXT: li a1, 0 +; RV32IZHINX-NEXT: .LBB17_7: +; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: lw s0, 8(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: lw s1, 4(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: addi sp, sp, 16 +; RV32IZHINX-NEXT: ret +; RV32IZHINX-NEXT: .LBB17_8: +; RV32IZHINX-NEXT: addi a1, a4, -1 +; RV32IZHINX-NEXT: beqz a2, .LBB17_6 +; RV32IZHINX-NEXT: j .LBB17_7 +; +; RV64IZHINX-LABEL: test_roundeven_si64: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: feq.h a1, a0, a0 +; RV64IZHINX-NEXT: bnez a1, .LBB17_2 +; RV64IZHINX-NEXT: # %bb.1: +; RV64IZHINX-NEXT: li a0, 0 +; RV64IZHINX-NEXT: ret +; RV64IZHINX-NEXT: .LBB17_2: +; RV64IZHINX-NEXT: fcvt.l.h a0, a0, rne +; RV64IZHINX-NEXT: ret %a = call half @llvm.roundeven.f16(half %x) %b = call i64 @llvm.fptosi.sat.i64.f16(half %a) ret i64 %b @@ -615,6 +1207,17 @@ ; CHECKIZFH-NEXT: fcvt.wu.h a0, fa0, rne ; CHECKIZFH-NEXT: .LBB18_2: ; CHECKIZFH-NEXT: ret +; +; CHECKIZHINX-LABEL: test_roundeven_ui32: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: feq.h a1, a0, a0 +; CHECKIZHINX-NEXT: bnez a1, .LBB18_2 +; CHECKIZHINX-NEXT: # %bb.1: +; CHECKIZHINX-NEXT: li a0, 0 +; CHECKIZHINX-NEXT: ret +; CHECKIZHINX-NEXT: .LBB18_2: +; CHECKIZHINX-NEXT: fcvt.wu.h a0, a0, rne +; CHECKIZHINX-NEXT: ret %a = call half @llvm.roundeven.f16(half %x) %b = call i32 @llvm.fptoui.sat.i32.f16(half %a) ret i32 %b @@ -659,6 +1262,47 @@ ; RV64IZFH-NEXT: fcvt.lu.h a0, fa0, rne ; RV64IZFH-NEXT: .LBB19_2: ; RV64IZFH-NEXT: ret +; +; RV32IZHINX-LABEL: test_roundeven_ui64: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: sw s0, 8(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: sw s1, 4(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: fcvt.s.h a0, a0 +; RV32IZHINX-NEXT: call roundevenf@plt +; RV32IZHINX-NEXT: fcvt.h.s a0, a0 +; RV32IZHINX-NEXT: fcvt.s.h s0, a0 +; RV32IZHINX-NEXT: fle.s a0, zero, s0 +; RV32IZHINX-NEXT: neg s1, a0 +; RV32IZHINX-NEXT: mv a0, s0 +; RV32IZHINX-NEXT: call __fixunssfdi@plt +; RV32IZHINX-NEXT: lui a2, %hi(.LCPI19_0) +; RV32IZHINX-NEXT: addi a2, a2, %lo(.LCPI19_0) +; RV32IZHINX-NEXT: lw a2, 0(a2) +; RV32IZHINX-NEXT: and a0, s1, a0 +; RV32IZHINX-NEXT: flt.s a2, a2, s0 +; RV32IZHINX-NEXT: seqz a2, a2 +; RV32IZHINX-NEXT: addi a2, a2, -1 +; RV32IZHINX-NEXT: or a0, a0, a2 +; RV32IZHINX-NEXT: and a1, s1, a1 +; RV32IZHINX-NEXT: or a1, a1, a2 +; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: lw s0, 8(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: lw s1, 4(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: addi sp, sp, 16 +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: test_roundeven_ui64: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: feq.h a1, a0, a0 +; RV64IZHINX-NEXT: bnez a1, .LBB19_2 +; RV64IZHINX-NEXT: # %bb.1: +; RV64IZHINX-NEXT: li a0, 0 +; RV64IZHINX-NEXT: ret +; RV64IZHINX-NEXT: .LBB19_2: +; RV64IZHINX-NEXT: fcvt.lu.h a0, a0, rne +; RV64IZHINX-NEXT: ret %a = call half @llvm.roundeven.f16(half %x) %b = call i64 @llvm.fptoui.sat.i64.f16(half %a) ret i64 %b diff --git a/llvm/test/CodeGen/RISCV/half-round-conv.ll b/llvm/test/CodeGen/RISCV/half-round-conv.ll --- a/llvm/test/CodeGen/RISCV/half-round-conv.ll +++ b/llvm/test/CodeGen/RISCV/half-round-conv.ll @@ -3,6 +3,10 @@ ; RUN: -target-abi=ilp32f | FileCheck -check-prefixes=CHECKIZFH,RV32IZFH %s ; RUN: llc -mtriple=riscv64 -mattr=+zfh -verify-machineinstrs < %s \ ; RUN: -target-abi=lp64f | FileCheck -check-prefixes=CHECKIZFH,RV64IZFH %s +; RUN: llc -mtriple=riscv32 -mattr=+zhinx -verify-machineinstrs < %s \ +; RUN: -target-abi=ilp32 | FileCheck -check-prefixes=CHECKIZHINX,RV32IZHINX %s +; RUN: llc -mtriple=riscv64 -mattr=+zhinx -verify-machineinstrs < %s \ +; RUN: -target-abi=lp64 | FileCheck -check-prefixes=CHECKIZHINX,RV64IZHINX %s define signext i8 @test_floor_si8(half %x) { ; RV32IZFH-LABEL: test_floor_si8: @@ -14,6 +18,16 @@ ; RV64IZFH: # %bb.0: ; RV64IZFH-NEXT: fcvt.l.h a0, fa0, rdn ; RV64IZFH-NEXT: ret +; +; RV32IZHINX-LABEL: test_floor_si8: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: fcvt.w.h a0, a0, rdn +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: test_floor_si8: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: fcvt.l.h a0, a0, rdn +; RV64IZHINX-NEXT: ret %a = call half @llvm.floor.f16(half %x) %b = fptosi half %a to i8 ret i8 %b @@ -29,6 +43,16 @@ ; RV64IZFH: # %bb.0: ; RV64IZFH-NEXT: fcvt.l.h a0, fa0, rdn ; RV64IZFH-NEXT: ret +; +; RV32IZHINX-LABEL: test_floor_si16: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: fcvt.w.h a0, a0, rdn +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: test_floor_si16: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: fcvt.l.h a0, a0, rdn +; RV64IZHINX-NEXT: ret %a = call half @llvm.floor.f16(half %x) %b = fptosi half %a to i16 ret i16 %b @@ -39,6 +63,11 @@ ; CHECKIZFH: # %bb.0: ; CHECKIZFH-NEXT: fcvt.w.h a0, fa0, rdn ; CHECKIZFH-NEXT: ret +; +; CHECKIZHINX-LABEL: test_floor_si32: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: fcvt.w.h a0, a0, rdn +; CHECKIZHINX-NEXT: ret %a = call half @llvm.floor.f16(half %x) %b = fptosi half %a to i32 ret i32 %b @@ -63,6 +92,25 @@ ; RV64IZFH: # %bb.0: ; RV64IZFH-NEXT: fcvt.l.h a0, fa0, rdn ; RV64IZFH-NEXT: ret +; +; RV32IZHINX-LABEL: test_floor_si64: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: .cfi_offset ra, -4 +; RV32IZHINX-NEXT: fcvt.s.h a0, a0 +; RV32IZHINX-NEXT: call floorf@plt +; RV32IZHINX-NEXT: fcvt.h.s a0, a0 +; RV32IZHINX-NEXT: call __fixhfdi@plt +; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: addi sp, sp, 16 +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: test_floor_si64: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: fcvt.l.h a0, a0, rdn +; RV64IZHINX-NEXT: ret %a = call half @llvm.floor.f16(half %x) %b = fptosi half %a to i64 ret i64 %b @@ -78,6 +126,16 @@ ; RV64IZFH: # %bb.0: ; RV64IZFH-NEXT: fcvt.lu.h a0, fa0, rdn ; RV64IZFH-NEXT: ret +; +; RV32IZHINX-LABEL: test_floor_ui8: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: fcvt.wu.h a0, a0, rdn +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: test_floor_ui8: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: fcvt.lu.h a0, a0, rdn +; RV64IZHINX-NEXT: ret %a = call half @llvm.floor.f16(half %x) %b = fptoui half %a to i8 ret i8 %b @@ -93,6 +151,16 @@ ; RV64IZFH: # %bb.0: ; RV64IZFH-NEXT: fcvt.lu.h a0, fa0, rdn ; RV64IZFH-NEXT: ret +; +; RV32IZHINX-LABEL: test_floor_ui16: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: fcvt.wu.h a0, a0, rdn +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: test_floor_ui16: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: fcvt.lu.h a0, a0, rdn +; RV64IZHINX-NEXT: ret %a = call half @llvm.floor.f16(half %x) %b = fptoui half %a to i16 ret i16 %b @@ -103,6 +171,11 @@ ; CHECKIZFH: # %bb.0: ; CHECKIZFH-NEXT: fcvt.wu.h a0, fa0, rdn ; CHECKIZFH-NEXT: ret +; +; CHECKIZHINX-LABEL: test_floor_ui32: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: fcvt.wu.h a0, a0, rdn +; CHECKIZHINX-NEXT: ret %a = call half @llvm.floor.f16(half %x) %b = fptoui half %a to i32 ret i32 %b @@ -127,6 +200,25 @@ ; RV64IZFH: # %bb.0: ; RV64IZFH-NEXT: fcvt.lu.h a0, fa0, rdn ; RV64IZFH-NEXT: ret +; +; RV32IZHINX-LABEL: test_floor_ui64: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: .cfi_offset ra, -4 +; RV32IZHINX-NEXT: fcvt.s.h a0, a0 +; RV32IZHINX-NEXT: call floorf@plt +; RV32IZHINX-NEXT: fcvt.h.s a0, a0 +; RV32IZHINX-NEXT: call __fixunshfdi@plt +; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: addi sp, sp, 16 +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: test_floor_ui64: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: fcvt.lu.h a0, a0, rdn +; RV64IZHINX-NEXT: ret %a = call half @llvm.floor.f16(half %x) %b = fptoui half %a to i64 ret i64 %b @@ -142,6 +234,16 @@ ; RV64IZFH: # %bb.0: ; RV64IZFH-NEXT: fcvt.l.h a0, fa0, rup ; RV64IZFH-NEXT: ret +; +; RV32IZHINX-LABEL: test_ceil_si8: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: fcvt.w.h a0, a0, rup +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: test_ceil_si8: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: fcvt.l.h a0, a0, rup +; RV64IZHINX-NEXT: ret %a = call half @llvm.ceil.f16(half %x) %b = fptosi half %a to i8 ret i8 %b @@ -157,6 +259,16 @@ ; RV64IZFH: # %bb.0: ; RV64IZFH-NEXT: fcvt.l.h a0, fa0, rup ; RV64IZFH-NEXT: ret +; +; RV32IZHINX-LABEL: test_ceil_si16: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: fcvt.w.h a0, a0, rup +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: test_ceil_si16: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: fcvt.l.h a0, a0, rup +; RV64IZHINX-NEXT: ret %a = call half @llvm.ceil.f16(half %x) %b = fptosi half %a to i16 ret i16 %b @@ -167,6 +279,11 @@ ; CHECKIZFH: # %bb.0: ; CHECKIZFH-NEXT: fcvt.w.h a0, fa0, rup ; CHECKIZFH-NEXT: ret +; +; CHECKIZHINX-LABEL: test_ceil_si32: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: fcvt.w.h a0, a0, rup +; CHECKIZHINX-NEXT: ret %a = call half @llvm.ceil.f16(half %x) %b = fptosi half %a to i32 ret i32 %b @@ -191,6 +308,25 @@ ; RV64IZFH: # %bb.0: ; RV64IZFH-NEXT: fcvt.l.h a0, fa0, rup ; RV64IZFH-NEXT: ret +; +; RV32IZHINX-LABEL: test_ceil_si64: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: .cfi_offset ra, -4 +; RV32IZHINX-NEXT: fcvt.s.h a0, a0 +; RV32IZHINX-NEXT: call ceilf@plt +; RV32IZHINX-NEXT: fcvt.h.s a0, a0 +; RV32IZHINX-NEXT: call __fixhfdi@plt +; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: addi sp, sp, 16 +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: test_ceil_si64: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: fcvt.l.h a0, a0, rup +; RV64IZHINX-NEXT: ret %a = call half @llvm.ceil.f16(half %x) %b = fptosi half %a to i64 ret i64 %b @@ -206,6 +342,16 @@ ; RV64IZFH: # %bb.0: ; RV64IZFH-NEXT: fcvt.lu.h a0, fa0, rup ; RV64IZFH-NEXT: ret +; +; RV32IZHINX-LABEL: test_ceil_ui8: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: fcvt.wu.h a0, a0, rup +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: test_ceil_ui8: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: fcvt.lu.h a0, a0, rup +; RV64IZHINX-NEXT: ret %a = call half @llvm.ceil.f16(half %x) %b = fptoui half %a to i8 ret i8 %b @@ -221,6 +367,16 @@ ; RV64IZFH: # %bb.0: ; RV64IZFH-NEXT: fcvt.lu.h a0, fa0, rup ; RV64IZFH-NEXT: ret +; +; RV32IZHINX-LABEL: test_ceil_ui16: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: fcvt.wu.h a0, a0, rup +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: test_ceil_ui16: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: fcvt.lu.h a0, a0, rup +; RV64IZHINX-NEXT: ret %a = call half @llvm.ceil.f16(half %x) %b = fptoui half %a to i16 ret i16 %b @@ -231,6 +387,11 @@ ; CHECKIZFH: # %bb.0: ; CHECKIZFH-NEXT: fcvt.wu.h a0, fa0, rup ; CHECKIZFH-NEXT: ret +; +; CHECKIZHINX-LABEL: test_ceil_ui32: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: fcvt.wu.h a0, a0, rup +; CHECKIZHINX-NEXT: ret %a = call half @llvm.ceil.f16(half %x) %b = fptoui half %a to i32 ret i32 %b @@ -255,6 +416,25 @@ ; RV64IZFH: # %bb.0: ; RV64IZFH-NEXT: fcvt.lu.h a0, fa0, rup ; RV64IZFH-NEXT: ret +; +; RV32IZHINX-LABEL: test_ceil_ui64: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: .cfi_offset ra, -4 +; RV32IZHINX-NEXT: fcvt.s.h a0, a0 +; RV32IZHINX-NEXT: call ceilf@plt +; RV32IZHINX-NEXT: fcvt.h.s a0, a0 +; RV32IZHINX-NEXT: call __fixunshfdi@plt +; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: addi sp, sp, 16 +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: test_ceil_ui64: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: fcvt.lu.h a0, a0, rup +; RV64IZHINX-NEXT: ret %a = call half @llvm.ceil.f16(half %x) %b = fptoui half %a to i64 ret i64 %b @@ -270,6 +450,16 @@ ; RV64IZFH: # %bb.0: ; RV64IZFH-NEXT: fcvt.l.h a0, fa0, rtz ; RV64IZFH-NEXT: ret +; +; RV32IZHINX-LABEL: test_trunc_si8: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: fcvt.w.h a0, a0, rtz +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: test_trunc_si8: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: fcvt.l.h a0, a0, rtz +; RV64IZHINX-NEXT: ret %a = call half @llvm.trunc.f16(half %x) %b = fptosi half %a to i8 ret i8 %b @@ -285,6 +475,16 @@ ; RV64IZFH: # %bb.0: ; RV64IZFH-NEXT: fcvt.l.h a0, fa0, rtz ; RV64IZFH-NEXT: ret +; +; RV32IZHINX-LABEL: test_trunc_si16: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: fcvt.w.h a0, a0, rtz +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: test_trunc_si16: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: fcvt.l.h a0, a0, rtz +; RV64IZHINX-NEXT: ret %a = call half @llvm.trunc.f16(half %x) %b = fptosi half %a to i16 ret i16 %b @@ -295,6 +495,11 @@ ; CHECKIZFH: # %bb.0: ; CHECKIZFH-NEXT: fcvt.w.h a0, fa0, rtz ; CHECKIZFH-NEXT: ret +; +; CHECKIZHINX-LABEL: test_trunc_si32: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: fcvt.w.h a0, a0, rtz +; CHECKIZHINX-NEXT: ret %a = call half @llvm.trunc.f16(half %x) %b = fptosi half %a to i32 ret i32 %b @@ -319,6 +524,25 @@ ; RV64IZFH: # %bb.0: ; RV64IZFH-NEXT: fcvt.l.h a0, fa0, rtz ; RV64IZFH-NEXT: ret +; +; RV32IZHINX-LABEL: test_trunc_si64: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: .cfi_offset ra, -4 +; RV32IZHINX-NEXT: fcvt.s.h a0, a0 +; RV32IZHINX-NEXT: call truncf@plt +; RV32IZHINX-NEXT: fcvt.h.s a0, a0 +; RV32IZHINX-NEXT: call __fixhfdi@plt +; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: addi sp, sp, 16 +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: test_trunc_si64: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: fcvt.l.h a0, a0, rtz +; RV64IZHINX-NEXT: ret %a = call half @llvm.trunc.f16(half %x) %b = fptosi half %a to i64 ret i64 %b @@ -334,6 +558,16 @@ ; RV64IZFH: # %bb.0: ; RV64IZFH-NEXT: fcvt.lu.h a0, fa0, rtz ; RV64IZFH-NEXT: ret +; +; RV32IZHINX-LABEL: test_trunc_ui8: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: fcvt.wu.h a0, a0, rtz +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: test_trunc_ui8: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: fcvt.lu.h a0, a0, rtz +; RV64IZHINX-NEXT: ret %a = call half @llvm.trunc.f16(half %x) %b = fptoui half %a to i8 ret i8 %b @@ -349,6 +583,16 @@ ; RV64IZFH: # %bb.0: ; RV64IZFH-NEXT: fcvt.lu.h a0, fa0, rtz ; RV64IZFH-NEXT: ret +; +; RV32IZHINX-LABEL: test_trunc_ui16: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: fcvt.wu.h a0, a0, rtz +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: test_trunc_ui16: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: fcvt.lu.h a0, a0, rtz +; RV64IZHINX-NEXT: ret %a = call half @llvm.trunc.f16(half %x) %b = fptoui half %a to i16 ret i16 %b @@ -359,6 +603,11 @@ ; CHECKIZFH: # %bb.0: ; CHECKIZFH-NEXT: fcvt.wu.h a0, fa0, rtz ; CHECKIZFH-NEXT: ret +; +; CHECKIZHINX-LABEL: test_trunc_ui32: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: fcvt.wu.h a0, a0, rtz +; CHECKIZHINX-NEXT: ret %a = call half @llvm.trunc.f16(half %x) %b = fptoui half %a to i32 ret i32 %b @@ -383,6 +632,25 @@ ; RV64IZFH: # %bb.0: ; RV64IZFH-NEXT: fcvt.lu.h a0, fa0, rtz ; RV64IZFH-NEXT: ret +; +; RV32IZHINX-LABEL: test_trunc_ui64: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: .cfi_offset ra, -4 +; RV32IZHINX-NEXT: fcvt.s.h a0, a0 +; RV32IZHINX-NEXT: call truncf@plt +; RV32IZHINX-NEXT: fcvt.h.s a0, a0 +; RV32IZHINX-NEXT: call __fixunshfdi@plt +; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: addi sp, sp, 16 +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: test_trunc_ui64: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: fcvt.lu.h a0, a0, rtz +; RV64IZHINX-NEXT: ret %a = call half @llvm.trunc.f16(half %x) %b = fptoui half %a to i64 ret i64 %b @@ -398,6 +666,16 @@ ; RV64IZFH: # %bb.0: ; RV64IZFH-NEXT: fcvt.l.h a0, fa0, rmm ; RV64IZFH-NEXT: ret +; +; RV32IZHINX-LABEL: test_round_si8: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: fcvt.w.h a0, a0, rmm +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: test_round_si8: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: fcvt.l.h a0, a0, rmm +; RV64IZHINX-NEXT: ret %a = call half @llvm.round.f16(half %x) %b = fptosi half %a to i8 ret i8 %b @@ -413,6 +691,16 @@ ; RV64IZFH: # %bb.0: ; RV64IZFH-NEXT: fcvt.l.h a0, fa0, rmm ; RV64IZFH-NEXT: ret +; +; RV32IZHINX-LABEL: test_round_si16: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: fcvt.w.h a0, a0, rmm +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: test_round_si16: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: fcvt.l.h a0, a0, rmm +; RV64IZHINX-NEXT: ret %a = call half @llvm.round.f16(half %x) %b = fptosi half %a to i16 ret i16 %b @@ -423,6 +711,11 @@ ; CHECKIZFH: # %bb.0: ; CHECKIZFH-NEXT: fcvt.w.h a0, fa0, rmm ; CHECKIZFH-NEXT: ret +; +; CHECKIZHINX-LABEL: test_round_si32: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: fcvt.w.h a0, a0, rmm +; CHECKIZHINX-NEXT: ret %a = call half @llvm.round.f16(half %x) %b = fptosi half %a to i32 ret i32 %b @@ -447,6 +740,25 @@ ; RV64IZFH: # %bb.0: ; RV64IZFH-NEXT: fcvt.l.h a0, fa0, rmm ; RV64IZFH-NEXT: ret +; +; RV32IZHINX-LABEL: test_round_si64: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: .cfi_offset ra, -4 +; RV32IZHINX-NEXT: fcvt.s.h a0, a0 +; RV32IZHINX-NEXT: call roundf@plt +; RV32IZHINX-NEXT: fcvt.h.s a0, a0 +; RV32IZHINX-NEXT: call __fixhfdi@plt +; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: addi sp, sp, 16 +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: test_round_si64: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: fcvt.l.h a0, a0, rmm +; RV64IZHINX-NEXT: ret %a = call half @llvm.round.f16(half %x) %b = fptosi half %a to i64 ret i64 %b @@ -462,6 +774,16 @@ ; RV64IZFH: # %bb.0: ; RV64IZFH-NEXT: fcvt.lu.h a0, fa0, rmm ; RV64IZFH-NEXT: ret +; +; RV32IZHINX-LABEL: test_round_ui8: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: fcvt.wu.h a0, a0, rmm +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: test_round_ui8: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: fcvt.lu.h a0, a0, rmm +; RV64IZHINX-NEXT: ret %a = call half @llvm.round.f16(half %x) %b = fptoui half %a to i8 ret i8 %b @@ -477,6 +799,16 @@ ; RV64IZFH: # %bb.0: ; RV64IZFH-NEXT: fcvt.lu.h a0, fa0, rmm ; RV64IZFH-NEXT: ret +; +; RV32IZHINX-LABEL: test_round_ui16: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: fcvt.wu.h a0, a0, rmm +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: test_round_ui16: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: fcvt.lu.h a0, a0, rmm +; RV64IZHINX-NEXT: ret %a = call half @llvm.round.f16(half %x) %b = fptoui half %a to i16 ret i16 %b @@ -487,6 +819,11 @@ ; CHECKIZFH: # %bb.0: ; CHECKIZFH-NEXT: fcvt.wu.h a0, fa0, rmm ; CHECKIZFH-NEXT: ret +; +; CHECKIZHINX-LABEL: test_round_ui32: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: fcvt.wu.h a0, a0, rmm +; CHECKIZHINX-NEXT: ret %a = call half @llvm.round.f16(half %x) %b = fptoui half %a to i32 ret i32 %b @@ -511,6 +848,25 @@ ; RV64IZFH: # %bb.0: ; RV64IZFH-NEXT: fcvt.lu.h a0, fa0, rmm ; RV64IZFH-NEXT: ret +; +; RV32IZHINX-LABEL: test_round_ui64: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: .cfi_offset ra, -4 +; RV32IZHINX-NEXT: fcvt.s.h a0, a0 +; RV32IZHINX-NEXT: call roundf@plt +; RV32IZHINX-NEXT: fcvt.h.s a0, a0 +; RV32IZHINX-NEXT: call __fixunshfdi@plt +; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: addi sp, sp, 16 +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: test_round_ui64: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: fcvt.lu.h a0, a0, rmm +; RV64IZHINX-NEXT: ret %a = call half @llvm.round.f16(half %x) %b = fptoui half %a to i64 ret i64 %b @@ -526,6 +882,16 @@ ; RV64IZFH: # %bb.0: ; RV64IZFH-NEXT: fcvt.l.h a0, fa0, rne ; RV64IZFH-NEXT: ret +; +; RV32IZHINX-LABEL: test_roundeven_si8: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: fcvt.w.h a0, a0, rne +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: test_roundeven_si8: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: fcvt.l.h a0, a0, rne +; RV64IZHINX-NEXT: ret %a = call half @llvm.roundeven.f16(half %x) %b = fptosi half %a to i8 ret i8 %b @@ -541,6 +907,16 @@ ; RV64IZFH: # %bb.0: ; RV64IZFH-NEXT: fcvt.l.h a0, fa0, rne ; RV64IZFH-NEXT: ret +; +; RV32IZHINX-LABEL: test_roundeven_si16: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: fcvt.w.h a0, a0, rne +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: test_roundeven_si16: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: fcvt.l.h a0, a0, rne +; RV64IZHINX-NEXT: ret %a = call half @llvm.roundeven.f16(half %x) %b = fptosi half %a to i16 ret i16 %b @@ -551,6 +927,11 @@ ; CHECKIZFH: # %bb.0: ; CHECKIZFH-NEXT: fcvt.w.h a0, fa0, rne ; CHECKIZFH-NEXT: ret +; +; CHECKIZHINX-LABEL: test_roundeven_si32: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: fcvt.w.h a0, a0, rne +; CHECKIZHINX-NEXT: ret %a = call half @llvm.roundeven.f16(half %x) %b = fptosi half %a to i32 ret i32 %b @@ -575,6 +956,25 @@ ; RV64IZFH: # %bb.0: ; RV64IZFH-NEXT: fcvt.l.h a0, fa0, rne ; RV64IZFH-NEXT: ret +; +; RV32IZHINX-LABEL: test_roundeven_si64: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: .cfi_offset ra, -4 +; RV32IZHINX-NEXT: fcvt.s.h a0, a0 +; RV32IZHINX-NEXT: call roundevenf@plt +; RV32IZHINX-NEXT: fcvt.h.s a0, a0 +; RV32IZHINX-NEXT: call __fixhfdi@plt +; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: addi sp, sp, 16 +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: test_roundeven_si64: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: fcvt.l.h a0, a0, rne +; RV64IZHINX-NEXT: ret %a = call half @llvm.roundeven.f16(half %x) %b = fptosi half %a to i64 ret i64 %b @@ -590,6 +990,16 @@ ; RV64IZFH: # %bb.0: ; RV64IZFH-NEXT: fcvt.lu.h a0, fa0, rne ; RV64IZFH-NEXT: ret +; +; RV32IZHINX-LABEL: test_roundeven_ui8: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: fcvt.wu.h a0, a0, rne +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: test_roundeven_ui8: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: fcvt.lu.h a0, a0, rne +; RV64IZHINX-NEXT: ret %a = call half @llvm.roundeven.f16(half %x) %b = fptoui half %a to i8 ret i8 %b @@ -605,6 +1015,16 @@ ; RV64IZFH: # %bb.0: ; RV64IZFH-NEXT: fcvt.lu.h a0, fa0, rne ; RV64IZFH-NEXT: ret +; +; RV32IZHINX-LABEL: test_roundeven_ui16: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: fcvt.wu.h a0, a0, rne +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: test_roundeven_ui16: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: fcvt.lu.h a0, a0, rne +; RV64IZHINX-NEXT: ret %a = call half @llvm.roundeven.f16(half %x) %b = fptoui half %a to i16 ret i16 %b @@ -615,6 +1035,11 @@ ; CHECKIZFH: # %bb.0: ; CHECKIZFH-NEXT: fcvt.wu.h a0, fa0, rne ; CHECKIZFH-NEXT: ret +; +; CHECKIZHINX-LABEL: test_roundeven_ui32: +; CHECKIZHINX: # %bb.0: +; CHECKIZHINX-NEXT: fcvt.wu.h a0, a0, rne +; CHECKIZHINX-NEXT: ret %a = call half @llvm.roundeven.f16(half %x) %b = fptoui half %a to i32 ret i32 %b @@ -639,6 +1064,25 @@ ; RV64IZFH: # %bb.0: ; RV64IZFH-NEXT: fcvt.lu.h a0, fa0, rne ; RV64IZFH-NEXT: ret +; +; RV32IZHINX-LABEL: test_roundeven_ui64: +; RV32IZHINX: # %bb.0: +; RV32IZHINX-NEXT: addi sp, sp, -16 +; RV32IZHINX-NEXT: .cfi_def_cfa_offset 16 +; RV32IZHINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; RV32IZHINX-NEXT: .cfi_offset ra, -4 +; RV32IZHINX-NEXT: fcvt.s.h a0, a0 +; RV32IZHINX-NEXT: call roundevenf@plt +; RV32IZHINX-NEXT: fcvt.h.s a0, a0 +; RV32IZHINX-NEXT: call __fixunshfdi@plt +; RV32IZHINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; RV32IZHINX-NEXT: addi sp, sp, 16 +; RV32IZHINX-NEXT: ret +; +; RV64IZHINX-LABEL: test_roundeven_ui64: +; RV64IZHINX: # %bb.0: +; RV64IZHINX-NEXT: fcvt.lu.h a0, a0, rne +; RV64IZHINX-NEXT: ret %a = call half @llvm.roundeven.f16(half %x) %b = fptoui half %a to i64 ret i64 %b diff --git a/llvm/test/CodeGen/RISCV/half-select-fcmp.ll b/llvm/test/CodeGen/RISCV/half-select-fcmp.ll --- a/llvm/test/CodeGen/RISCV/half-select-fcmp.ll +++ b/llvm/test/CodeGen/RISCV/half-select-fcmp.ll @@ -3,12 +3,21 @@ ; RUN: -target-abi ilp32f < %s | FileCheck %s ; RUN: llc -mtriple=riscv64 -mattr=+zfh -verify-machineinstrs \ ; RUN: -target-abi lp64f < %s | FileCheck %s +; RUN: llc -mtriple=riscv32 -mattr=+zhinx -verify-machineinstrs \ +; RUN: -target-abi ilp32 < %s | FileCheck --check-prefix=CHECKZHINX %s +; RUN: llc -mtriple=riscv64 -mattr=+zhinx -verify-machineinstrs \ +; RUN: -target-abi lp64 < %s | FileCheck --check-prefix=CHECKZHINX %s define half @select_fcmp_false(half %a, half %b) nounwind { ; CHECK-LABEL: select_fcmp_false: ; CHECK: # %bb.0: ; CHECK-NEXT: fmv.h fa0, fa1 ; CHECK-NEXT: ret +; +; CHECKZHINX-LABEL: select_fcmp_false: +; CHECKZHINX: # %bb.0: +; CHECKZHINX-NEXT: mv a0, a1 +; CHECKZHINX-NEXT: ret %1 = fcmp false half %a, %b %2 = select i1 %1, half %a, half %b ret half %2 @@ -23,6 +32,15 @@ ; CHECK-NEXT: fmv.h fa0, fa1 ; CHECK-NEXT: .LBB1_2: ; CHECK-NEXT: ret +; +; CHECKZHINX-LABEL: select_fcmp_oeq: +; CHECKZHINX: # %bb.0: +; CHECKZHINX-NEXT: feq.h a2, a0, a1 +; CHECKZHINX-NEXT: bnez a2, .LBB1_2 +; CHECKZHINX-NEXT: # %bb.1: +; CHECKZHINX-NEXT: mv a0, a1 +; CHECKZHINX-NEXT: .LBB1_2: +; CHECKZHINX-NEXT: ret %1 = fcmp oeq half %a, %b %2 = select i1 %1, half %a, half %b ret half %2 @@ -37,6 +55,15 @@ ; CHECK-NEXT: fmv.h fa0, fa1 ; CHECK-NEXT: .LBB2_2: ; CHECK-NEXT: ret +; +; CHECKZHINX-LABEL: select_fcmp_ogt: +; CHECKZHINX: # %bb.0: +; CHECKZHINX-NEXT: flt.h a2, a1, a0 +; CHECKZHINX-NEXT: bnez a2, .LBB2_2 +; CHECKZHINX-NEXT: # %bb.1: +; CHECKZHINX-NEXT: mv a0, a1 +; CHECKZHINX-NEXT: .LBB2_2: +; CHECKZHINX-NEXT: ret %1 = fcmp ogt half %a, %b %2 = select i1 %1, half %a, half %b ret half %2 @@ -51,6 +78,15 @@ ; CHECK-NEXT: fmv.h fa0, fa1 ; CHECK-NEXT: .LBB3_2: ; CHECK-NEXT: ret +; +; CHECKZHINX-LABEL: select_fcmp_oge: +; CHECKZHINX: # %bb.0: +; CHECKZHINX-NEXT: fle.h a2, a1, a0 +; CHECKZHINX-NEXT: bnez a2, .LBB3_2 +; CHECKZHINX-NEXT: # %bb.1: +; CHECKZHINX-NEXT: mv a0, a1 +; CHECKZHINX-NEXT: .LBB3_2: +; CHECKZHINX-NEXT: ret %1 = fcmp oge half %a, %b %2 = select i1 %1, half %a, half %b ret half %2 @@ -65,6 +101,15 @@ ; CHECK-NEXT: fmv.h fa0, fa1 ; CHECK-NEXT: .LBB4_2: ; CHECK-NEXT: ret +; +; CHECKZHINX-LABEL: select_fcmp_olt: +; CHECKZHINX: # %bb.0: +; CHECKZHINX-NEXT: flt.h a2, a0, a1 +; CHECKZHINX-NEXT: bnez a2, .LBB4_2 +; CHECKZHINX-NEXT: # %bb.1: +; CHECKZHINX-NEXT: mv a0, a1 +; CHECKZHINX-NEXT: .LBB4_2: +; CHECKZHINX-NEXT: ret %1 = fcmp olt half %a, %b %2 = select i1 %1, half %a, half %b ret half %2 @@ -79,6 +124,15 @@ ; CHECK-NEXT: fmv.h fa0, fa1 ; CHECK-NEXT: .LBB5_2: ; CHECK-NEXT: ret +; +; CHECKZHINX-LABEL: select_fcmp_ole: +; CHECKZHINX: # %bb.0: +; CHECKZHINX-NEXT: fle.h a2, a0, a1 +; CHECKZHINX-NEXT: bnez a2, .LBB5_2 +; CHECKZHINX-NEXT: # %bb.1: +; CHECKZHINX-NEXT: mv a0, a1 +; CHECKZHINX-NEXT: .LBB5_2: +; CHECKZHINX-NEXT: ret %1 = fcmp ole half %a, %b %2 = select i1 %1, half %a, half %b ret half %2 @@ -95,6 +149,17 @@ ; CHECK-NEXT: fmv.h fa0, fa1 ; CHECK-NEXT: .LBB6_2: ; CHECK-NEXT: ret +; +; CHECKZHINX-LABEL: select_fcmp_one: +; CHECKZHINX: # %bb.0: +; CHECKZHINX-NEXT: flt.h a2, a0, a1 +; CHECKZHINX-NEXT: flt.h a3, a1, a0 +; CHECKZHINX-NEXT: or a2, a3, a2 +; CHECKZHINX-NEXT: bnez a2, .LBB6_2 +; CHECKZHINX-NEXT: # %bb.1: +; CHECKZHINX-NEXT: mv a0, a1 +; CHECKZHINX-NEXT: .LBB6_2: +; CHECKZHINX-NEXT: ret %1 = fcmp one half %a, %b %2 = select i1 %1, half %a, half %b ret half %2 @@ -111,6 +176,17 @@ ; CHECK-NEXT: fmv.h fa0, fa1 ; CHECK-NEXT: .LBB7_2: ; CHECK-NEXT: ret +; +; CHECKZHINX-LABEL: select_fcmp_ord: +; CHECKZHINX: # %bb.0: +; CHECKZHINX-NEXT: feq.h a2, a1, a1 +; CHECKZHINX-NEXT: feq.h a3, a0, a0 +; CHECKZHINX-NEXT: and a2, a3, a2 +; CHECKZHINX-NEXT: bnez a2, .LBB7_2 +; CHECKZHINX-NEXT: # %bb.1: +; CHECKZHINX-NEXT: mv a0, a1 +; CHECKZHINX-NEXT: .LBB7_2: +; CHECKZHINX-NEXT: ret %1 = fcmp ord half %a, %b %2 = select i1 %1, half %a, half %b ret half %2 @@ -127,6 +203,17 @@ ; CHECK-NEXT: fmv.h fa0, fa1 ; CHECK-NEXT: .LBB8_2: ; CHECK-NEXT: ret +; +; CHECKZHINX-LABEL: select_fcmp_ueq: +; CHECKZHINX: # %bb.0: +; CHECKZHINX-NEXT: flt.h a2, a0, a1 +; CHECKZHINX-NEXT: flt.h a3, a1, a0 +; CHECKZHINX-NEXT: or a2, a3, a2 +; CHECKZHINX-NEXT: beqz a2, .LBB8_2 +; CHECKZHINX-NEXT: # %bb.1: +; CHECKZHINX-NEXT: mv a0, a1 +; CHECKZHINX-NEXT: .LBB8_2: +; CHECKZHINX-NEXT: ret %1 = fcmp ueq half %a, %b %2 = select i1 %1, half %a, half %b ret half %2 @@ -141,6 +228,15 @@ ; CHECK-NEXT: fmv.h fa0, fa1 ; CHECK-NEXT: .LBB9_2: ; CHECK-NEXT: ret +; +; CHECKZHINX-LABEL: select_fcmp_ugt: +; CHECKZHINX: # %bb.0: +; CHECKZHINX-NEXT: fle.h a2, a0, a1 +; CHECKZHINX-NEXT: beqz a2, .LBB9_2 +; CHECKZHINX-NEXT: # %bb.1: +; CHECKZHINX-NEXT: mv a0, a1 +; CHECKZHINX-NEXT: .LBB9_2: +; CHECKZHINX-NEXT: ret %1 = fcmp ugt half %a, %b %2 = select i1 %1, half %a, half %b ret half %2 @@ -155,6 +251,15 @@ ; CHECK-NEXT: fmv.h fa0, fa1 ; CHECK-NEXT: .LBB10_2: ; CHECK-NEXT: ret +; +; CHECKZHINX-LABEL: select_fcmp_uge: +; CHECKZHINX: # %bb.0: +; CHECKZHINX-NEXT: flt.h a2, a0, a1 +; CHECKZHINX-NEXT: beqz a2, .LBB10_2 +; CHECKZHINX-NEXT: # %bb.1: +; CHECKZHINX-NEXT: mv a0, a1 +; CHECKZHINX-NEXT: .LBB10_2: +; CHECKZHINX-NEXT: ret %1 = fcmp uge half %a, %b %2 = select i1 %1, half %a, half %b ret half %2 @@ -169,6 +274,15 @@ ; CHECK-NEXT: fmv.h fa0, fa1 ; CHECK-NEXT: .LBB11_2: ; CHECK-NEXT: ret +; +; CHECKZHINX-LABEL: select_fcmp_ult: +; CHECKZHINX: # %bb.0: +; CHECKZHINX-NEXT: fle.h a2, a1, a0 +; CHECKZHINX-NEXT: beqz a2, .LBB11_2 +; CHECKZHINX-NEXT: # %bb.1: +; CHECKZHINX-NEXT: mv a0, a1 +; CHECKZHINX-NEXT: .LBB11_2: +; CHECKZHINX-NEXT: ret %1 = fcmp ult half %a, %b %2 = select i1 %1, half %a, half %b ret half %2 @@ -183,6 +297,15 @@ ; CHECK-NEXT: fmv.h fa0, fa1 ; CHECK-NEXT: .LBB12_2: ; CHECK-NEXT: ret +; +; CHECKZHINX-LABEL: select_fcmp_ule: +; CHECKZHINX: # %bb.0: +; CHECKZHINX-NEXT: flt.h a2, a1, a0 +; CHECKZHINX-NEXT: beqz a2, .LBB12_2 +; CHECKZHINX-NEXT: # %bb.1: +; CHECKZHINX-NEXT: mv a0, a1 +; CHECKZHINX-NEXT: .LBB12_2: +; CHECKZHINX-NEXT: ret %1 = fcmp ule half %a, %b %2 = select i1 %1, half %a, half %b ret half %2 @@ -197,6 +320,15 @@ ; CHECK-NEXT: fmv.h fa0, fa1 ; CHECK-NEXT: .LBB13_2: ; CHECK-NEXT: ret +; +; CHECKZHINX-LABEL: select_fcmp_une: +; CHECKZHINX: # %bb.0: +; CHECKZHINX-NEXT: feq.h a2, a0, a1 +; CHECKZHINX-NEXT: beqz a2, .LBB13_2 +; CHECKZHINX-NEXT: # %bb.1: +; CHECKZHINX-NEXT: mv a0, a1 +; CHECKZHINX-NEXT: .LBB13_2: +; CHECKZHINX-NEXT: ret %1 = fcmp une half %a, %b %2 = select i1 %1, half %a, half %b ret half %2 @@ -213,6 +345,17 @@ ; CHECK-NEXT: fmv.h fa0, fa1 ; CHECK-NEXT: .LBB14_2: ; CHECK-NEXT: ret +; +; CHECKZHINX-LABEL: select_fcmp_uno: +; CHECKZHINX: # %bb.0: +; CHECKZHINX-NEXT: feq.h a2, a1, a1 +; CHECKZHINX-NEXT: feq.h a3, a0, a0 +; CHECKZHINX-NEXT: and a2, a3, a2 +; CHECKZHINX-NEXT: beqz a2, .LBB14_2 +; CHECKZHINX-NEXT: # %bb.1: +; CHECKZHINX-NEXT: mv a0, a1 +; CHECKZHINX-NEXT: .LBB14_2: +; CHECKZHINX-NEXT: ret %1 = fcmp uno half %a, %b %2 = select i1 %1, half %a, half %b ret half %2 @@ -222,6 +365,10 @@ ; CHECK-LABEL: select_fcmp_true: ; CHECK: # %bb.0: ; CHECK-NEXT: ret +; +; CHECKZHINX-LABEL: select_fcmp_true: +; CHECKZHINX: # %bb.0: +; CHECKZHINX-NEXT: ret %1 = fcmp true half %a, %b %2 = select i1 %1, half %a, half %b ret half %2 @@ -237,6 +384,16 @@ ; CHECK-NEXT: mv a0, a1 ; CHECK-NEXT: .LBB16_2: ; CHECK-NEXT: ret +; +; CHECKZHINX-LABEL: i32_select_fcmp_oeq: +; CHECKZHINX: # %bb.0: +; CHECKZHINX-NEXT: feq.h a1, a0, a1 +; CHECKZHINX-NEXT: mv a0, a2 +; CHECKZHINX-NEXT: bnez a1, .LBB16_2 +; CHECKZHINX-NEXT: # %bb.1: +; CHECKZHINX-NEXT: mv a0, a3 +; CHECKZHINX-NEXT: .LBB16_2: +; CHECKZHINX-NEXT: ret %1 = fcmp oeq half %a, %b %2 = select i1 %1, i32 %c, i32 %d ret i32 %2