[libclc] r217925 - R600: Map Address spaces for atomic_cmpxchg
Aaron Watry
awatry at gmail.com
Tue Sep 16 15:34:59 PDT 2014
Author: awatry
Date: Tue Sep 16 17:34:59 2014
New Revision: 217925
URL: http://llvm.org/viewvc/llvm-project?rev=217925&view=rev
Log:
R600: Map Address spaces for atomic_cmpxchg
Signed-off-by: Aaron Watry <awatry at gmail.com>
Reviewed-by: Tom Stellard <thomas.stellard at amd.com>
Modified:
libclc/trunk/r600/lib/atomic/atomic.cl
Modified: libclc/trunk/r600/lib/atomic/atomic.cl
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/r600/lib/atomic/atomic.cl?rev=217925&r1=217924&r2=217925&view=diff
==============================================================================
--- libclc/trunk/r600/lib/atomic/atomic.cl (original)
+++ libclc/trunk/r600/lib/atomic/atomic.cl Tue Sep 16 17:34:59 2014
@@ -18,12 +18,31 @@ _CLC_OVERLOAD _CLC_DEF RET_SIGN TYPE CL_
#define ATOMIC_FUNC(FUNCTION) \
ATOMIC_FUNC_ADDRSPACE(int, FUNCTION)
+#define ATOMIC_FUNC_DEFINE_3_ARG(RET_SIGN, ARG_SIGN, TYPE, CL_FUNCTION, CLC_FUNCTION, CL_ADDRSPACE, LLVM_ADDRSPACE) \
+_CLC_OVERLOAD _CLC_DEF RET_SIGN TYPE CL_FUNCTION (volatile CL_ADDRSPACE RET_SIGN TYPE *p, RET_SIGN TYPE cmp, RET_SIGN TYPE val) { \
+ return (RET_SIGN TYPE)__clc_##CLC_FUNCTION##_addr##LLVM_ADDRSPACE((volatile CL_ADDRSPACE ARG_SIGN TYPE*)p, (ARG_SIGN TYPE)cmp, (ARG_SIGN TYPE)val); \
+}
+
+/* For atomic functions that don't need different bitcode dependending on argument signedness */
+#define ATOMIC_FUNC_SIGN_3_ARG(TYPE, FUNCTION, CL_ADDRSPACE, LLVM_ADDRSPACE) \
+ _CLC_DECL signed TYPE __clc_##FUNCTION##_addr##LLVM_ADDRSPACE(volatile CL_ADDRSPACE signed TYPE*, signed TYPE, signed TYPE); \
+ ATOMIC_FUNC_DEFINE_3_ARG(signed, signed, TYPE, FUNCTION, FUNCTION, CL_ADDRSPACE, LLVM_ADDRSPACE) \
+ ATOMIC_FUNC_DEFINE_3_ARG(unsigned, signed, TYPE, FUNCTION, FUNCTION, CL_ADDRSPACE, LLVM_ADDRSPACE)
+
+#define ATOMIC_FUNC_ADDRSPACE_3_ARG(TYPE, FUNCTION) \
+ ATOMIC_FUNC_SIGN_3_ARG(TYPE, FUNCTION, global, 1) \
+ ATOMIC_FUNC_SIGN_3_ARG(TYPE, FUNCTION, local, 3)
+
+#define ATOMIC_FUNC_3_ARG(FUNCTION) \
+ ATOMIC_FUNC_ADDRSPACE_3_ARG(int, FUNCTION)
+
ATOMIC_FUNC(atomic_add)
ATOMIC_FUNC(atomic_and)
ATOMIC_FUNC(atomic_or)
ATOMIC_FUNC(atomic_sub)
ATOMIC_FUNC(atomic_xchg)
ATOMIC_FUNC(atomic_xor)
+ATOMIC_FUNC_3_ARG(atomic_cmpxchg)
_CLC_DECL signed int __clc_atomic_max_addr1(volatile global signed int*, signed int);
_CLC_DECL signed int __clc_atomic_max_addr3(volatile local signed int*, signed int);
More information about the cfe-commits
mailing list