[libclc] r190201 - Add atomic_sub and atomic_dec builtin functions
Aaron Watry
awatry at gmail.com
Fri Sep 6 13:20:22 PDT 2013
Author: awatry
Date: Fri Sep 6 15:20:21 2013
New Revision: 190201
URL: http://llvm.org/viewvc/llvm-project?rev=190201&view=rev
Log:
Add atomic_sub and atomic_dec builtin functions
Reviewed-by: Tom Stellard <thomas.stellard at amd.com>
Added:
libclc/trunk/generic/include/clc/atomic/atomic_dec.h
libclc/trunk/generic/include/clc/atomic/atomic_sub.h
Modified:
libclc/trunk/generic/include/clc/clc.h
libclc/trunk/generic/lib/atomic/atomic_impl.ll
libclc/trunk/r600/lib/atomic/atomic.cl
Added: libclc/trunk/generic/include/clc/atomic/atomic_dec.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/atomic/atomic_dec.h?rev=190201&view=auto
==============================================================================
--- libclc/trunk/generic/include/clc/atomic/atomic_dec.h (added)
+++ libclc/trunk/generic/include/clc/atomic/atomic_dec.h Fri Sep 6 15:20:21 2013
@@ -0,0 +1 @@
+#define atomic_dec(p) atomic_sub(p, 1);
Added: libclc/trunk/generic/include/clc/atomic/atomic_sub.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/atomic/atomic_sub.h?rev=190201&view=auto
==============================================================================
--- libclc/trunk/generic/include/clc/atomic/atomic_sub.h (added)
+++ libclc/trunk/generic/include/clc/atomic/atomic_sub.h Fri Sep 6 15:20:21 2013
@@ -0,0 +1,3 @@
+#define __CLC_FUNCTION atomic_sub
+#include <clc/atomic/atomic_decl.inc>
+#undef __CLC_FUNCTION
Modified: libclc/trunk/generic/include/clc/clc.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/clc.h?rev=190201&r1=190200&r2=190201&view=diff
==============================================================================
--- libclc/trunk/generic/include/clc/clc.h (original)
+++ libclc/trunk/generic/include/clc/clc.h Fri Sep 6 15:20:21 2013
@@ -101,6 +101,8 @@
/* 6.11.11 Atomic Functins */
#include <clc/atomic/atomic_add.h>
+#include <clc/atomic/atomic_dec.h>
#include <clc/atomic/atomic_inc.h>
+#include <clc/atomic/atomic_sub.h>
#pragma OPENCL EXTENSION all : disable
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=190201&r1=190200&r2=190201&view=diff
==============================================================================
--- libclc/trunk/generic/lib/atomic/atomic_impl.ll (original)
+++ libclc/trunk/generic/lib/atomic/atomic_impl.ll Fri Sep 6 15:20:21 2013
@@ -9,3 +9,15 @@ entry:
%0 = atomicrmw volatile add i32 addrspace(3)* %ptr, i32 %value seq_cst
ret i32 %0
}
+
+define i32 @__clc_atomic_sub_addr1(i32 addrspace(1)* nocapture %ptr, i32 %value) nounwind alwaysinline {
+entry:
+ %0 = atomicrmw volatile sub i32 addrspace(1)* %ptr, i32 %value seq_cst
+ ret i32 %0
+}
+
+define i32 @__clc_atomic_sub_addr3(i32 addrspace(3)* nocapture %ptr, i32 %value) nounwind alwaysinline {
+entry:
+ %0 = atomicrmw volatile sub i32 addrspace(3)* %ptr, i32 %value seq_cst
+ ret i32 %0
+}
Modified: libclc/trunk/r600/lib/atomic/atomic.cl
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/r600/lib/atomic/atomic.cl?rev=190201&r1=190200&r2=190201&view=diff
==============================================================================
--- libclc/trunk/r600/lib/atomic/atomic.cl (original)
+++ libclc/trunk/r600/lib/atomic/atomic.cl Fri Sep 6 15:20:21 2013
@@ -18,3 +18,4 @@ _CLC_OVERLOAD _CLC_DEF SIGN TYPE FUNCTIO
ATOMIC_FUNC_ADDRSPACE(int, FUNCTION)
ATOMIC_FUNC(atomic_add)
+ATOMIC_FUNC(atomic_sub)
More information about the cfe-commits
mailing list