[llvm] [LangRef] Clarify nsz semantics (PR #180906)

Joshua Cranmer via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 11 08:55:13 PST 2026


jcranmer-intel wrote:

The user-level semantics of `nsz` are to permit any transformations that would be illegal (only) because of the distinction between `-0.0` and `+0.0`, and I want to make sure we never lose sight of that. It's also meant to never "gratuitously" change the sign, and the current semantics are (probably unavoidably) a little too permissive in that regard.

I'm worried about the potential for cases that result in `-0.0` that we want to ignore but don't have an initial `-0.0` in the first place. Almost all of the special cases that result in `-0.0` for IEEE 754 operations either result from a `-0.0` input or a `-inf`. (The main exceptions I see are the *pi functions returning `-0.0` for some integers). It may make sense to also allow `nsz` to change the input sign of an infinity if that would change the sign of a `-0.0` or `+0.0` result.

https://github.com/llvm/llvm-project/pull/180906


More information about the llvm-commits mailing list