[llvm] [LangRef] Clarify specification for float min/max operations (PR #172012)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 30 08:17:18 PST 2025
ActuallyaDeviloper wrote:
What is currently still in the way of making progress on this front? Is it just the signed zero concern from Phoebewang?
I must say I personally do not fully understand the concern around signed zero handling. People who do not care about signed zero can easily set the flag and get exactly what they want. The only downside I see is with the import of legacy bitcode, but do people really have old hard-to-update IR files laying around with performance criticial min/max? I am very doubtful of that and to my knowledge LLVM IR was always intended as an evolving language.
Alternatively we could either
- define a new `minnumV2` instruction and auto upgrade by setting the flag or
- have an entirely different `minnum_no_nsz` instruction which _does_ respect signed zero and is otherwise identical to _minnum_.
However the churn the first option introduces seems entirely unwarranted to me in this case and the second option would introduce a permanent inconsitency to LLVM IR for (potentially) all of time which is also not desirable.
Note that I think having a target-independent way to express exactly what IEEE 2008 + signed zero provide is necessary. Most hardware implement do exactly that (including x86 with VRANGE) and we even already have a builtin "__builtin_elementwise_minnum" which is officially released in Clang 21 and is documented to behave that way. Although I think it's currently broken, I don't think we slould walk that back the concept.
https://github.com/llvm/llvm-project/pull/172012
More information about the llvm-commits
mailing list