[libclc] r217913 - atomics: Add generic atom[ic]_and

Aaron Watry awatry at gmail.com
Tue Sep 16 15:34:29 PDT 2014


Author: awatry
Date: Tue Sep 16 17:34:28 2014
New Revision: 217913

URL: http://llvm.org/viewvc/llvm-project?rev=217913&view=rev
Log:
atomics: Add generic atom[ic]_and

Not used yet.

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_and.h
    libclc/trunk/generic/include/clc/cl_khr_global_int32_extended_atomics/atom_and.h
    libclc/trunk/generic/include/clc/cl_khr_local_int32_extended_atomics/atom_and.h
    libclc/trunk/generic/lib/cl_khr_global_int32_extended_atomics/atom_and.cl
    libclc/trunk/generic/lib/cl_khr_local_int32_extended_atomics/atom_and.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_and.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/atomic/atomic_and.h?rev=217913&view=auto
==============================================================================
--- libclc/trunk/generic/include/clc/atomic/atomic_and.h (added)
+++ libclc/trunk/generic/include/clc/atomic/atomic_and.h Tue Sep 16 17:34:28 2014
@@ -0,0 +1,3 @@
+#define __CLC_FUNCTION atomic_and
+#include <clc/atomic/atomic_decl.inc>
+#undef __CLC_FUNCTION

Added: libclc/trunk/generic/include/clc/cl_khr_global_int32_extended_atomics/atom_and.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/cl_khr_global_int32_extended_atomics/atom_and.h?rev=217913&view=auto
==============================================================================
--- libclc/trunk/generic/include/clc/cl_khr_global_int32_extended_atomics/atom_and.h (added)
+++ libclc/trunk/generic/include/clc/cl_khr_global_int32_extended_atomics/atom_and.h Tue Sep 16 17:34:28 2014
@@ -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);

Added: libclc/trunk/generic/include/clc/cl_khr_local_int32_extended_atomics/atom_and.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/cl_khr_local_int32_extended_atomics/atom_and.h?rev=217913&view=auto
==============================================================================
--- libclc/trunk/generic/include/clc/cl_khr_local_int32_extended_atomics/atom_and.h (added)
+++ libclc/trunk/generic/include/clc/cl_khr_local_int32_extended_atomics/atom_and.h Tue Sep 16 17:34:28 2014
@@ -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);

Modified: libclc/trunk/generic/include/clc/clc.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/clc.h?rev=217913&r1=217912&r2=217913&view=diff
==============================================================================
--- libclc/trunk/generic/include/clc/clc.h (original)
+++ libclc/trunk/generic/include/clc/clc.h Tue Sep 16 17:34:28 2014
@@ -141,6 +141,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>
@@ -153,6 +154,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 */
@@ -162,6 +164,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 */

Modified: libclc/trunk/generic/lib/SOURCES
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/SOURCES?rev=217913&r1=217912&r2=217913&view=diff
==============================================================================
--- libclc/trunk/generic/lib/SOURCES (original)
+++ libclc/trunk/generic/lib/SOURCES Tue Sep 16 17:34:28 2014
@@ -4,11 +4,13 @@ cl_khr_global_int32_base_atomics/atom_ad
 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

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=217913&r1=217912&r2=217913&view=diff
==============================================================================
--- libclc/trunk/generic/lib/atomic/atomic_impl.ll (original)
+++ libclc/trunk/generic/lib/atomic/atomic_impl.ll Tue Sep 16 17:34:28 2014
@@ -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

Added: libclc/trunk/generic/lib/cl_khr_global_int32_extended_atomics/atom_and.cl
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/cl_khr_global_int32_extended_atomics/atom_and.cl?rev=217913&view=auto
==============================================================================
--- libclc/trunk/generic/lib/cl_khr_global_int32_extended_atomics/atom_and.cl (added)
+++ libclc/trunk/generic/lib/cl_khr_global_int32_extended_atomics/atom_and.cl Tue Sep 16 17:34:28 2014
@@ -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

Added: libclc/trunk/generic/lib/cl_khr_local_int32_extended_atomics/atom_and.cl
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/cl_khr_local_int32_extended_atomics/atom_and.cl?rev=217913&view=auto
==============================================================================
--- libclc/trunk/generic/lib/cl_khr_local_int32_extended_atomics/atom_and.cl (added)
+++ libclc/trunk/generic/lib/cl_khr_local_int32_extended_atomics/atom_and.cl Tue Sep 16 17:34:28 2014
@@ -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





More information about the cfe-commits mailing list