Skip to content

Commit e235ce4

Browse files
committed
Fix f16 Zicond SELECT lowering with Zhinx
1 parent f49320f commit e235ce4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

llvm/lib/Target/RISCV/RISCVISelLowering.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9565,6 +9565,9 @@ SDValue RISCVTargetLowering::lowerSELECT(SDValue Op, SelectionDAG &DAG) const {
95659565
MVT XLenIntVT = Subtarget.getXLenVT();
95669566

95679567
auto CastToInt = [&](SDValue V) -> SDValue {
9568+
if (VT == MVT::f16) {
9569+
return DAG.getNode(RISCVISD::FMV_X_ANYEXTH, DL, XLenIntVT, V);
9570+
}
95689571
if (VT == MVT::f32 && Subtarget.is64Bit()) {
95699572
return DAG.getNode(RISCVISD::FMV_X_ANYEXTW_RV64, DL, XLenIntVT, V);
95709573
}
@@ -9582,6 +9585,9 @@ SDValue RISCVTargetLowering::lowerSELECT(SDValue Op, SelectionDAG &DAG) const {
95829585
if (VT == MVT::f32 && Subtarget.is64Bit()) {
95839586
return DAG.getNode(RISCVISD::FMV_W_X_RV64, DL, VT, ResultInt);
95849587
}
9588+
if (VT == MVT::f16) {
9589+
return DAG.getNode(RISCVISD::FMV_H_X, DL, VT, ResultInt);
9590+
}
95859591
return DAG.getBitcast(VT, ResultInt);
95869592
}
95879593

0 commit comments

Comments
 (0)