[libclc] r217915 - atomic: Add generic atom[ic]_xor
Aaron Watry
awatry at gmail.com
Tue Sep 16 15:34:36 PDT 2014
Author: awatry
Date: Tue Sep 16 17:34:36 2014
New Revision: 217915
URL: http://llvm.org/viewvc/llvm-project?rev=217915&view=rev
Log:
atomic: Add generic atom[ic]_xor
Signed-off-by: Aaron Watry <awatry at gmail.com>
Reviewed-by: Tom Stellard <thomas.stellard at amd.com>
Added:
libclc/trunk/generic/include/clc/atomic/atomic_xor.h
libclc/trunk/generic/include/clc/cl_khr_global_int32_extended_atomics/atom_xor.h
libclc/trunk/generic/include/clc/cl_khr_local_int32_extended_atomics/atom_xor.h
libclc/trunk/generic/lib/cl_khr_global_int32_extended_atomics/atom_xor.cl
libclc/trunk/generic/lib/cl_khr_local_int32_extended_atomics/atom_xor.cl
Modified:
libclc/trunk/generic/include/clc/clc.h
libclc/trunk/generic/lib/SOURCES
libclc/trunk/generic/lib/atomic/atomic_impl.ll
Added: libclc/trunk/generic/include/clc/atomic/atomic_xor.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/atomic/atomic_xor.h?rev=217915&view=auto
==============================================================================
--- libclc/trunk/generic/include/clc/atomic/atomic_xor.h (added)
+++ libclc/trunk/generic/include/clc/atomic/atomic_xor.h Tue Sep 16 17:34:36 2014
@@ -0,0 +1,3 @@
+#define __CLC_FUNCTION atomic_xor
+#include <clc/atomic/atomic_decl.inc>
+#undef __CLC_FUNCTION
Added: libclc/trunk/generic/include/clc/cl_khr_global_int32_extended_atomics/atom_xor.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/cl_khr_global_int32_extended_atomics/atom_xor.h?rev=217915&view=auto
==============================================================================
--- libclc/trunk/generic/include/clc/cl_khr_global_int32_extended_atomics/atom_xor.h (added)
+++ libclc/trunk/generic/include/clc/cl_khr_global_int32_extended_atomics/atom_xor.h Tue Sep 16 17:34:36 2014
@@ -0,0 +1,2 @@
+_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);
Added: libclc/trunk/generic/include/clc/cl_khr_local_int32_extended_atomics/atom_xor.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/cl_khr_local_int32_extended_atomics/atom_xor.h?rev=217915&view=auto
==============================================================================
--- libclc/trunk/generic/include/clc/cl_khr_local_int32_extended_atomics/atom_xor.h (added)
+++ libclc/trunk/generic/include/clc/cl_khr_local_int32_extended_atomics/atom_xor.h Tue Sep 16 17:34:36 2014
@@ -0,0 +1,2 @@
+_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);
Modified: libclc/trunk/generic/include/clc/clc.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/clc.h?rev=217915&r1=217914&r2=217915&view=diff
==============================================================================
--- libclc/trunk/generic/include/clc/clc.h (original)
+++ libclc/trunk/generic/include/clc/clc.h Tue Sep 16 17:34:36 2014
@@ -147,6 +147,7 @@
#include <clc/atomic/atomic_max.h>
#include <clc/atomic/atomic_or.h>
#include <clc/atomic/atomic_sub.h>
+#include <clc/atomic/atomic_xor.h>
/* cl_khr_global_int32_base_atomics Extension Functions */
#include <clc/cl_khr_global_int32_base_atomics/atom_add.h>
@@ -158,6 +159,7 @@
#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>
+#include <clc/cl_khr_global_int32_extended_atomics/atom_xor.h>
/* cl_khr_local_int32_base_atomics Extension Functions */
#include <clc/cl_khr_local_int32_base_atomics/atom_add.h>
@@ -169,6 +171,7 @@
#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>
+#include <clc/cl_khr_local_int32_extended_atomics/atom_xor.h>
/* libclc internal defintions */
#ifdef __CLC_INTERNAL
Modified: libclc/trunk/generic/lib/SOURCES
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/SOURCES?rev=217915&r1=217914&r2=217915&view=diff
==============================================================================
--- libclc/trunk/generic/lib/SOURCES (original)
+++ libclc/trunk/generic/lib/SOURCES Tue Sep 16 17:34:36 2014
@@ -7,6 +7,7 @@ cl_khr_global_int32_base_atomics/atom_su
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_global_int32_extended_atomics/atom_xor.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
@@ -14,6 +15,7 @@ cl_khr_local_int32_base_atomics/atom_sub
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
+cl_khr_local_int32_extended_atomics/atom_xor.cl
convert.cl
common/sign.cl
geometric/cross.cl
Modified: libclc/trunk/generic/lib/atomic/atomic_impl.ll
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/atomic/atomic_impl.ll?rev=217915&r1=217914&r2=217915&view=diff
==============================================================================
--- libclc/trunk/generic/lib/atomic/atomic_impl.ll (original)
+++ libclc/trunk/generic/lib/atomic/atomic_impl.ll Tue Sep 16 17:34:36 2014
@@ -45,6 +45,7 @@ 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
@@ -68,3 +69,15 @@ entry:
%0 = atomicrmw volatile sub i32 addrspace(3)* %ptr, i32 %value seq_cst
ret i32 %0
}
+
+define i32 @__clc_atomic_xor_addr1(i32 addrspace(1)* nocapture %ptr, i32 %value) nounwind alwaysinline {
+entry:
+ %0 = atomicrmw volatile xor i32 addrspace(1)* %ptr, i32 %value seq_cst
+ ret i32 %0
+}
+
+define i32 @__clc_atomic_xor_addr3(i32 addrspace(3)* nocapture %ptr, i32 %value) nounwind alwaysinline {
+entry:
+ %0 = atomicrmw volatile xor i32 addrspace(3)* %ptr, i32 %value seq_cst
+ ret i32 %0
+}
Added: libclc/trunk/generic/lib/cl_khr_global_int32_extended_atomics/atom_xor.cl
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/cl_khr_global_int32_extended_atomics/atom_xor.cl?rev=217915&view=auto
==============================================================================
--- libclc/trunk/generic/lib/cl_khr_global_int32_extended_atomics/atom_xor.cl (added)
+++ libclc/trunk/generic/lib/cl_khr_global_int32_extended_atomics/atom_xor.cl Tue Sep 16 17:34:36 2014
@@ -0,0 +1,9 @@
+#include <clc/clc.h>
+
+#define IMPL(TYPE) \
+_CLC_OVERLOAD _CLC_DEF TYPE atom_xor(global TYPE *p, TYPE val) { \
+ return atomic_xor(p, val); \
+}
+
+IMPL(int)
+IMPL(unsigned int)
Added: libclc/trunk/generic/lib/cl_khr_local_int32_extended_atomics/atom_xor.cl
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/cl_khr_local_int32_extended_atomics/atom_xor.cl?rev=217915&view=auto
==============================================================================
--- libclc/trunk/generic/lib/cl_khr_local_int32_extended_atomics/atom_xor.cl (added)
+++ libclc/trunk/generic/lib/cl_khr_local_int32_extended_atomics/atom_xor.cl Tue Sep 16 17:34:36 2014
@@ -0,0 +1,9 @@
+#include <clc/clc.h>
+
+#define IMPL(TYPE) \
+_CLC_OVERLOAD _CLC_DEF TYPE atom_xor(local TYPE *p, TYPE val) { \
+ return atomic_xor(p, val); \
+}
+
+IMPL(int)
+IMPL(unsigned int)
More information about the cfe-commits
mailing list