[llvm] [KnownFPClass] Correct denormal mode handling for `KnownFPClass::minMaxLike` (PR #220148)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 13 07:51:35 PDT 2026
================
@@ -172,6 +159,19 @@ KnownFPClass KnownFPClass::minMaxLike(const KnownFPClass &LHS_,
}
}
+ // Fixup zero handling if denormal outputs/inputs could be treated as zero.
+ //
+ // As there's no spec for denormal flushing, be conservative with the
+ // treatment of denormals that could be flushed to zero. For older
+ // subtargets on AMDGPU the min/max instructions would not flush the
+ // output and return the original value.
+ //
+ if (Mode != DenormalMode::getIEEE() && (!KnownLHS.isKnownNeverSubnormal() ||
+ !KnownRHS.isKnownNeverSubnormal())) {
+ Known.setKnownFPClasses(Known.getKnownFPClasses() | fcZero);
+ Known.setSignBit(std::nullopt);
----------------
arsenm wrote:
It would be a bit better to avoid incorrectly inferring the sign bit in the first place, rather than fixing it up after
https://github.com/llvm/llvm-project/pull/220148
More information about the llvm-commits
mailing list