[llvm] AMDGPU][True16][CodeGen] FP_Round f64 to f16 in true16 (PR #128911)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 25 15:02:24 PDT 2025
================
@@ -6899,7 +6899,17 @@ SDValue SITargetLowering::lowerFP_ROUND(SDValue Op, SelectionDAG &DAG) const {
if (Op.getOpcode() != ISD::FP_ROUND)
return Op;
- SDValue FpToFp16 = DAG.getNode(ISD::FP_TO_FP16, DL, MVT::i32, Src);
+ if (!Subtarget->has16BitInsts()) {
+ SDValue FpToFp16 = DAG.getNode(ISD::FP_TO_FP16, DL, MVT::i32, Src);
+ SDValue Trunc = DAG.getNode(ISD::TRUNCATE, DL, MVT::i16, FpToFp16);
+ return DAG.getNode(ISD::BITCAST, DL, MVT::f16, Trunc);
+ }
----------------
arsenm wrote:
I'm confused by this. FP_TO_FP16 does the right thing for an f64 source? Should the unsafe path be before this?
https://github.com/llvm/llvm-project/pull/128911
More information about the llvm-commits
mailing list