Skip to content

Commit 68e26c4

Browse files
committed
Revise zicond with zfinx implement
* CondV should always be int, no need to check * Omit the if statement bracket when there is only oneline body
1 parent 905e17b commit 68e26c4

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

llvm/lib/Target/RISCV/RISCVISelLowering.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9558,19 +9558,19 @@ SDValue RISCVTargetLowering::lowerSELECT(SDValue Op, SelectionDAG &DAG) const {
95589558
// When there is no cost for GPR <-> FGPR, we can use zicond select for
95599559
// floating value when CondV is int type
95609560
bool FPinGPR = Subtarget.hasStdExtZfinx();
9561-
bool UseZicondForFPSel = Subtarget.hasStdExtZicond() && FPinGPR &&
9562-
VT.isFloatingPoint() &&
9563-
CondV.getValueType().isInteger();
9561+
bool UseZicondForFPSel =
9562+
Subtarget.hasStdExtZicond() && FPinGPR && VT.isFloatingPoint();
9563+
95649564
if (UseZicondForFPSel) {
95659565
MVT XLenIntVT = Subtarget.getXLenVT();
95669566

95679567
auto CastToInt = [&](SDValue V) -> SDValue {
9568-
if (VT == MVT::f16) {
9568+
if (VT == MVT::f16)
95699569
return DAG.getNode(RISCVISD::FMV_X_ANYEXTH, DL, XLenIntVT, V);
9570-
}
9571-
if (VT == MVT::f32 && Subtarget.is64Bit()) {
9570+
9571+
if (VT == MVT::f32 && Subtarget.is64Bit())
95729572
return DAG.getNode(RISCVISD::FMV_X_ANYEXTW_RV64, DL, XLenIntVT, V);
9573-
}
9573+
95749574
return DAG.getBitcast(XLenIntVT, V);
95759575
};
95769576

@@ -9582,12 +9582,12 @@ SDValue RISCVTargetLowering::lowerSELECT(SDValue Op, SelectionDAG &DAG) const {
95829582
DAG.getNode(ISD::SELECT, DL, XLenIntVT, CondV, TrueVInt, FalseVInt);
95839583

95849584
// Convert back to floating VT
9585-
if (VT == MVT::f32 && Subtarget.is64Bit()) {
9585+
if (VT == MVT::f32 && Subtarget.is64Bit())
95869586
return DAG.getNode(RISCVISD::FMV_W_X_RV64, DL, VT, ResultInt);
9587-
}
9588-
if (VT == MVT::f16) {
9587+
9588+
if (VT == MVT::f16)
95899589
return DAG.getNode(RISCVISD::FMV_H_X, DL, VT, ResultInt);
9590-
}
9590+
95919591
return DAG.getBitcast(VT, ResultInt);
95929592
}
95939593

0 commit comments

Comments
 (0)