[llvm] LangRef: Clarify llvm.minnum and llvm.maxnum about sNaN and signed zero (PR #112852)
Phoebe Wang via llvm-commits
llvm-commits at lists.llvm.org
Sat Nov 8 23:38:54 PST 2025
phoebewang wrote:
@wzssyqa Just noticed this change due to #166912. I don't agree with the sentences:
> Although C23 clarified the behavior about sNaN and +0.0/-0.0: (NUM or NaN) vs sNaN -> qNaN +0.0 vs -0.0 -> either one of +0.0/-0.0 It is the same the IEEE754-2008's maxNUM and minNUM. Not all implementation work as expected.
>
> Since some architectures such as aarch64/MIPSr6/LoongArch, have instructions that implements +0.0>-0.0. So Let's define llvm.minnum and llvm.maxnum to IEEE754-2008 with +0.0>-0.0.
>
> The architectures without such instructions can implements `NSZ` flavor to speed up, and the frontend, such as clang, can call them with `nsz` attribute.
Because:
1. `nsz` attribute is not emitted by the frontend so far;
2. So it is a behavioural change to targets that doesn't implement +0.0>-0.0 like X86 instead of speed up problem;
We should not change LangRef if not all targets are ready for it.
@nikic, I noticed you have a revert commit, which never landed. I agree with your points in the commit. Any reason you decided not to revert it?
https://github.com/llvm/llvm-project/pull/112852
More information about the llvm-commits
mailing list