aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFraser Cormack <fraser@codeplay.com>2025-04-29 14:17:17 +0100
committerGitHub <noreply@github.com>2025-04-29 14:17:17 +0100
commit837d5a740f120eb077aa8808809c057fa38d91f3 (patch)
tree4e83816278928e64638cdbcc894c056b3f12b0fe
parent1e31f4b5eb96de3080810340c9083138a34587b8 (diff)
downloadllvm-837d5a740f120eb077aa8808809c057fa38d91f3.zip
llvm-837d5a740f120eb077aa8808809c057fa38d91f3.tar.gz
llvm-837d5a740f120eb077aa8808809c057fa38d91f3.tar.bz2
[libclc][NFC] Remove unary_builtin.inc (#137656)
We had two ways of achieving the same thing. This commit removes unary_builtin.inc in favour of the approach combining gentype.inc with unary_def.inc. There is no change to the codegen for any target.
-rw-r--r--libclc/clc/include/clc/math/unary_builtin.inc32
-rw-r--r--libclc/clc/lib/generic/math/clc_ceil.cl9
-rw-r--r--libclc/clc/lib/generic/math/clc_fabs.cl9
-rw-r--r--libclc/clc/lib/generic/math/clc_floor.cl9
-rw-r--r--libclc/clc/lib/generic/math/clc_rint.cl9
-rw-r--r--libclc/clc/lib/generic/math/clc_round.cl9
-rw-r--r--libclc/clc/lib/generic/math/clc_trunc.cl9
-rw-r--r--libclc/generic/lib/math/acos.cl8
-rw-r--r--libclc/generic/lib/math/acosh.cl7
-rw-r--r--libclc/generic/lib/math/acospi.cl6
-rw-r--r--libclc/generic/lib/math/asin.cl8
-rw-r--r--libclc/generic/lib/math/asinh.cl7
-rw-r--r--libclc/generic/lib/math/asinpi.cl7
-rw-r--r--libclc/generic/lib/math/atan.cl8
-rw-r--r--libclc/generic/lib/math/atanh.cl7
-rw-r--r--libclc/generic/lib/math/atanpi.cl7
-rw-r--r--libclc/generic/lib/math/ceil.cl8
-rw-r--r--libclc/generic/lib/math/fabs.cl8
-rw-r--r--libclc/generic/lib/math/floor.cl8
-rw-r--r--libclc/generic/lib/math/log1p.cl7
-rw-r--r--libclc/generic/lib/math/rint.cl7
-rw-r--r--libclc/generic/lib/math/round.cl8
-rw-r--r--libclc/generic/lib/math/trunc.cl7
23 files changed, 93 insertions, 111 deletions
diff --git a/libclc/clc/include/clc/math/unary_builtin.inc b/libclc/clc/include/clc/math/unary_builtin.inc
deleted file mode 100644
index 790eaec..0000000
--- a/libclc/clc/include/clc/math/unary_builtin.inc
+++ /dev/null
@@ -1,32 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#include <clc/clcmacro.h>
-#include <clc/utils.h>
-
-#ifndef __CLC_BUILTIN
-#define __CLC_BUILTIN __CLC_XCONCAT(__clc_, __CLC_FUNCTION)
-#endif
-
-_CLC_DEFINE_UNARY_BUILTIN(float, __CLC_FUNCTION, __CLC_BUILTIN, float)
-
-#ifdef cl_khr_fp64
-
-#pragma OPENCL EXTENSION cl_khr_fp64 : enable
-
-_CLC_DEFINE_UNARY_BUILTIN(double, __CLC_FUNCTION, __CLC_BUILTIN, double)
-
-#endif
-
-#ifdef cl_khr_fp16
-
-#pragma OPENCL EXTENSION cl_khr_fp16 : enable
-
-_CLC_DEFINE_UNARY_BUILTIN(half, __CLC_FUNCTION, __CLC_BUILTIN, half)
-
-#endif
diff --git a/libclc/clc/lib/generic/math/clc_ceil.cl b/libclc/clc/lib/generic/math/clc_ceil.cl
index 975b511..c4df638 100644
--- a/libclc/clc/lib/generic/math/clc_ceil.cl
+++ b/libclc/clc/lib/generic/math/clc_ceil.cl
@@ -8,7 +8,8 @@
#include <clc/internal/clc.h>
-#undef __CLC_FUNCTION
-#define __CLC_FUNCTION __clc_ceil
-#define __CLC_BUILTIN __builtin_elementwise_ceil
-#include <clc/math/unary_builtin.inc>
+#define FUNCTION __clc_ceil
+#define __CLC_FUNCTION(x) __builtin_elementwise_ceil
+#define __CLC_BODY <clc/shared/unary_def.inc>
+
+#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/generic/math/clc_fabs.cl b/libclc/clc/lib/generic/math/clc_fabs.cl
index 90841af..f684c1e 100644
--- a/libclc/clc/lib/generic/math/clc_fabs.cl
+++ b/libclc/clc/lib/generic/math/clc_fabs.cl
@@ -8,7 +8,8 @@
#include <clc/internal/clc.h>
-#undef __CLC_FUNCTION
-#define __CLC_FUNCTION __clc_fabs
-#define __CLC_BUILTIN __builtin_elementwise_abs
-#include <clc/math/unary_builtin.inc>
+#define FUNCTION __clc_fabs
+#define __CLC_FUNCTION(x) __builtin_elementwise_abs
+#define __CLC_BODY <clc/shared/unary_def.inc>
+
+#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/generic/math/clc_floor.cl b/libclc/clc/lib/generic/math/clc_floor.cl
index 2b80e5b..0626ba3 100644
--- a/libclc/clc/lib/generic/math/clc_floor.cl
+++ b/libclc/clc/lib/generic/math/clc_floor.cl
@@ -8,7 +8,8 @@
#include <clc/internal/clc.h>
-#undef __CLC_FUNCTION
-#define __CLC_FUNCTION __clc_floor
-#define __CLC_BUILTIN __builtin_elementwise_floor
-#include <clc/math/unary_builtin.inc>
+#define FUNCTION __clc_floor
+#define __CLC_FUNCTION(x) __builtin_elementwise_floor
+#define __CLC_BODY <clc/shared/unary_def.inc>
+
+#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/generic/math/clc_rint.cl b/libclc/clc/lib/generic/math/clc_rint.cl
index d0852bc..2188a7d 100644
--- a/libclc/clc/lib/generic/math/clc_rint.cl
+++ b/libclc/clc/lib/generic/math/clc_rint.cl
@@ -8,7 +8,8 @@
#include <clc/internal/clc.h>
-#undef __CLC_FUNCTION
-#define __CLC_FUNCTION __clc_rint
-#define __CLC_BUILTIN __builtin_elementwise_rint
-#include <clc/math/unary_builtin.inc>
+#define FUNCTION __clc_rint
+#define __CLC_FUNCTION(x) __builtin_elementwise_rint
+#define __CLC_BODY <clc/shared/unary_def.inc>
+
+#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/generic/math/clc_round.cl b/libclc/clc/lib/generic/math/clc_round.cl
index 9819490..e784dbe 100644
--- a/libclc/clc/lib/generic/math/clc_round.cl
+++ b/libclc/clc/lib/generic/math/clc_round.cl
@@ -8,7 +8,8 @@
#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>
+#define FUNCTION __clc_round
+#define __CLC_FUNCTION(x) __builtin_elementwise_round
+#define __CLC_BODY <clc/shared/unary_def.inc>
+
+#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/generic/math/clc_trunc.cl b/libclc/clc/lib/generic/math/clc_trunc.cl
index 3aa47ea..0bf2bc4 100644
--- a/libclc/clc/lib/generic/math/clc_trunc.cl
+++ b/libclc/clc/lib/generic/math/clc_trunc.cl
@@ -8,7 +8,8 @@
#include <clc/internal/clc.h>
-#undef __CLC_FUNCTION
-#define __CLC_FUNCTION __clc_trunc
-#define __CLC_BUILTIN __builtin_elementwise_trunc
-#include <clc/math/unary_builtin.inc>
+#define FUNCTION __clc_trunc
+#define __CLC_FUNCTION(x) __builtin_elementwise_trunc
+#define __CLC_BODY <clc/shared/unary_def.inc>
+
+#include <clc/math/gentype.inc>
diff --git a/libclc/generic/lib/math/acos.cl b/libclc/generic/lib/math/acos.cl
index 1efe5eb..85119b4 100644
--- a/libclc/generic/lib/math/acos.cl
+++ b/libclc/generic/lib/math/acos.cl
@@ -7,9 +7,9 @@
//===----------------------------------------------------------------------===//
#include <clc/clc.h>
-#include <clc/clcmacro.h>
#include <clc/math/clc_acos.h>
-#undef __CLC_FUNCTION
-#define __CLC_FUNCTION acos
-#include <clc/math/unary_builtin.inc>
+#define FUNCTION acos
+#define __CLC_BODY <clc/shared/unary_def.inc>
+
+#include <clc/math/gentype.inc>
diff --git a/libclc/generic/lib/math/acosh.cl b/libclc/generic/lib/math/acosh.cl
index 2accecd..7df6b87 100644
--- a/libclc/generic/lib/math/acosh.cl
+++ b/libclc/generic/lib/math/acosh.cl
@@ -9,6 +9,7 @@
#include <clc/clc.h>
#include <clc/math/clc_acosh.h>
-#undef __CLC_FUNCTION
-#define __CLC_FUNCTION acosh
-#include <clc/math/unary_builtin.inc>
+#define FUNCTION acosh
+#define __CLC_BODY <clc/shared/unary_def.inc>
+
+#include <clc/math/gentype.inc>
diff --git a/libclc/generic/lib/math/acospi.cl b/libclc/generic/lib/math/acospi.cl
index 844e0aa..d8e7744 100644
--- a/libclc/generic/lib/math/acospi.cl
+++ b/libclc/generic/lib/math/acospi.cl
@@ -9,7 +9,7 @@
#include <clc/clc.h>
#include <clc/math/clc_acospi.h>
-#undef __CLC_FUNCTION
-#define __CLC_FUNCTION acospi
-#include <clc/math/unary_builtin.inc>
+#define FUNCTION acospi
+#define __CLC_BODY <clc/shared/unary_def.inc>
+#include <clc/math/gentype.inc>
diff --git a/libclc/generic/lib/math/asin.cl b/libclc/generic/lib/math/asin.cl
index 360951c..58e4b744 100644
--- a/libclc/generic/lib/math/asin.cl
+++ b/libclc/generic/lib/math/asin.cl
@@ -7,9 +7,9 @@
//===----------------------------------------------------------------------===//
#include <clc/clc.h>
-#include <clc/clcmacro.h>
#include <clc/math/clc_asin.h>
-#undef __CLC_FUNCTION
-#define __CLC_FUNCTION asin
-#include <clc/math/unary_builtin.inc>
+#define FUNCTION asin
+#define __CLC_BODY <clc/shared/unary_def.inc>
+
+#include <clc/math/gentype.inc>
diff --git a/libclc/generic/lib/math/asinh.cl b/libclc/generic/lib/math/asinh.cl
index 2e2eb57..84ba61d 100644
--- a/libclc/generic/lib/math/asinh.cl
+++ b/libclc/generic/lib/math/asinh.cl
@@ -9,6 +9,7 @@
#include <clc/clc.h>
#include <clc/math/clc_asinh.h>
-#undef __CLC_FUNCTION
-#define __CLC_FUNCTION asinh
-#include <clc/math/unary_builtin.inc>
+#define FUNCTION asinh
+#define __CLC_BODY <clc/shared/unary_def.inc>
+
+#include <clc/math/gentype.inc>
diff --git a/libclc/generic/lib/math/asinpi.cl b/libclc/generic/lib/math/asinpi.cl
index 7e109e8..bf232ef 100644
--- a/libclc/generic/lib/math/asinpi.cl
+++ b/libclc/generic/lib/math/asinpi.cl
@@ -9,6 +9,7 @@
#include <clc/clc.h>
#include <clc/math/clc_asinpi.h>
-#undef __CLC_FUNCTION
-#define __CLC_FUNCTION asinpi
-#include <clc/math/unary_builtin.inc>
+#define FUNCTION asinpi
+#define __CLC_BODY <clc/shared/unary_def.inc>
+
+#include <clc/math/gentype.inc>
diff --git a/libclc/generic/lib/math/atan.cl b/libclc/generic/lib/math/atan.cl
index b7d1516..b0a466a 100644
--- a/libclc/generic/lib/math/atan.cl
+++ b/libclc/generic/lib/math/atan.cl
@@ -7,9 +7,9 @@
//===----------------------------------------------------------------------===//
#include <clc/clc.h>
-#include <clc/clcmacro.h>
#include <clc/math/clc_atan.h>
-#undef __CLC_FUNCTION
-#define __CLC_FUNCTION atan
-#include <clc/math/unary_builtin.inc>
+#define FUNCTION atan
+#define __CLC_BODY <clc/shared/unary_def.inc>
+
+#include <clc/math/gentype.inc>
diff --git a/libclc/generic/lib/math/atanh.cl b/libclc/generic/lib/math/atanh.cl
index d6f6cf7..5d92cdb 100644
--- a/libclc/generic/lib/math/atanh.cl
+++ b/libclc/generic/lib/math/atanh.cl
@@ -9,6 +9,7 @@
#include <clc/clc.h>
#include <clc/math/clc_atanh.h>
-#undef __CLC_FUNCTION
-#define __CLC_FUNCTION atanh
-#include <clc/math/unary_builtin.inc>
+#define FUNCTION atanh
+#define __CLC_BODY <clc/shared/unary_def.inc>
+
+#include <clc/math/gentype.inc>
diff --git a/libclc/generic/lib/math/atanpi.cl b/libclc/generic/lib/math/atanpi.cl
index 2c67eb9..4337bdf 100644
--- a/libclc/generic/lib/math/atanpi.cl
+++ b/libclc/generic/lib/math/atanpi.cl
@@ -9,6 +9,7 @@
#include <clc/clc.h>
#include <clc/math/clc_atanpi.h>
-#undef __CLC_FUNCTION
-#define __CLC_FUNCTION atanpi
-#include <clc/math/unary_builtin.inc>
+#define FUNCTION atanpi
+#define __CLC_BODY <clc/shared/unary_def.inc>
+
+#include <clc/math/gentype.inc>
diff --git a/libclc/generic/lib/math/ceil.cl b/libclc/generic/lib/math/ceil.cl
index e58172a..00635dc 100644
--- a/libclc/generic/lib/math/ceil.cl
+++ b/libclc/generic/lib/math/ceil.cl
@@ -7,9 +7,9 @@
//===----------------------------------------------------------------------===//
#include <clc/clc.h>
-#include <clc/clcmacro.h>
#include <clc/math/clc_ceil.h>
-#undef __CLC_FUNCTION
-#define __CLC_FUNCTION ceil
-#include <clc/math/unary_builtin.inc>
+#define FUNCTION ceil
+#define __CLC_BODY <clc/shared/unary_def.inc>
+
+#include <clc/math/gentype.inc>
diff --git a/libclc/generic/lib/math/fabs.cl b/libclc/generic/lib/math/fabs.cl
index 6fad7de..2723fae 100644
--- a/libclc/generic/lib/math/fabs.cl
+++ b/libclc/generic/lib/math/fabs.cl
@@ -7,9 +7,9 @@
//===----------------------------------------------------------------------===//
#include <clc/clc.h>
-#include <clc/clcmacro.h>
#include <clc/math/clc_fabs.h>
-#undef __CLC_FUNCTION
-#define __CLC_FUNCTION fabs
-#include <clc/math/unary_builtin.inc>
+#define FUNCTION fabs
+#define __CLC_BODY <clc/shared/unary_def.inc>
+
+#include <clc/math/gentype.inc>
diff --git a/libclc/generic/lib/math/floor.cl b/libclc/generic/lib/math/floor.cl
index 4448e54..d74a50d 100644
--- a/libclc/generic/lib/math/floor.cl
+++ b/libclc/generic/lib/math/floor.cl
@@ -7,9 +7,9 @@
//===----------------------------------------------------------------------===//
#include <clc/clc.h>
-#include <clc/clcmacro.h>
#include <clc/math/clc_floor.h>
-#undef __CLC_FUNCTION
-#define __CLC_FUNCTION floor
-#include <clc/math/unary_builtin.inc>
+#define FUNCTION floor
+#define __CLC_BODY <clc/shared/unary_def.inc>
+
+#include <clc/math/gentype.inc>
diff --git a/libclc/generic/lib/math/log1p.cl b/libclc/generic/lib/math/log1p.cl
index 8db8c3c..47245d1 100644
--- a/libclc/generic/lib/math/log1p.cl
+++ b/libclc/generic/lib/math/log1p.cl
@@ -9,6 +9,7 @@
#include <clc/clc.h>
#include <clc/math/clc_log1p.h>
-#undef __CLC_FUNCTION
-#define __CLC_FUNCTION log1p
-#include <clc/math/unary_builtin.inc>
+#define FUNCTION log1p
+#define __CLC_BODY <clc/shared/unary_def.inc>
+
+#include <clc/math/gentype.inc>
diff --git a/libclc/generic/lib/math/rint.cl b/libclc/generic/lib/math/rint.cl
index a33ff91..b844380 100644
--- a/libclc/generic/lib/math/rint.cl
+++ b/libclc/generic/lib/math/rint.cl
@@ -9,6 +9,7 @@
#include <clc/clc.h>
#include <clc/math/clc_rint.h>
-#undef __CLC_FUNCTION
-#define __CLC_FUNCTION rint
-#include <clc/math/unary_builtin.inc>
+#define FUNCTION rint
+#define __CLC_BODY <clc/shared/unary_def.inc>
+
+#include <clc/math/gentype.inc>
diff --git a/libclc/generic/lib/math/round.cl b/libclc/generic/lib/math/round.cl
index a1495fa..bf1ced1 100644
--- a/libclc/generic/lib/math/round.cl
+++ b/libclc/generic/lib/math/round.cl
@@ -7,9 +7,9 @@
//===----------------------------------------------------------------------===//
#include <clc/clc.h>
-#include <clc/clcmacro.h>
#include <clc/math/clc_round.h>
-#undef __CLC_FUNCTION
-#define __CLC_FUNCTION round
-#include <clc/math/unary_builtin.inc>
+#define FUNCTION round
+#define __CLC_BODY <clc/shared/unary_def.inc>
+
+#include <clc/math/gentype.inc>
diff --git a/libclc/generic/lib/math/trunc.cl b/libclc/generic/lib/math/trunc.cl
index 36ae4c7..d668f39f 100644
--- a/libclc/generic/lib/math/trunc.cl
+++ b/libclc/generic/lib/math/trunc.cl
@@ -9,6 +9,7 @@
#include <clc/clc.h>
#include <clc/math/clc_trunc.h>
-#undef __CLC_FUNCTION
-#define __CLC_FUNCTION trunc
-#include <clc/math/unary_builtin.inc>
+#define FUNCTION trunc
+#define __CLC_BODY <clc/shared/unary_def.inc>
+
+#include <clc/math/gentype.inc>