mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-28 22:20:37 +00:00
AMDGPU: split ret/noret patterns for global atomics
Differential Revision: https://reviews.llvm.org/D27989 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290435 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
bb52a7179e
commit
0547dafe38
@ -363,24 +363,54 @@ multiclass AtomicCmpSwapLocal <SDNode cmp_swap_node> {
|
||||
|
||||
defm atomic_cmp_swap : AtomicCmpSwapLocal <atomic_cmp_swap>;
|
||||
|
||||
class global_binary_atomic_op<SDNode atomic_op> : PatFrag<
|
||||
(ops node:$ptr, node:$value),
|
||||
(atomic_op node:$ptr, node:$value),
|
||||
[{return cast<MemSDNode>(N)->getAddressSpace() == AMDGPUAS::GLOBAL_ADDRESS;}]
|
||||
>;
|
||||
multiclass global_binary_atomic_op<SDNode atomic_op> {
|
||||
def "" : PatFrag<
|
||||
(ops node:$ptr, node:$value),
|
||||
(atomic_op node:$ptr, node:$value),
|
||||
[{return cast<MemSDNode>(N)->getAddressSpace() == AMDGPUAS::GLOBAL_ADDRESS;}]>;
|
||||
|
||||
def atomic_swap_global : global_binary_atomic_op<atomic_swap>;
|
||||
def atomic_add_global : global_binary_atomic_op<atomic_load_add>;
|
||||
def atomic_and_global : global_binary_atomic_op<atomic_load_and>;
|
||||
def atomic_max_global : global_binary_atomic_op<atomic_load_max>;
|
||||
def atomic_min_global : global_binary_atomic_op<atomic_load_min>;
|
||||
def atomic_or_global : global_binary_atomic_op<atomic_load_or>;
|
||||
def atomic_sub_global : global_binary_atomic_op<atomic_load_sub>;
|
||||
def atomic_umax_global : global_binary_atomic_op<atomic_load_umax>;
|
||||
def atomic_umin_global : global_binary_atomic_op<atomic_load_umin>;
|
||||
def atomic_xor_global : global_binary_atomic_op<atomic_load_xor>;
|
||||
def _noret : PatFrag<
|
||||
(ops node:$ptr, node:$value),
|
||||
(atomic_op node:$ptr, node:$value),
|
||||
[{return cast<MemSDNode>(N)->getAddressSpace() == AMDGPUAS::GLOBAL_ADDRESS && (SDValue(N, 0).use_empty());}]>;
|
||||
|
||||
def atomic_cmp_swap_global : global_binary_atomic_op<AMDGPUatomic_cmp_swap>;
|
||||
def _ret : PatFrag<
|
||||
(ops node:$ptr, node:$value),
|
||||
(atomic_op node:$ptr, node:$value),
|
||||
[{return cast<MemSDNode>(N)->getAddressSpace() == AMDGPUAS::GLOBAL_ADDRESS && (!SDValue(N, 0).use_empty());}]>;
|
||||
}
|
||||
|
||||
defm atomic_swap_global : global_binary_atomic_op<atomic_swap>;
|
||||
defm atomic_add_global : global_binary_atomic_op<atomic_load_add>;
|
||||
defm atomic_and_global : global_binary_atomic_op<atomic_load_and>;
|
||||
defm atomic_max_global : global_binary_atomic_op<atomic_load_max>;
|
||||
defm atomic_min_global : global_binary_atomic_op<atomic_load_min>;
|
||||
defm atomic_or_global : global_binary_atomic_op<atomic_load_or>;
|
||||
defm atomic_sub_global : global_binary_atomic_op<atomic_load_sub>;
|
||||
defm atomic_umax_global : global_binary_atomic_op<atomic_load_umax>;
|
||||
defm atomic_umin_global : global_binary_atomic_op<atomic_load_umin>;
|
||||
defm atomic_xor_global : global_binary_atomic_op<atomic_load_xor>;
|
||||
|
||||
//legacy
|
||||
def AMDGPUatomic_cmp_swap_global : PatFrag<
|
||||
(ops node:$ptr, node:$value),
|
||||
(AMDGPUatomic_cmp_swap node:$ptr, node:$value),
|
||||
[{return cast<MemSDNode>(N)->getAddressSpace() == AMDGPUAS::GLOBAL_ADDRESS;}]>;
|
||||
|
||||
def atomic_cmp_swap_global : PatFrag<
|
||||
(ops node:$ptr, node:$cmp, node:$value),
|
||||
(atomic_cmp_swap node:$ptr, node:$cmp, node:$value),
|
||||
[{return cast<MemSDNode>(N)->getAddressSpace() == AMDGPUAS::GLOBAL_ADDRESS;}]>;
|
||||
|
||||
def atomic_cmp_swap_global_noret : PatFrag<
|
||||
(ops node:$ptr, node:$cmp, node:$value),
|
||||
(atomic_cmp_swap node:$ptr, node:$cmp, node:$value),
|
||||
[{return cast<MemSDNode>(N)->getAddressSpace() == AMDGPUAS::GLOBAL_ADDRESS && (SDValue(N, 0).use_empty());}]>;
|
||||
|
||||
def atomic_cmp_swap_global_ret : PatFrag<
|
||||
(ops node:$ptr, node:$cmp, node:$value),
|
||||
(atomic_cmp_swap node:$ptr, node:$cmp, node:$value),
|
||||
[{return cast<MemSDNode>(N)->getAddressSpace() == AMDGPUAS::GLOBAL_ADDRESS && (!SDValue(N, 0).use_empty());}]>;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Misc Pattern Fragments
|
||||
|
@ -372,7 +372,7 @@ def : FlatAtomicPat <FLAT_ATOMIC_SMIN_RTN, atomic_min_global, i32>;
|
||||
def : FlatAtomicPat <FLAT_ATOMIC_UMIN_RTN, atomic_umin_global, i32>;
|
||||
def : FlatAtomicPat <FLAT_ATOMIC_OR_RTN, atomic_or_global, i32>;
|
||||
def : FlatAtomicPat <FLAT_ATOMIC_SWAP_RTN, atomic_swap_global, i32>;
|
||||
def : FlatAtomicPat <FLAT_ATOMIC_CMPSWAP_RTN, atomic_cmp_swap_global, i32, v2i32>;
|
||||
def : FlatAtomicPat <FLAT_ATOMIC_CMPSWAP_RTN, AMDGPUatomic_cmp_swap_global, i32, v2i32>;
|
||||
def : FlatAtomicPat <FLAT_ATOMIC_XOR_RTN, atomic_xor_global, i32>;
|
||||
|
||||
def : FlatAtomicPat <FLAT_ATOMIC_ADD_X2_RTN, atomic_add_global, i64>;
|
||||
@ -386,7 +386,7 @@ def : FlatAtomicPat <FLAT_ATOMIC_SMIN_X2_RTN, atomic_min_global, i64>;
|
||||
def : FlatAtomicPat <FLAT_ATOMIC_UMIN_X2_RTN, atomic_umin_global, i64>;
|
||||
def : FlatAtomicPat <FLAT_ATOMIC_OR_X2_RTN, atomic_or_global, i64>;
|
||||
def : FlatAtomicPat <FLAT_ATOMIC_SWAP_X2_RTN, atomic_swap_global, i64>;
|
||||
def : FlatAtomicPat <FLAT_ATOMIC_CMPSWAP_X2_RTN, atomic_cmp_swap_global, i64, v2i64>;
|
||||
def : FlatAtomicPat <FLAT_ATOMIC_CMPSWAP_X2_RTN, AMDGPUatomic_cmp_swap_global, i64, v2i64>;
|
||||
def : FlatAtomicPat <FLAT_ATOMIC_XOR_X2_RTN, atomic_xor_global, i64>;
|
||||
|
||||
} // End Predicates = [isCIVI]
|
||||
|
@ -94,8 +94,8 @@ def SIpc_add_rel_offset : SDNode<"AMDGPUISD::PC_ADD_REL_OFFSET",
|
||||
// PatFrags for global memory operations
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
def atomic_inc_global : global_binary_atomic_op<SIatomic_inc>;
|
||||
def atomic_dec_global : global_binary_atomic_op<SIatomic_dec>;
|
||||
defm atomic_inc_global : global_binary_atomic_op<SIatomic_inc>;
|
||||
defm atomic_dec_global : global_binary_atomic_op<SIatomic_dec>;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// SDNodes and PatFrag for local loads and stores to enable s_mov_b32 m0, -1
|
||||
|
Loading…
Reference in New Issue
Block a user