[Libclc-dev] [PATCH 03/15] atomics: Add generic atom[ic]_and
Aaron Watry
awatry at gmail.com
Tue Sep 9 16:24:36 PDT 2014
Not used yet.
Signed-off-by: Aaron Watry <awatry at gmail.com>
---
generic/include/clc/atomic/atomic_and.h | 3 +++
.../clc/cl_khr_global_int32_extended_atomics/atom_and.h | 2 ++
.../clc/cl_khr_local_int32_extended_atomics/atom_and.h | 2 ++
generic/include/clc/clc.h | 3 +++
generic/lib/SOURCES | 2 ++
generic/lib/atomic/atomic_impl.ll | 12 ++++++++++++
generic/lib/cl_khr_global_int32_extended_atomics/atom_and.cl | 9 +++++++++
generic/lib/cl_khr_local_int32_extended_atomics/atom_and.cl | 9 +++++++++
8 files changed, 42 insertions(+)
create mode 100644 generic/include/clc/atomic/atomic_and.h
create mode 100644 generic/include/clc/cl_khr_global_int32_extended_atomics/atom_and.h
create mode 100644 generic/include/clc/cl_khr_local_int32_extended_atomics/atom_and.h
create mode 100644 generic/lib/cl_khr_global_int32_extended_atomics/atom_and.cl
create mode 100644 generic/lib/cl_khr_local_int32_extended_atomics/atom_and.cl
diff --git a/generic/include/clc/atomic/atomic_and.h b/generic/include/clc/atomic/atomic_and.h
new file mode 100644
index 0000000..87898af
--- /dev/null
+++ b/generic/include/clc/atomic/atomic_and.h
@@ -0,0 +1,3 @@
+#define __CLC_FUNCTION atomic_and
+#include <clc/atomic/atomic_decl.inc>
+#undef __CLC_FUNCTION
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
new file mode 100644
index 0000000..19df7d6
--- /dev/null
+++ b/generic/include/clc/cl_khr_global_int32_extended_atomics/atom_and.h
@@ -0,0 +1,2 @@
+_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);
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
new file mode 100644
index 0000000..96d7b1a
--- /dev/null
+++ b/generic/include/clc/cl_khr_local_int32_extended_atomics/atom_and.h
@@ -0,0 +1,2 @@
+_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);
diff --git a/generic/include/clc/clc.h b/generic/include/clc/clc.h
index 20759d2..8689c4b 100644
--- a/generic/include/clc/clc.h
+++ b/generic/include/clc/clc.h
@@ -142,6 +142,7 @@
/* 6.11.11 Atomic Functions */
#include <clc/atomic/atomic_add.h>
+#include <clc/atomic/atomic_and.h>
#include <clc/atomic/atomic_dec.h>
#include <clc/atomic/atomic_inc.h>
#include <clc/atomic/atomic_max.h>
@@ -154,6 +155,7 @@
#include <clc/cl_khr_global_int32_base_atomics/atom_sub.h>
/* cl_khr_global_int32_extended_atomics Extension Functions */
+#include <clc/cl_khr_global_int32_extended_atomics/atom_and.h>
#include <clc/cl_khr_global_int32_extended_atomics/atom_max.h>
/* cl_khr_local_int32_base_atomics Extension Functions */
@@ -163,6 +165,7 @@
#include <clc/cl_khr_local_int32_base_atomics/atom_sub.h>
/* cl_khr_local_int32_extended_atomics Extension Functions */
+#include <clc/cl_khr_local_int32_extended_atomics/atom_and.h>
#include <clc/cl_khr_local_int32_extended_atomics/atom_max.h>
/* libclc internal defintions */
diff --git a/generic/lib/SOURCES b/generic/lib/SOURCES
index 76d0d77..96ca7f9 100644
--- a/generic/lib/SOURCES
+++ b/generic/lib/SOURCES
@@ -4,11 +4,13 @@ cl_khr_global_int32_base_atomics/atom_add.cl
cl_khr_global_int32_base_atomics/atom_dec.cl
cl_khr_global_int32_base_atomics/atom_inc.cl
cl_khr_global_int32_base_atomics/atom_sub.cl
+cl_khr_global_int32_extended_atomics/atom_and.cl
cl_khr_global_int32_extended_atomics/atom_max.cl
cl_khr_local_int32_base_atomics/atom_add.cl
cl_khr_local_int32_base_atomics/atom_dec.cl
cl_khr_local_int32_base_atomics/atom_inc.cl
cl_khr_local_int32_base_atomics/atom_sub.cl
+cl_khr_local_int32_extended_atomics/atom_and.cl
cl_khr_local_int32_extended_atomics/atom_max.cl
convert.cl
common/sign.cl
diff --git a/generic/lib/atomic/atomic_impl.ll b/generic/lib/atomic/atomic_impl.ll
index 29ef2d1..bd42c2c 100644
--- a/generic/lib/atomic/atomic_impl.ll
+++ b/generic/lib/atomic/atomic_impl.ll
@@ -10,6 +10,18 @@ entry:
ret i32 %0
}
+define i32 @__clc_atomic_and_addr1(i32 addrspace(1)* nocapture %ptr, i32 %value) nounwind alwaysinline {
+entry:
+ %0 = atomicrmw volatile and i32 addrspace(1)* %ptr, i32 %value seq_cst
+ ret i32 %0
+}
+
+define i32 @__clc_atomic_and_addr3(i32 addrspace(3)* nocapture %ptr, i32 %value) nounwind alwaysinline {
+entry:
+ %0 = atomicrmw volatile and i32 addrspace(3)* %ptr, i32 %value seq_cst
+ ret i32 %0
+}
+
define i32 @__clc_atomic_max_addr1(i32 addrspace(1)* nocapture %ptr, i32 %value) nounwind alwaysinline {
entry:
%0 = atomicrmw volatile max i32 addrspace(1)* %ptr, i32 %value seq_cst
diff --git a/generic/lib/cl_khr_global_int32_extended_atomics/atom_and.cl b/generic/lib/cl_khr_global_int32_extended_atomics/atom_and.cl
new file mode 100644
index 0000000..e587969
--- /dev/null
+++ b/generic/lib/cl_khr_global_int32_extended_atomics/atom_and.cl
@@ -0,0 +1,9 @@
+#include <clc/clc.h>
+
+#define IMPL(TYPE) \
+_CLC_OVERLOAD _CLC_DEF TYPE atom_and(global TYPE *p, TYPE val) { \
+ return atomic_and(p, val); \
+}
+
+IMPL(int)
+IMPL(unsigned int)
\ No newline at end of file
diff --git a/generic/lib/cl_khr_local_int32_extended_atomics/atom_and.cl b/generic/lib/cl_khr_local_int32_extended_atomics/atom_and.cl
new file mode 100644
index 0000000..180103a
--- /dev/null
+++ b/generic/lib/cl_khr_local_int32_extended_atomics/atom_and.cl
@@ -0,0 +1,9 @@
+#include <clc/clc.h>
+
+#define IMPL(TYPE) \
+_CLC_OVERLOAD _CLC_DEF TYPE atom_and(local TYPE *p, TYPE val) { \
+ return atomic_and(p, val); \
+}
+
+IMPL(int)
+IMPL(unsigned int)
\ No newline at end of file
--
1.9.1
More information about the Libclc-dev
mailing list