[llvm] AMDGPU: Make v2f64 -> v2f16 conversion Legal only when unsafe fast math is set (PR #134738)
Changpeng Fang via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 8 13:15:28 PDT 2025
================
@@ -915,7 +915,7 @@ SITargetLowering::SITargetLowering(const TargetMachine &TM,
setOperationAction(ISD::BUILD_VECTOR, MVT::v2bf16, Legal);
}
- if (Subtarget->hasCvtPkF16F32Inst()) {
+ if (Subtarget->hasCvtPkF16F32Inst() && TM.Options.UnsafeFPMath) {
setOperationAction(ISD::FP_ROUND, MVT::v2f16, Legal);
----------------
changpeng wrote:
I am still learning. I think even though we specify Custom lowering but actually doing nothing, like:
if (SrcVT. != MVT::f64)
return Op; // **f32 is legal for fp_round**
This is essentially "Legal", which means either there is a native instruction, or a pattern to match to native instructions. The compiler will throw an error if there is nothing to select.
https://github.com/llvm/llvm-project/pull/134738
More information about the llvm-commits
mailing list