[libclc] [libclc] Move mad_sat to CLC; optimize for vector types (PR #125517)

Matt Arsenault via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 3 07:40:49 PST 2025


================
@@ -0,0 +1,119 @@
+#include <clc/clcmacro.h>
+#include <clc/integer/clc_add_sat.h>
+#include <clc/integer/clc_mad24.h>
+#include <clc/integer/clc_mul_hi.h>
+#include <clc/integer/clc_upsample.h>
+#include <clc/integer/definitions.h>
+#include <clc/internal/clc.h>
+#include <clc/relational/clc_select.h>
+#include <clc/shared/clc_clamp.h>
+
+#define __CLC_CONVERT_TY(X, TY) __builtin_convertvector(X, TY)
+
+// Macro for defining mad_sat variants for char/uchar/short/ushort
+// FIXME: Once using __clc_convert_ty, can easily unify scalar and vector defs
+#define _CLC_DEFINE_SIMPLE_MAD_SAT(TYPE, UP_TYPE, LIT_PREFIX)                  \
----------------
arsenm wrote:

probably should move this to use clc++ and templates instead of macros 

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


More information about the cfe-commits mailing list