Author: Fraser Cormack
Date: 2025-02-25T16:24:57Z
New Revision: a821ae284724f1522297c0b455b1ca5c05fbc270

URL: 
https://github.com/llvm/llvm-project/commit/a821ae284724f1522297c0b455b1ca5c05fbc270
DIFF: 
https://github.com/llvm/llvm-project/commit/a821ae284724f1522297c0b455b1ca5c05fbc270.diff

LOG: [libclc] Move round to CLC library (#128721)

Added: 
    libclc/clc/include/clc/math/clc_round.h
    libclc/clc/lib/generic/math/clc_round.cl

Modified: 
    libclc/clc/lib/generic/SOURCES
    libclc/generic/lib/math/round.cl

Removed: 
    


################################################################################
diff  --git a/libclc/clc/include/clc/math/clc_round.h 
b/libclc/clc/include/clc/math/clc_round.h
new file mode 100644
index 0000000000000..1402625ed7795
--- /dev/null
+++ b/libclc/clc/include/clc/math/clc_round.h
@@ -0,0 +1,12 @@
+#ifndef __CLC_MATH_CLC_ROUND_H__
+#define __CLC_MATH_CLC_ROUND_H__
+
+#define __CLC_BODY <clc/math/unary_decl.inc>
+#define __CLC_FUNCTION __clc_round
+
+#include <clc/math/gentype.inc>
+
+#undef __CLC_BODY
+#undef __CLC_FUNCTION
+
+#endif // __CLC_MATH_CLC_ROUND_H__

diff  --git a/libclc/clc/lib/generic/SOURCES b/libclc/clc/lib/generic/SOURCES
index 13667cebe02b9..dbf3c1bd31a0d 100644
--- a/libclc/clc/lib/generic/SOURCES
+++ b/libclc/clc/lib/generic/SOURCES
@@ -31,6 +31,7 @@ math/clc_modf.cl
 math/clc_nan.cl
 math/clc_nextafter.cl
 math/clc_rint.cl
+math/clc_round.cl
 math/clc_sw_fma.cl
 math/clc_trunc.cl
 relational/clc_all.cl

diff  --git a/libclc/clc/lib/generic/math/clc_round.cl 
b/libclc/clc/lib/generic/math/clc_round.cl
new file mode 100644
index 0000000000000..dfb3ee6631480
--- /dev/null
+++ b/libclc/clc/lib/generic/math/clc_round.cl
@@ -0,0 +1,6 @@
+#include <clc/internal/clc.h>
+
+#undef __CLC_FUNCTION
+#define __CLC_FUNCTION __clc_round
+#define __CLC_BUILTIN __builtin_elementwise_round
+#include <clc/math/unary_builtin.inc>

diff  --git a/libclc/generic/lib/math/round.cl 
b/libclc/generic/lib/math/round.cl
index 6344051820c79..46f8cf6396abb 100644
--- a/libclc/generic/lib/math/round.cl
+++ b/libclc/generic/lib/math/round.cl
@@ -1,9 +1,6 @@
 #include <clc/clc.h>
-
-// Map the llvm intrinsic to an OpenCL function.
-#define __CLC_FUNCTION __clc_round
-#define __CLC_INTRINSIC "llvm.round"
-#include <clc/math/unary_intrin.inc>
+#include <clc/clcmacro.h>
+#include <clc/math/clc_round.h>
 
 #undef __CLC_FUNCTION
 #define __CLC_FUNCTION round


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to