[Libclc-dev] [PATCH 4/7] atom: Consolidate cl_khr_int64_{base, extended}_atomics declarations
Jan Vesely via Libclc-dev
libclc-dev at lists.llvm.org
Wed Jun 20 13:35:01 PDT 2018
Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
---
generic/include/clc/atom_decl_int64.inc | 11 +++++++++++
generic/include/clc/cl_khr_int64_base_atomics/atom_add.h | 6 ++----
generic/include/clc/cl_khr_int64_base_atomics/atom_sub.h | 6 ++----
generic/include/clc/cl_khr_int64_base_atomics/atom_xchg.h | 6 ++----
generic/include/clc/cl_khr_int64_extended_atomics/atom_and.h | 6 ++----
generic/include/clc/cl_khr_int64_extended_atomics/atom_max.h | 6 ++----
generic/include/clc/cl_khr_int64_extended_atomics/atom_min.h | 6 ++----
generic/include/clc/cl_khr_int64_extended_atomics/atom_or.h | 6 ++----
generic/include/clc/cl_khr_int64_extended_atomics/atom_xor.h | 6 ++----
9 files changed, 27 insertions(+), 32 deletions(-)
create mode 100644 generic/include/clc/atom_decl_int64.inc
diff --git a/generic/include/clc/atom_decl_int64.inc b/generic/include/clc/atom_decl_int64.inc
new file mode 100644
index 0000000..1e0cc32
--- /dev/null
+++ b/generic/include/clc/atom_decl_int64.inc
@@ -0,0 +1,11 @@
+#define __CLC_DECLARE_ATOM(ADDRSPACE, TYPE) \
+ _CLC_OVERLOAD _CLC_DECL TYPE __CLC_FUNCTION (volatile ADDRSPACE TYPE *, TYPE);
+
+__CLC_DECLARE_ATOM(local, long)
+__CLC_DECLARE_ATOM(local, ulong)
+__CLC_DECLARE_ATOM(global, long)
+__CLC_DECLARE_ATOM(global, ulong)
+
+#undef __CLC_DECLARE_ATOM
+
+#undef __CLC_FUNCTION
diff --git a/generic/include/clc/cl_khr_int64_base_atomics/atom_add.h b/generic/include/clc/cl_khr_int64_base_atomics/atom_add.h
index 5addc13..6f6adad 100644
--- a/generic/include/clc/cl_khr_int64_base_atomics/atom_add.h
+++ b/generic/include/clc/cl_khr_int64_base_atomics/atom_add.h
@@ -1,4 +1,2 @@
-_CLC_OVERLOAD _CLC_DECL long atom_add(volatile global long *p, long val);
-_CLC_OVERLOAD _CLC_DECL unsigned long atom_add(volatile global unsigned long *p, unsigned long val);
-_CLC_OVERLOAD _CLC_DECL long atom_add(volatile local long *p, long val);
-_CLC_OVERLOAD _CLC_DECL unsigned long atom_add(volatile local unsigned long *p, unsigned long val);
+#define __CLC_FUNCTION atom_add
+#include <clc/atom_decl_int64.inc>
diff --git a/generic/include/clc/cl_khr_int64_base_atomics/atom_sub.h b/generic/include/clc/cl_khr_int64_base_atomics/atom_sub.h
index 2186ec9..e0431dd 100644
--- a/generic/include/clc/cl_khr_int64_base_atomics/atom_sub.h
+++ b/generic/include/clc/cl_khr_int64_base_atomics/atom_sub.h
@@ -1,4 +1,2 @@
-_CLC_OVERLOAD _CLC_DECL long atom_sub(volatile global long *p, long val);
-_CLC_OVERLOAD _CLC_DECL unsigned long atom_sub(volatile global unsigned long *p, unsigned long val);
-_CLC_OVERLOAD _CLC_DECL long atom_sub(volatile local long *p, long val);
-_CLC_OVERLOAD _CLC_DECL unsigned long atom_sub(volatile local unsigned long *p, unsigned long val);
+#define __CLC_FUNCTION atom_sub
+#include <clc/atom_decl_int64.inc>
diff --git a/generic/include/clc/cl_khr_int64_base_atomics/atom_xchg.h b/generic/include/clc/cl_khr_int64_base_atomics/atom_xchg.h
index 3627af1..cac9688 100644
--- a/generic/include/clc/cl_khr_int64_base_atomics/atom_xchg.h
+++ b/generic/include/clc/cl_khr_int64_base_atomics/atom_xchg.h
@@ -1,4 +1,2 @@
-_CLC_OVERLOAD _CLC_DECL long atom_xchg(volatile global long *p, long val);
-_CLC_OVERLOAD _CLC_DECL unsigned long atom_xchg(volatile global unsigned long *p, unsigned long val);
-_CLC_OVERLOAD _CLC_DECL long atom_xchg(volatile local long *p, long val);
-_CLC_OVERLOAD _CLC_DECL unsigned long atom_xchg(volatile local unsigned long *p, unsigned long val);
+#define __CLC_FUNCTION atom_xchg
+#include <clc/atom_decl_int64.inc>
diff --git a/generic/include/clc/cl_khr_int64_extended_atomics/atom_and.h b/generic/include/clc/cl_khr_int64_extended_atomics/atom_and.h
index 388df1d..b8e6104 100644
--- a/generic/include/clc/cl_khr_int64_extended_atomics/atom_and.h
+++ b/generic/include/clc/cl_khr_int64_extended_atomics/atom_and.h
@@ -1,4 +1,2 @@
-_CLC_OVERLOAD _CLC_DECL long atom_and(volatile global long *p, long val);
-_CLC_OVERLOAD _CLC_DECL unsigned long atom_and(volatile global unsigned long *p, unsigned long val);
-_CLC_OVERLOAD _CLC_DECL long atom_and(volatile local long *p, long val);
-_CLC_OVERLOAD _CLC_DECL unsigned long atom_and(volatile local unsigned long *p, unsigned long val);
+#define __CLC_FUNCTION atom_and
+#include <clc/atom_decl_int64.inc>
diff --git a/generic/include/clc/cl_khr_int64_extended_atomics/atom_max.h b/generic/include/clc/cl_khr_int64_extended_atomics/atom_max.h
index b84b5a0..b9cff19 100644
--- a/generic/include/clc/cl_khr_int64_extended_atomics/atom_max.h
+++ b/generic/include/clc/cl_khr_int64_extended_atomics/atom_max.h
@@ -1,4 +1,2 @@
-_CLC_OVERLOAD _CLC_DECL long atom_max(volatile global long *p, long val);
-_CLC_OVERLOAD _CLC_DECL unsigned long atom_max(volatile global unsigned long *p, unsigned long val);
-_CLC_OVERLOAD _CLC_DECL long atom_max(volatile local long *p, long val);
-_CLC_OVERLOAD _CLC_DECL unsigned long atom_max(volatile local unsigned long *p, unsigned long val);
+#define __CLC_FUNCTION atom_max
+#include <clc/atom_decl_int64.inc>
diff --git a/generic/include/clc/cl_khr_int64_extended_atomics/atom_min.h b/generic/include/clc/cl_khr_int64_extended_atomics/atom_min.h
index bd70b0b..0a19d21 100644
--- a/generic/include/clc/cl_khr_int64_extended_atomics/atom_min.h
+++ b/generic/include/clc/cl_khr_int64_extended_atomics/atom_min.h
@@ -1,4 +1,2 @@
-_CLC_OVERLOAD _CLC_DECL long atom_min(volatile global long *p, long val);
-_CLC_OVERLOAD _CLC_DECL unsigned long atom_min(volatile global unsigned long *p, unsigned long val);
-_CLC_OVERLOAD _CLC_DECL long atom_min(volatile local long *p, long val);
-_CLC_OVERLOAD _CLC_DECL unsigned long atom_min(volatile local unsigned long *p, unsigned long val);
+#define __CLC_FUNCTION atom_min
+#include <clc/atom_decl_int64.inc>
diff --git a/generic/include/clc/cl_khr_int64_extended_atomics/atom_or.h b/generic/include/clc/cl_khr_int64_extended_atomics/atom_or.h
index e307822..f4baa36 100644
--- a/generic/include/clc/cl_khr_int64_extended_atomics/atom_or.h
+++ b/generic/include/clc/cl_khr_int64_extended_atomics/atom_or.h
@@ -1,4 +1,2 @@
-_CLC_OVERLOAD _CLC_DECL long atom_or(volatile global long *p, long val);
-_CLC_OVERLOAD _CLC_DECL unsigned long atom_or(volatile global unsigned long *p, unsigned long val);
-_CLC_OVERLOAD _CLC_DECL long atom_or(volatile local long *p, long val);
-_CLC_OVERLOAD _CLC_DECL unsigned long atom_or(volatile local unsigned long *p, unsigned long val);
+#define __CLC_FUNCTION atom_or
+#include <clc/atom_decl_int64.inc>
diff --git a/generic/include/clc/cl_khr_int64_extended_atomics/atom_xor.h b/generic/include/clc/cl_khr_int64_extended_atomics/atom_xor.h
index 54eb492..d64a342 100644
--- a/generic/include/clc/cl_khr_int64_extended_atomics/atom_xor.h
+++ b/generic/include/clc/cl_khr_int64_extended_atomics/atom_xor.h
@@ -1,4 +1,2 @@
-_CLC_OVERLOAD _CLC_DECL long atom_xor(volatile global long *p, long val);
-_CLC_OVERLOAD _CLC_DECL unsigned long atom_xor(volatile global unsigned long *p, unsigned long val);
-_CLC_OVERLOAD _CLC_DECL long atom_xor(volatile local long *p, long val);
-_CLC_OVERLOAD _CLC_DECL unsigned long atom_xor(volatile local unsigned long *p, unsigned long val);
+#define __CLC_FUNCTION atom_xor
+#include <clc/atom_decl_int64.inc>
--
2.16.4
More information about the Libclc-dev
mailing list