diff options
| author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2014-06-11 18:08:48 +0000 |
|---|---|---|
| committer | Matt Arsenault <Matthew.Arsenault@amd.com> | 2014-06-11 18:08:48 +0000 |
| commit | c793e1d9dc603df05591e6db44fa92a67f9573b9 (patch) | |
| tree | 74ce7ff12926898b56b8f3c40af0dcb750f29802 /llvm/lib | |
| parent | 9e874541ac4e226d3cfb8859a4b2290272faaaa6 (diff) | |
| download | bcm5719-llvm-c793e1d9dc603df05591e6db44fa92a67f9573b9.tar.gz bcm5719-llvm-c793e1d9dc603df05591e6db44fa92a67f9573b9.zip | |
R600/SI: Add 32-bit LDS atomic cmpxchg
llvm-svn: 210678
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Target/R600/AMDGPUInstructions.td | 9 | ||||
| -rw-r--r-- | llvm/lib/Target/R600/SIInstructions.td | 15 |
2 files changed, 24 insertions, 0 deletions
diff --git a/llvm/lib/Target/R600/AMDGPUInstructions.td b/llvm/lib/Target/R600/AMDGPUInstructions.td index 1faf9ea06a5..0a103e8ab78 100644 --- a/llvm/lib/Target/R600/AMDGPUInstructions.td +++ b/llvm/lib/Target/R600/AMDGPUInstructions.td @@ -257,6 +257,15 @@ def mskor_global : PatFrag<(ops node:$val, node:$ptr), return dyn_cast<MemSDNode>(N)->getAddressSpace() == AMDGPUAS::GLOBAL_ADDRESS; }]>; +def atomic_cmp_swap_32_local : + PatFrag<(ops node:$ptr, node:$cmp, node:$swap), + (atomic_cmp_swap node:$ptr, node:$cmp, node:$swap), [{ + AtomicSDNode *AN = cast<AtomicSDNode>(N); + return AN->getMemoryVT() == MVT::i32 && + AN->getAddressSpace() == AMDGPUAS::LOCAL_ADDRESS; +}]>; + + class Constants { int TWO_PI = 0x40c90fdb; int PI = 0x40490fdb; diff --git a/llvm/lib/Target/R600/SIInstructions.td b/llvm/lib/Target/R600/SIInstructions.td index f6dc07fbd96..c4360f7492d 100644 --- a/llvm/lib/Target/R600/SIInstructions.td +++ b/llvm/lib/Target/R600/SIInstructions.td @@ -2250,6 +2250,21 @@ defm : DSAtomicRetPat<DS_MIN_RTN_U32, i32, atomic_load_umin_local>; defm : DSAtomicRetPat<DS_MAX_RTN_U32, i32, atomic_load_umax_local>; +multiclass DSAtomicCmpXChg <DS inst, ValueType vt, PatFrag frag> { + def : Pat < + (frag (add i32:$ptr, (i32 IMM16bit:$offset)), vt:$cmp, vt:$swap), + (inst (i1 0), $ptr, $cmp, $swap, (as_i16imm $offset)) + >; + + def : Pat < + (frag i32:$ptr, vt:$cmp, vt:$swap), + (inst 0, $ptr, $cmp, $swap, 0) + >; +} + +defm : DSAtomicCmpXChg<DS_CMPST_RTN_B32, i32, atomic_cmp_swap_32_local>; + + //===----------------------------------------------------------------------===// // MUBUF Patterns //===----------------------------------------------------------------------===// |

