summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Watry <awatry@gmail.com>2014-09-16 22:34:32 +0000
committerAaron Watry <awatry@gmail.com>2014-09-16 22:34:32 +0000
commit31e67d1cff5d7ca80b8c81c28f92db8be6173037 (patch)
treec5fbb914d20fad0b5d213f9d9b7326c197002e53
parentcc68405761aad969df146825e5fa08174f060ea1 (diff)
downloadbcm5719-llvm-31e67d1cff5d7ca80b8c81c28f92db8be6173037.tar.gz
bcm5719-llvm-31e67d1cff5d7ca80b8c81c28f92db8be6173037.zip
atomic: Add atom[ic]_or
Signed-off-by: Aaron Watry <awatry@gmail.com> Reviewed-by: Tom Stellard <thomas.stellard@amd.com> llvm-svn: 217914
-rw-r--r--libclc/generic/include/clc/atomic/atomic_or.h3
-rw-r--r--libclc/generic/include/clc/cl_khr_global_int32_extended_atomics/atom_or.h2
-rw-r--r--libclc/generic/include/clc/cl_khr_local_int32_extended_atomics/atom_or.h2
-rw-r--r--libclc/generic/include/clc/clc.h3
-rw-r--r--libclc/generic/lib/SOURCES2
-rw-r--r--libclc/generic/lib/atomic/atomic_impl.ll11
-rw-r--r--libclc/generic/lib/cl_khr_global_int32_extended_atomics/atom_or.cl9
-rw-r--r--libclc/generic/lib/cl_khr_local_int32_extended_atomics/atom_or.cl9
8 files changed, 41 insertions, 0 deletions
diff --git a/libclc/generic/include/clc/atomic/atomic_or.h b/libclc/generic/include/clc/atomic/atomic_or.h
new file mode 100644
index 00000000000..b3df97ac581
--- /dev/null
+++ b/libclc/generic/include/clc/atomic/atomic_or.h
@@ -0,0 +1,3 @@
+#define __CLC_FUNCTION atomic_or
+#include <clc/atomic/atomic_decl.inc>
+#undef __CLC_FUNCTION
diff --git a/libclc/generic/include/clc/cl_khr_global_int32_extended_atomics/atom_or.h b/libclc/generic/include/clc/cl_khr_global_int32_extended_atomics/atom_or.h
new file mode 100644
index 00000000000..91cde56a4d7
--- /dev/null
+++ b/libclc/generic/include/clc/cl_khr_global_int32_extended_atomics/atom_or.h
@@ -0,0 +1,2 @@
+_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);
diff --git a/libclc/generic/include/clc/cl_khr_local_int32_extended_atomics/atom_or.h b/libclc/generic/include/clc/cl_khr_local_int32_extended_atomics/atom_or.h
new file mode 100644
index 00000000000..518c256dfbb
--- /dev/null
+++ b/libclc/generic/include/clc/cl_khr_local_int32_extended_atomics/atom_or.h
@@ -0,0 +1,2 @@
+_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);
diff --git a/libclc/generic/include/clc/clc.h b/libclc/generic/include/clc/clc.h
index 0886d6ce983..4e3346263d9 100644
--- a/libclc/generic/include/clc/clc.h
+++ b/libclc/generic/include/clc/clc.h
@@ -145,6 +145,7 @@
#include <clc/atomic/atomic_dec.h>
#include <clc/atomic/atomic_inc.h>
#include <clc/atomic/atomic_max.h>
+#include <clc/atomic/atomic_or.h>
#include <clc/atomic/atomic_sub.h>
/* cl_khr_global_int32_base_atomics Extension Functions */
@@ -156,6 +157,7 @@
/* 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>
+#include <clc/cl_khr_global_int32_extended_atomics/atom_or.h>
/* cl_khr_local_int32_base_atomics Extension Functions */
#include <clc/cl_khr_local_int32_base_atomics/atom_add.h>
@@ -166,6 +168,7 @@
/* 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>
+#include <clc/cl_khr_local_int32_extended_atomics/atom_or.h>
/* libclc internal defintions */
#ifdef __CLC_INTERNAL
diff --git a/libclc/generic/lib/SOURCES b/libclc/generic/lib/SOURCES
index 7b42642e589..b083a7dec46 100644
--- a/libclc/generic/lib/SOURCES
+++ b/libclc/generic/lib/SOURCES
@@ -6,12 +6,14 @@ 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_global_int32_extended_atomics/atom_or.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
+cl_khr_local_int32_extended_atomics/atom_or.cl
convert.cl
common/sign.cl
geometric/cross.cl
diff --git a/libclc/generic/lib/atomic/atomic_impl.ll b/libclc/generic/lib/atomic/atomic_impl.ll
index bd42c2ca07e..1e932ccd6de 100644
--- a/libclc/generic/lib/atomic/atomic_impl.ll
+++ b/libclc/generic/lib/atomic/atomic_impl.ll
@@ -34,6 +34,17 @@ entry:
ret i32 %0
}
+define i32 @__clc_atomic_or_addr1(i32 addrspace(1)* nocapture %ptr, i32 %value) nounwind alwaysinline {
+entry:
+ %0 = atomicrmw volatile or i32 addrspace(1)* %ptr, i32 %value seq_cst
+ ret i32 %0
+}
+
+define i32 @__clc_atomic_or_addr3(i32 addrspace(3)* nocapture %ptr, i32 %value) nounwind alwaysinline {
+entry:
+ %0 = atomicrmw volatile or i32 addrspace(3)* %ptr, i32 %value seq_cst
+ ret i32 %0
+}
define i32 @__clc_atomic_umax_addr1(i32 addrspace(1)* nocapture %ptr, i32 %value) nounwind alwaysinline {
entry:
%0 = atomicrmw volatile umax i32 addrspace(1)* %ptr, i32 %value seq_cst
diff --git a/libclc/generic/lib/cl_khr_global_int32_extended_atomics/atom_or.cl b/libclc/generic/lib/cl_khr_global_int32_extended_atomics/atom_or.cl
new file mode 100644
index 00000000000..a936a8ea7d3
--- /dev/null
+++ b/libclc/generic/lib/cl_khr_global_int32_extended_atomics/atom_or.cl
@@ -0,0 +1,9 @@
+#include <clc/clc.h>
+
+#define IMPL(TYPE) \
+_CLC_OVERLOAD _CLC_DEF TYPE atom_or(global TYPE *p, TYPE val) { \
+ return atomic_or(p, val); \
+}
+
+IMPL(int)
+IMPL(unsigned int)
diff --git a/libclc/generic/lib/cl_khr_local_int32_extended_atomics/atom_or.cl b/libclc/generic/lib/cl_khr_local_int32_extended_atomics/atom_or.cl
new file mode 100644
index 00000000000..338ff2c0108
--- /dev/null
+++ b/libclc/generic/lib/cl_khr_local_int32_extended_atomics/atom_or.cl
@@ -0,0 +1,9 @@
+#include <clc/clc.h>
+
+#define IMPL(TYPE) \
+_CLC_OVERLOAD _CLC_DEF TYPE atom_or(local TYPE *p, TYPE val) { \
+ return atomic_or(p, val); \
+}
+
+IMPL(int)
+IMPL(unsigned int)
OpenPOWER on IntegriCloud