@@ -9593,6 +9593,26 @@ SDValue RISCVTargetLowering::lowerSELECT(SDValue Op, SelectionDAG &DAG) const {
95939593 if (UseZicondForFPSel) {
95949594 MVT XLenIntVT = Subtarget.getXLenVT();
95959595
9596+ // Handle RV32 with f64 (Zdinx): Split into two 32-bit integer selects.
9597+ if (VT == MVT::f64 && !Subtarget.is64Bit()) {
9598+ SDValue TrueSplit = DAG.getNode(RISCVISD::SplitF64, DL,
9599+ DAG.getVTList(MVT::i32, MVT::i32), TrueV);
9600+ SDValue FalseSplit = DAG.getNode(
9601+ RISCVISD::SplitF64, DL, DAG.getVTList(MVT::i32, MVT::i32), FalseV);
9602+
9603+ SDValue TrueLo = TrueSplit.getValue(0);
9604+ SDValue TrueHi = TrueSplit.getValue(1);
9605+ SDValue FalseLo = FalseSplit.getValue(0);
9606+ SDValue FalseHi = FalseSplit.getValue(1);
9607+
9608+ SDValue ResLo =
9609+ DAG.getNode(ISD::SELECT, DL, MVT::i32, CondV, TrueLo, FalseLo);
9610+ SDValue ResHi =
9611+ DAG.getNode(ISD::SELECT, DL, MVT::i32, CondV, TrueHi, FalseHi);
9612+
9613+ return DAG.getNode(RISCVISD::BuildPairF64, DL, MVT::f64, ResLo, ResHi);
9614+ }
9615+
95969616 auto CastToInt = [&](SDValue V) -> SDValue {
95979617 if (VT == MVT::f16)
95989618 return DAG.getNode(RISCVISD::FMV_X_ANYEXTH, DL, XLenIntVT, V);
0 commit comments