[libclc] r217921 - R600: Map addr spaces and use atomic_max

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


Author: awatry
Date: Tue Sep 16 17:34:53 2014
New Revision: 217921

URL: http://llvm.org/viewvc/llvm-project?rev=217921&view=rev
Log:
R600: Map addr spaces and use atomic_max

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=217921&r1=217920&r2=217921&view=diff
==============================================================================
--- libclc/trunk/r600/lib/atomic/atomic.cl (original)
+++ libclc/trunk/r600/lib/atomic/atomic.cl Tue Sep 16 17:34:53 2014
@@ -1,14 +1,15 @@
 #include <clc/clc.h>
 
-#define ATOMIC_FUNC_TYPE(SIGN, TYPE, FUNCTION, CL_ADDRSPACE, LLVM_ADDRSPACE) \
-_CLC_OVERLOAD _CLC_DEF SIGN TYPE FUNCTION (volatile CL_ADDRSPACE SIGN TYPE *p, SIGN TYPE val) { \
-	return (SIGN TYPE)__clc_##FUNCTION##_addr##LLVM_ADDRSPACE((volatile CL_ADDRSPACE signed TYPE*)p, (signed TYPE)val); \
+#define ATOMIC_FUNC_DEFINE(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 val) { \
+	return (RET_SIGN TYPE)__clc_##CLC_FUNCTION##_addr##LLVM_ADDRSPACE((volatile CL_ADDRSPACE ARG_SIGN TYPE*)p, (ARG_SIGN TYPE)val); \
 }
 
+/* For atomic functions that don't need different bitcode dependending on argument signedness */
 #define ATOMIC_FUNC_SIGN(TYPE, FUNCTION, CL_ADDRSPACE, LLVM_ADDRSPACE) \
 	_CLC_DECL signed TYPE __clc_##FUNCTION##_addr##LLVM_ADDRSPACE(volatile CL_ADDRSPACE signed TYPE*, signed TYPE); \
-	ATOMIC_FUNC_TYPE(signed, TYPE, FUNCTION, CL_ADDRSPACE, LLVM_ADDRSPACE) \
-	ATOMIC_FUNC_TYPE(unsigned, TYPE, FUNCTION, CL_ADDRSPACE, LLVM_ADDRSPACE)
+	ATOMIC_FUNC_DEFINE(signed, signed, TYPE, FUNCTION, FUNCTION, CL_ADDRSPACE, LLVM_ADDRSPACE) \
+	ATOMIC_FUNC_DEFINE(unsigned, signed, TYPE, FUNCTION, FUNCTION, CL_ADDRSPACE, LLVM_ADDRSPACE)
 
 #define ATOMIC_FUNC_ADDRSPACE(TYPE, FUNCTION) \
 	ATOMIC_FUNC_SIGN(TYPE, FUNCTION, global, 1) \
@@ -21,3 +22,13 @@ ATOMIC_FUNC(atomic_add)
 ATOMIC_FUNC(atomic_and)
 ATOMIC_FUNC(atomic_or)
 ATOMIC_FUNC(atomic_sub)
+
+_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);
+_CLC_DECL uint __clc_atomic_umax_addr1(volatile global uint*, uint);
+_CLC_DECL uint __clc_atomic_umax_addr3(volatile local uint*, uint);
+
+ATOMIC_FUNC_DEFINE(signed, signed, int, atomic_max, atomic_max, global, 1)
+ATOMIC_FUNC_DEFINE(signed, signed, int, atomic_max, atomic_max, local, 3)
+ATOMIC_FUNC_DEFINE(unsigned, unsigned, int, atomic_max, atomic_umax, global, 1)
+ATOMIC_FUNC_DEFINE(unsigned, unsigned, int, atomic_max, atomic_umax, local, 3)





More information about the cfe-commits mailing list