Add atomic_sub and atomic_dec builtin functions

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
llvm-svn: 190201
This commit is contained in:
Aaron Watry 2013-09-06 20:20:21 +00:00
parent 372cecf642
commit 283e3fa011
5 changed files with 19 additions and 0 deletions

View File

@ -0,0 +1 @@
#define atomic_dec(p) atomic_sub(p, 1);

View File

@ -0,0 +1,3 @@
#define __CLC_FUNCTION atomic_sub
#include <clc/atomic/atomic_decl.inc>
#undef __CLC_FUNCTION

View File

@ -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

View File

@ -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
}

View File

@ -18,3 +18,4 @@ _CLC_OVERLOAD _CLC_DEF SIGN TYPE FUNCTION (volatile CL_ADDRSPACE SIGN TYPE *p, S
ATOMIC_FUNC_ADDRSPACE(int, FUNCTION)
ATOMIC_FUNC(atomic_add)
ATOMIC_FUNC(atomic_sub)