[Libclc-dev] [PATCH 3/7] atom: Consolidate cl_khr_{local, global}_int32_{base, extended}_atomics declarations

Jan Vesely via Libclc-dev libclc-dev at lists.llvm.org
Wed Jun 20 13:35:00 PDT 2018


Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
---
 generic/include/clc/atom_decl_int32.inc                        | 10 ++++++++++
 .../include/clc/cl_khr_global_int32_base_atomics/atom_add.h    |  5 +++--
 .../include/clc/cl_khr_global_int32_base_atomics/atom_sub.h    |  5 +++--
 .../include/clc/cl_khr_global_int32_base_atomics/atom_xchg.h   |  5 +++--
 .../clc/cl_khr_global_int32_extended_atomics/atom_and.h        |  5 +++--
 .../clc/cl_khr_global_int32_extended_atomics/atom_max.h        |  5 +++--
 .../clc/cl_khr_global_int32_extended_atomics/atom_min.h        |  5 +++--
 .../include/clc/cl_khr_global_int32_extended_atomics/atom_or.h |  5 +++--
 .../clc/cl_khr_global_int32_extended_atomics/atom_xor.h        |  5 +++--
 generic/include/clc/cl_khr_local_int32_base_atomics/atom_add.h |  5 +++--
 generic/include/clc/cl_khr_local_int32_base_atomics/atom_sub.h |  5 +++--
 .../include/clc/cl_khr_local_int32_base_atomics/atom_xchg.h    |  5 +++--
 .../include/clc/cl_khr_local_int32_extended_atomics/atom_and.h |  5 +++--
 .../include/clc/cl_khr_local_int32_extended_atomics/atom_max.h |  5 +++--
 .../include/clc/cl_khr_local_int32_extended_atomics/atom_min.h |  5 +++--
 .../include/clc/cl_khr_local_int32_extended_atomics/atom_or.h  |  5 +++--
 .../include/clc/cl_khr_local_int32_extended_atomics/atom_xor.h |  5 +++--
 17 files changed, 58 insertions(+), 32 deletions(-)
 create mode 100644 generic/include/clc/atom_decl_int32.inc

diff --git a/generic/include/clc/atom_decl_int32.inc b/generic/include/clc/atom_decl_int32.inc
new file mode 100644
index 0000000..dc76356
--- /dev/null
+++ b/generic/include/clc/atom_decl_int32.inc
@@ -0,0 +1,10 @@
+#define __CLC_DECLARE_ATOM(ADDRSPACE, TYPE) \
+	_CLC_OVERLOAD _CLC_DECL TYPE __CLC_FUNCTION (ADDRSPACE TYPE *, TYPE);
+
+__CLC_DECLARE_ATOM(__CLC_ADDRESS_SPACE, int)
+__CLC_DECLARE_ATOM(__CLC_ADDRESS_SPACE, uint)
+
+#undef __CLC_DECLARE_ATOM
+
+#undef __CLC_FUNCTION
+#undef __CLC_ADDRESS_SPACE
diff --git a/generic/include/clc/cl_khr_global_int32_base_atomics/atom_add.h b/generic/include/clc/cl_khr_global_int32_base_atomics/atom_add.h
index 9740b3d..244e2b2 100644
--- a/generic/include/clc/cl_khr_global_int32_base_atomics/atom_add.h
+++ b/generic/include/clc/cl_khr_global_int32_base_atomics/atom_add.h
@@ -1,2 +1,3 @@
-_CLC_OVERLOAD _CLC_DECL int atom_add(global int *p, int val);
-_CLC_OVERLOAD _CLC_DECL unsigned int atom_add(global unsigned int *p, unsigned int val);
+#define __CLC_FUNCTION atom_add
+#define __CLC_ADDRESS_SPACE global
+#include <clc/atom_decl_int32.inc>
diff --git a/generic/include/clc/cl_khr_global_int32_base_atomics/atom_sub.h b/generic/include/clc/cl_khr_global_int32_base_atomics/atom_sub.h
index c435c72..311ffb4 100644
--- a/generic/include/clc/cl_khr_global_int32_base_atomics/atom_sub.h
+++ b/generic/include/clc/cl_khr_global_int32_base_atomics/atom_sub.h
@@ -1,2 +1,3 @@
-_CLC_OVERLOAD _CLC_DECL int atom_sub(global int *p, int val);
-_CLC_OVERLOAD _CLC_DECL unsigned int atom_sub(global unsigned int *p, unsigned int val);
+#define __CLC_FUNCTION atom_sub
+#define __CLC_ADDRESS_SPACE global
+#include <clc/atom_decl_int32.inc>
diff --git a/generic/include/clc/cl_khr_global_int32_base_atomics/atom_xchg.h b/generic/include/clc/cl_khr_global_int32_base_atomics/atom_xchg.h
index 6a18e9e..c09eb49 100644
--- a/generic/include/clc/cl_khr_global_int32_base_atomics/atom_xchg.h
+++ b/generic/include/clc/cl_khr_global_int32_base_atomics/atom_xchg.h
@@ -1,2 +1,3 @@
-_CLC_OVERLOAD _CLC_DECL int atom_xchg(global int *p, int val);
-_CLC_OVERLOAD _CLC_DECL unsigned int atom_xchg(global unsigned int *p, unsigned int val);
+#define __CLC_FUNCTION atom_xchg
+#define __CLC_ADDRESS_SPACE global
+#include <clc/atom_decl_int32.inc>
diff --git a/generic/include/clc/cl_khr_global_int32_extended_atomics/atom_and.h b/generic/include/clc/cl_khr_global_int32_extended_atomics/atom_and.h
index 19df7d6..4a9dd46 100644
--- a/generic/include/clc/cl_khr_global_int32_extended_atomics/atom_and.h
+++ b/generic/include/clc/cl_khr_global_int32_extended_atomics/atom_and.h
@@ -1,2 +1,3 @@
-_CLC_OVERLOAD _CLC_DECL int atom_and(global int *p, int val);
-_CLC_OVERLOAD _CLC_DECL unsigned int atom_and(global unsigned int *p, unsigned int val);
+#define __CLC_FUNCTION atom_and
+#define __CLC_ADDRESS_SPACE global
+#include <clc/atom_decl_int32.inc>
diff --git a/generic/include/clc/cl_khr_global_int32_extended_atomics/atom_max.h b/generic/include/clc/cl_khr_global_int32_extended_atomics/atom_max.h
index b46ce29..e57b4d7 100644
--- a/generic/include/clc/cl_khr_global_int32_extended_atomics/atom_max.h
+++ b/generic/include/clc/cl_khr_global_int32_extended_atomics/atom_max.h
@@ -1,2 +1,3 @@
-_CLC_OVERLOAD _CLC_DECL int atom_max(global int *p, int val);
-_CLC_OVERLOAD _CLC_DECL unsigned int atom_max(global unsigned int *p, unsigned int val);
+#define __CLC_FUNCTION atom_max
+#define __CLC_ADDRESS_SPACE global
+#include <clc/atom_decl_int32.inc>
diff --git a/generic/include/clc/cl_khr_global_int32_extended_atomics/atom_min.h b/generic/include/clc/cl_khr_global_int32_extended_atomics/atom_min.h
index 0e458eb..bd62f5d 100644
--- a/generic/include/clc/cl_khr_global_int32_extended_atomics/atom_min.h
+++ b/generic/include/clc/cl_khr_global_int32_extended_atomics/atom_min.h
@@ -1,2 +1,3 @@
-_CLC_OVERLOAD _CLC_DECL int atom_min(global int *p, int val);
-_CLC_OVERLOAD _CLC_DECL unsigned int atom_min(global unsigned int *p, unsigned int val);
+#define __CLC_FUNCTION atom_min
+#define __CLC_ADDRESS_SPACE global
+#include <clc/atom_decl_int32.inc>
diff --git a/generic/include/clc/cl_khr_global_int32_extended_atomics/atom_or.h b/generic/include/clc/cl_khr_global_int32_extended_atomics/atom_or.h
index 91cde56..1a04055 100644
--- a/generic/include/clc/cl_khr_global_int32_extended_atomics/atom_or.h
+++ b/generic/include/clc/cl_khr_global_int32_extended_atomics/atom_or.h
@@ -1,2 +1,3 @@
-_CLC_OVERLOAD _CLC_DECL int atom_or(global int *p, int val);
-_CLC_OVERLOAD _CLC_DECL unsigned int atom_or(global unsigned int *p, unsigned int val);
+#define __CLC_FUNCTION atom_or
+#define __CLC_ADDRESS_SPACE global
+#include <clc/atom_decl_int32.inc>
diff --git a/generic/include/clc/cl_khr_global_int32_extended_atomics/atom_xor.h b/generic/include/clc/cl_khr_global_int32_extended_atomics/atom_xor.h
index f787849..217c04b 100644
--- a/generic/include/clc/cl_khr_global_int32_extended_atomics/atom_xor.h
+++ b/generic/include/clc/cl_khr_global_int32_extended_atomics/atom_xor.h
@@ -1,2 +1,3 @@
-_CLC_OVERLOAD _CLC_DECL int atom_xor(global int *p, int val);
-_CLC_OVERLOAD _CLC_DECL unsigned int atom_xor(global unsigned int *p, unsigned int val);
+#define __CLC_FUNCTION atom_xor
+#define __CLC_ADDRESS_SPACE global
+#include <clc/atom_decl_int32.inc>
diff --git a/generic/include/clc/cl_khr_local_int32_base_atomics/atom_add.h b/generic/include/clc/cl_khr_local_int32_base_atomics/atom_add.h
index 096d011..e60ffe8 100644
--- a/generic/include/clc/cl_khr_local_int32_base_atomics/atom_add.h
+++ b/generic/include/clc/cl_khr_local_int32_base_atomics/atom_add.h
@@ -1,2 +1,3 @@
-_CLC_OVERLOAD _CLC_DECL int atom_add(local int *p, int val);
-_CLC_OVERLOAD _CLC_DECL unsigned int atom_add(local unsigned int *p, unsigned int val);
+#define __CLC_FUNCTION atom_add
+#define __CLC_ADDRESS_SPACE local
+#include <clc/atom_decl_int32.inc>
diff --git a/generic/include/clc/cl_khr_local_int32_base_atomics/atom_sub.h b/generic/include/clc/cl_khr_local_int32_base_atomics/atom_sub.h
index 6363780..9735071 100644
--- a/generic/include/clc/cl_khr_local_int32_base_atomics/atom_sub.h
+++ b/generic/include/clc/cl_khr_local_int32_base_atomics/atom_sub.h
@@ -1,2 +1,3 @@
-_CLC_OVERLOAD _CLC_DECL int atom_sub(local int *p, int val);
-_CLC_OVERLOAD _CLC_DECL unsigned int atom_sub(local unsigned int *p, unsigned int val);
+#define __CLC_FUNCTION atom_sub
+#define __CLC_ADDRESS_SPACE local
+#include <clc/atom_decl_int32.inc>
diff --git a/generic/include/clc/cl_khr_local_int32_base_atomics/atom_xchg.h b/generic/include/clc/cl_khr_local_int32_base_atomics/atom_xchg.h
index c5a1f09..16aeafa 100644
--- a/generic/include/clc/cl_khr_local_int32_base_atomics/atom_xchg.h
+++ b/generic/include/clc/cl_khr_local_int32_base_atomics/atom_xchg.h
@@ -1,2 +1,3 @@
-_CLC_OVERLOAD _CLC_DECL int atom_xchg(local int *p, int val);
-_CLC_OVERLOAD _CLC_DECL unsigned int atom_xchg(local unsigned int *p, unsigned int val);
+#define __CLC_FUNCTION atom_xchg
+#define __CLC_ADDRESS_SPACE local
+#include <clc/atom_decl_int32.inc>
diff --git a/generic/include/clc/cl_khr_local_int32_extended_atomics/atom_and.h b/generic/include/clc/cl_khr_local_int32_extended_atomics/atom_and.h
index 96d7b1a..710e202 100644
--- a/generic/include/clc/cl_khr_local_int32_extended_atomics/atom_and.h
+++ b/generic/include/clc/cl_khr_local_int32_extended_atomics/atom_and.h
@@ -1,2 +1,3 @@
-_CLC_OVERLOAD _CLC_DECL int atom_and(local int *p, int val);
-_CLC_OVERLOAD _CLC_DECL unsigned int atom_and(local unsigned int *p, unsigned int val);
+#define __CLC_FUNCTION atom_and
+#define __CLC_ADDRESS_SPACE local
+#include <clc/atom_decl_int32.inc>
diff --git a/generic/include/clc/cl_khr_local_int32_extended_atomics/atom_max.h b/generic/include/clc/cl_khr_local_int32_extended_atomics/atom_max.h
index 7d6b17d..f675e28 100644
--- a/generic/include/clc/cl_khr_local_int32_extended_atomics/atom_max.h
+++ b/generic/include/clc/cl_khr_local_int32_extended_atomics/atom_max.h
@@ -1,2 +1,3 @@
-_CLC_OVERLOAD _CLC_DECL int atom_max(local int *p, int val);
-_CLC_OVERLOAD _CLC_DECL unsigned int atom_max(local unsigned int *p, unsigned int val);
+#define __CLC_FUNCTION atom_max
+#define __CLC_ADDRESS_SPACE local
+#include <clc/atom_decl_int32.inc>
diff --git a/generic/include/clc/cl_khr_local_int32_extended_atomics/atom_min.h b/generic/include/clc/cl_khr_local_int32_extended_atomics/atom_min.h
index ddb6cf3..d2476c1 100644
--- a/generic/include/clc/cl_khr_local_int32_extended_atomics/atom_min.h
+++ b/generic/include/clc/cl_khr_local_int32_extended_atomics/atom_min.h
@@ -1,2 +1,3 @@
-_CLC_OVERLOAD _CLC_DECL int atom_min(local int *p, int val);
-_CLC_OVERLOAD _CLC_DECL unsigned int atom_min(local unsigned int *p, unsigned int val);
+#define __CLC_FUNCTION atom_min
+#define __CLC_ADDRESS_SPACE local
+#include <clc/atom_decl_int32.inc>
diff --git a/generic/include/clc/cl_khr_local_int32_extended_atomics/atom_or.h b/generic/include/clc/cl_khr_local_int32_extended_atomics/atom_or.h
index 518c256..1532f61 100644
--- a/generic/include/clc/cl_khr_local_int32_extended_atomics/atom_or.h
+++ b/generic/include/clc/cl_khr_local_int32_extended_atomics/atom_or.h
@@ -1,2 +1,3 @@
-_CLC_OVERLOAD _CLC_DECL int atom_or(local int *p, int val);
-_CLC_OVERLOAD _CLC_DECL unsigned int atom_or(local unsigned int *p, unsigned int val);
+#define __CLC_FUNCTION atom_or
+#define __CLC_ADDRESS_SPACE local
+#include <clc/atom_decl_int32.inc>
diff --git a/generic/include/clc/cl_khr_local_int32_extended_atomics/atom_xor.h b/generic/include/clc/cl_khr_local_int32_extended_atomics/atom_xor.h
index e6c9f2f..808a147 100644
--- a/generic/include/clc/cl_khr_local_int32_extended_atomics/atom_xor.h
+++ b/generic/include/clc/cl_khr_local_int32_extended_atomics/atom_xor.h
@@ -1,2 +1,3 @@
-_CLC_OVERLOAD _CLC_DECL int atom_xor(local int *p, int val);
-_CLC_OVERLOAD _CLC_DECL unsigned int atom_xor(local unsigned int *p, unsigned int val);
+#define __CLC_FUNCTION atom_xor
+#define __CLC_ADDRESS_SPACE local
+#include <clc/atom_decl_int32.inc>
-- 
2.16.4



More information about the Libclc-dev mailing list