[llvm] LangRef: Clarify behaviors of nsz in fast math flag (PR #137567)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Thu May 15 13:06:15 PDT 2025
arsenm wrote:
> Trying to get IEEE-754 semantics by _adding_ fast-math flags seems wrong to me.
Calling this semantics is too strong; it's a relaxation permitted by the standard. The superior QoI that it seems just about every ISA implemented is to properly order -0 < +0, and this is the required behavior for both minimum and minimumNumber in the 2019 version. This is a semantic relaxation, and as the one place with a standard has a fuzzy signed zero handling I think the goal should be to define NSZ around this. I don't see how it's useful to permit flipping the sign out of nothing
> If we want IEEE-754 2008 semantics for an intrinsic, why don't we just make an intrinsic with the semantics we want.
That would make the set of min/max intrinsics even more ridiculous than it is now, for what is only an optimization modifier. The current LangRef splits the difference between 2008 and 2019 and strengthens the signed zero treatment. I also view the lack of definitive signed zero handling is more of an optimization blocker than enabler. You cannot make a definitive statement about the sign for a clamp to zero. The fuzzy signed zero only reduces instructions in the software expansion
https://github.com/llvm/llvm-project/pull/137567
More information about the llvm-commits
mailing list