Skip to content

Commit 966b026

Browse files
committed
[NVPTX] Simplify handling of ISD::BF16_TO_FP
We only use it to get from BF16 to F32. After that point, we insert an FP_EXTEND to get the rest of the way.
1 parent 6f0e39c commit 966b026

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,6 @@ NVPTXTargetLowering::NVPTXTargetLowering(const NVPTXTargetMachine &TM,
784784
setOperationAction(ISD::FP_EXTEND, VT, Custom);
785785
setOperationAction(ISD::FP_ROUND, VT, Custom);
786786
}
787-
setOperationAction(ISD::BF16_TO_FP, MVT::f64, Custom);
788787
}
789788

790789
// sm_80 only has conversions between f32 and bf16. Custom lower all other
@@ -2526,15 +2525,13 @@ SDValue NVPTXTargetLowering::LowerFP_EXTEND(SDValue Op,
25262525
(STI.getSmVersion() < 90 || STI.getPTXVersion() < 78)) {
25272526
EVT F32 = NarrowVT.isVector() ? NarrowVT.changeVectorElementType(MVT::f32)
25282527
: MVT::f32;
2529-
EVT F64 = NarrowVT.isVector() ? NarrowVT.changeVectorElementType(MVT::f64)
2530-
: MVT::f64;
25312528
SDLoc Loc(Op);
25322529
if (STI.getSmVersion() >= 80 && STI.getPTXVersion() >= 71) {
25332530
Op = DAG.getNode(ISD::FP_EXTEND, Loc, F32, Narrow);
25342531
} else {
25352532
Op = DAG.getNode(ISD::BF16_TO_FP, Loc, F32, Narrow);
25362533
}
2537-
return DAG.getNode(ISD::FP_EXTEND, Loc, F64, Op);
2534+
return DAG.getNode(ISD::FP_EXTEND, Loc, WideVT, Op);
25382535
}
25392536
}
25402537

0 commit comments

Comments
 (0)