@@ -9564,6 +9564,26 @@ SDValue RISCVTargetLowering::lowerSELECT(SDValue Op, SelectionDAG &DAG) const {
95649564 if (UseZicondForFPSel) {
95659565 MVT XLenIntVT = Subtarget.getXLenVT();
95669566
9567+ // Handle RV32 with f64 (Zdinx): Split into two 32-bit integer selects.
9568+ if (VT == MVT::f64 && !Subtarget.is64Bit()) {
9569+ SDValue TrueSplit = DAG.getNode(RISCVISD::SplitF64, DL,
9570+ DAG.getVTList(MVT::i32, MVT::i32), TrueV);
9571+ SDValue FalseSplit = DAG.getNode(
9572+ RISCVISD::SplitF64, DL, DAG.getVTList(MVT::i32, MVT::i32), FalseV);
9573+
9574+ SDValue TrueLo = TrueSplit.getValue(0);
9575+ SDValue TrueHi = TrueSplit.getValue(1);
9576+ SDValue FalseLo = FalseSplit.getValue(0);
9577+ SDValue FalseHi = FalseSplit.getValue(1);
9578+
9579+ SDValue ResLo =
9580+ DAG.getNode(ISD::SELECT, DL, MVT::i32, CondV, TrueLo, FalseLo);
9581+ SDValue ResHi =
9582+ DAG.getNode(ISD::SELECT, DL, MVT::i32, CondV, TrueHi, FalseHi);
9583+
9584+ return DAG.getNode(RISCVISD::BuildPairF64, DL, MVT::f64, ResLo, ResHi);
9585+ }
9586+
95679587 auto CastToInt = [&](SDValue V) -> SDValue {
95689588 if (VT == MVT::f16)
95699589 return DAG.getNode(RISCVISD::FMV_X_ANYEXTH, DL, XLenIntVT, V);
0 commit comments