[libclc] [libclc] Move min/max/clamp into the CLC builtins library (PR #114386)
Matt Arsenault via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 31 07:43:18 PDT 2024
================
@@ -0,0 +1,11 @@
+_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __clc_max(__CLC_GENTYPE a,
+ __CLC_GENTYPE b) {
+ return (a > b ? a : b);
+}
+
+#ifndef __CLC_SCALAR
+_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __clc_max(__CLC_GENTYPE a,
+ __CLC_SCALAR_GENTYPE b) {
+ return (a > (__CLC_GENTYPE)b ? a : (__CLC_GENTYPE)b);
+}
+#endif
----------------
arsenm wrote:
Why not just use __builtin_elementwise_max? It's simplest to just not have all this boilerplate
https://github.com/llvm/llvm-project/pull/114386
More information about the cfe-commits
mailing list