[clang] [Clang] Add elementwise maximumnum/minimumnum builtin functions (PR #149775)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 21 06:30:27 PDT 2025


================
@@ -848,6 +848,14 @@ of different sizes and signs is forbidden in binary and ternary builtins.
                                                 semantics, see `LangRef
                                                 <http://llvm.org/docs/LangRef.html#llvm-min-intrinsics-comparation>`_
                                                 for the comparison.
+ T __builtin_elementwise_maximumnum(T x, T y)   return x or y, whichever is larger. Follows IEEE 754-2019              floating point types
+                                                semantics, see `LangRef
+                                                <http://llvm.org/docs/LangRef.html#llvm-min-intrinsics-comparation>`_
+                                                for the comparison.
+ T __builtin_elementwise_minimumnum(T x, T y)   return x or y, whichever is smaller. Follows IEEE 754-2019             floating point types
----------------
AaronBallman wrote:

I'm confused. :-)

We have `__builtin_elementwise_min`, `__builtin_elementwise_minnum`, `__builtin_elementwise_minimum`, and now we're adding `__builtin_elementwise_minimumnum`?

I think the docs need to be expanded a bit to help understand what the difference is between the four choices. Same for maximum.

Why do we need four different builtins to select the lesser of two values?

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


More information about the cfe-commits mailing list