[llvm] [AMDGPU] Make direct f16 <-> i32 conversion illegal (PR #205565)
Lukas Sommer via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 24 06:54:05 PDT 2026
================
@@ -635,13 +638,6 @@ SITargetLowering::SITargetLowering(const TargetMachine &TM,
if (Subtarget->hasBF16TransInsts())
setOperationAction({ISD::FCOS, ISD::FSIN, ISD::FDIV}, MVT::bf16, Custom);
- setOperationAction({ISD::FP_TO_SINT, ISD::FP_TO_UINT, ISD::FP_TO_SINT_SAT,
- ISD::FP_TO_UINT_SAT},
- MVT::f16, Promote);
- setOperationAction({ISD::FP_TO_SINT, ISD::FP_TO_UINT, ISD::FP_TO_SINT_SAT,
- ISD::FP_TO_UINT_SAT},
- MVT::bf16, Promote);
-
// F16 - VOP2 Actions.
----------------
sommerlukas wrote:
I believe the intent of these lines was to promote `f16` to `f32` before the conversion. However, if my understand is correct, these lines are not effective, as `FP_TO_[S|U]INT[_SAT]` legality is queried with the integer result type and not the float source type.
The non-saturated case is covered by the new `setOperationAction({ISD::FP_TO_SINT, ISD::FP_TO_UINT}, MVT::i32, Custom);` above.
The saturated case should already be covered here: https://github.com/llvm/llvm-project/blob/d089c9add10d5604a397e9af6359a139393420fe/llvm/lib/Target/AMDGPU/SIISelLowering.cpp#L570-L571
https://github.com/llvm/llvm-project/pull/205565
More information about the llvm-commits
mailing list