[llvm] [AMDGPU] Fix isCanonicalized for IEEE-mode-dependent sNaN quieting (PR #208733)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 31 09:28:42 PDT 2026
================
@@ -15960,8 +15960,37 @@ bool SITargetLowering::isCanonicalized(SelectionDAG &DAG, SDValue Op,
if (MaxDepth == 0)
return false;
+ // Prevent llvm.canonicalize from being silently dropped when the hardware
+ // won't quiet sNaN based on the following hardware sNaN quieting behavior.
+ //
+ // Pre-GFX12:
+ // Always quiet: v_cvt_f16_f32, v_cvt_pkrtz_f16_f32, v_dot2_f32_f16,
+ // v_cvt_f32_ubyte{0-3} (integer->float, never produces NaN).
+ // IEEE-dependent: all other float ops quiet sNaN only when MODE.IEEE=1.
+ // Never quiets: DIV_SCALE passes sNaN through even at MODE.IEEE=1.
+ //
+ // GFX12+: all exception-producing ops unconditionally quiet sNaN regardless
+ // of MODE.IEEE.
+ const bool IsGFX12Plus = Subtarget->getGeneration() >= AMDGPUSubtarget::GFX12;
----------------
arsenm wrote:
The feature you would really want is DX10ClampAndIEEEMode
https://github.com/llvm/llvm-project/pull/208733
More information about the llvm-commits
mailing list