mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-18 22:26:16 +00:00
atomic: Add generic implementation of atom[ic]_max
Not used yet... v2: Correct int/uint behavior Signed-off-by: Aaron Watry <awatry@gmail.com> Reviewed-by: Tom Stellard <thomas.stellard@amd.com> llvm-svn: 217912
This commit is contained in:
parent
c9b88d32be
commit
49614fbfd9
3
libclc/generic/include/clc/atomic/atomic_max.h
Normal file
3
libclc/generic/include/clc/atomic/atomic_max.h
Normal file
@ -0,0 +1,3 @@
|
||||
#define __CLC_FUNCTION atomic_max
|
||||
#include <clc/atomic/atomic_decl.inc>
|
||||
#undef __CLC_FUNCTION
|
@ -0,0 +1,2 @@
|
||||
_CLC_OVERLOAD _CLC_DECL int atom_max(global int *p, int val);
|
||||
_CLC_OVERLOAD _CLC_DECL unsigned int atom_max(global unsigned int *p, unsigned int val);
|
@ -0,0 +1,2 @@
|
||||
_CLC_OVERLOAD _CLC_DECL int atom_max(local int *p, int val);
|
||||
_CLC_OVERLOAD _CLC_DECL unsigned int atom_max(local unsigned int *p, unsigned int val);
|
@ -143,6 +143,7 @@
|
||||
#include <clc/atomic/atomic_add.h>
|
||||
#include <clc/atomic/atomic_dec.h>
|
||||
#include <clc/atomic/atomic_inc.h>
|
||||
#include <clc/atomic/atomic_max.h>
|
||||
#include <clc/atomic/atomic_sub.h>
|
||||
|
||||
/* cl_khr_global_int32_base_atomics Extension Functions */
|
||||
@ -151,11 +152,17 @@
|
||||
#include <clc/cl_khr_global_int32_base_atomics/atom_inc.h>
|
||||
#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_max.h>
|
||||
|
||||
/* cl_khr_local_int32_base_atomics Extension Functions */
|
||||
#include <clc/cl_khr_local_int32_base_atomics/atom_add.h>
|
||||
#include <clc/cl_khr_local_int32_base_atomics/atom_dec.h>
|
||||
#include <clc/cl_khr_local_int32_base_atomics/atom_inc.h>
|
||||
#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_max.h>
|
||||
|
||||
/* libclc internal defintions */
|
||||
#ifdef __CLC_INTERNAL
|
||||
|
@ -4,10 +4,12 @@ cl_khr_global_int32_base_atomics/atom_add.cl
|
||||
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_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_max.cl
|
||||
convert.cl
|
||||
common/sign.cl
|
||||
geometric/cross.cl
|
||||
|
@ -10,6 +10,30 @@ entry:
|
||||
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
|
||||
ret i32 %0
|
||||
}
|
||||
|
||||
define i32 @__clc_atomic_max_addr3(i32 addrspace(3)* nocapture %ptr, i32 %value) nounwind alwaysinline {
|
||||
entry:
|
||||
%0 = atomicrmw volatile max i32 addrspace(3)* %ptr, i32 %value seq_cst
|
||||
ret i32 %0
|
||||
}
|
||||
|
||||
define i32 @__clc_atomic_umax_addr1(i32 addrspace(1)* nocapture %ptr, i32 %value) nounwind alwaysinline {
|
||||
entry:
|
||||
%0 = atomicrmw volatile umax i32 addrspace(1)* %ptr, i32 %value seq_cst
|
||||
ret i32 %0
|
||||
}
|
||||
|
||||
define i32 @__clc_atomic_umax_addr3(i32 addrspace(3)* nocapture %ptr, i32 %value) nounwind alwaysinline {
|
||||
entry:
|
||||
%0 = atomicrmw volatile umax 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
|
||||
|
@ -0,0 +1,9 @@
|
||||
#include <clc/clc.h>
|
||||
|
||||
#define IMPL(TYPE) \
|
||||
_CLC_OVERLOAD _CLC_DEF TYPE atom_max(global TYPE *p, TYPE val) { \
|
||||
return atomic_max(p, val); \
|
||||
}
|
||||
|
||||
IMPL(int)
|
||||
IMPL(unsigned int)
|
@ -0,0 +1,9 @@
|
||||
#include <clc/clc.h>
|
||||
|
||||
#define IMPL(TYPE) \
|
||||
_CLC_OVERLOAD _CLC_DEF TYPE atom_max(local TYPE *p, TYPE val) { \
|
||||
return atomic_max(p, val); \
|
||||
}
|
||||
|
||||
IMPL(int)
|
||||
IMPL(unsigned int)
|
Loading…
x
Reference in New Issue
Block a user