[llvm] [X86] Lower `minimum`/`maximum`/`minimumnum`/`maximumnum` using bitwise operations (PR #170069)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 9 13:02:55 PST 2025
ActuallyaDeviloper wrote:
I am also concerned about the memory operation. Is this really the best way to implement these?
Some ideas:
- AVX-512 has `VRANGEPS` which despite it's name computes "minimumnum"/"maximumnum" like IEEE 2009.
- I think `minimum` can be implemented like `minimumnum(x,y) = minps(x,y)|minps(y,x)`. If one of x or y is NaN, then one of the two will be NaN and so will be the result. If both are not NaN or zero, then they agree and hence the "or" is the "minps". Finally, if both are zero, then `minps(x,y)|minps(y,x)=y|x` which prefers the signed zero.
- The other variants can be generated by a similar construction for `maximumnum` and NaN fixup I think.
https://github.com/llvm/llvm-project/pull/170069
More information about the llvm-commits
mailing list