diff options
| author | Tom Stellard <thomas.stellard@amd.com> | 2016-07-04 20:41:48 +0000 |
|---|---|---|
| committer | Tom Stellard <thomas.stellard@amd.com> | 2016-07-04 20:41:48 +0000 |
| commit | 17a0ec540083a11bd739984093ae04291ca1a989 (patch) | |
| tree | 3e663d479503dd448d389f2d5e2975dc1f55cb5e /llvm/lib/Target | |
| parent | 3ad040909ae16e8ae2e1f4e43628e1a5de90dd7a (diff) | |
| download | bcm5719-llvm-17a0ec540083a11bd739984093ae04291ca1a989.tar.gz bcm5719-llvm-17a0ec540083a11bd739984093ae04291ca1a989.zip | |
AMDGPU/SI: Remove hack for selecting < 32-bit loads to MUBUF instructions
Summary:
The isGlobalLoad() query was returning true for constant address space loads
with memory types less than 32-bits, which is wrong. This logic has been
replaced with PatFrag in the TableGen files, to provide the same functionality.
Reviewers: arsenm
Subscribers: arsenm, kzhuravl, llvm-commits
Differential Revision: http://reviews.llvm.org/D21696
llvm-svn: 274521
Diffstat (limited to 'llvm/lib/Target')
| -rw-r--r-- | llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp | 4 | ||||
| -rw-r--r-- | llvm/lib/Target/AMDGPU/SIInstrInfo.td | 18 | ||||
| -rw-r--r-- | llvm/lib/Target/AMDGPU/SIInstructions.td | 8 |
3 files changed, 15 insertions, 15 deletions
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp b/llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp index cfecd29853b..92ee8626e4e 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp @@ -533,10 +533,6 @@ bool AMDGPUDAGToDAGISel::isGlobalLoad(const MemSDNode *N) const { if (Subtarget->getGeneration() < AMDGPUSubtarget::SOUTHERN_ISLANDS) return !isa<GlobalValue>(GetUnderlyingObject( N->getMemOperand()->getValue(), CurDAG->getDataLayout())); - - //TODO: Why do we need this? - if (N->getMemoryVT().bitsLT(MVT::i32)) - return true; } return checkType(N->getMemOperand()->getValue(), AMDGPUAS::GLOBAL_ADDRESS); diff --git a/llvm/lib/Target/AMDGPU/SIInstrInfo.td b/llvm/lib/Target/AMDGPU/SIInstrInfo.td index a113ca2a25a..1e5a63cd42e 100644 --- a/llvm/lib/Target/AMDGPU/SIInstrInfo.td +++ b/llvm/lib/Target/AMDGPU/SIInstrInfo.td @@ -170,17 +170,21 @@ def atomic_flat_store: flat_st <atomic_store>; def flat_truncstorei8 : flat_st <truncstorei8>; def flat_truncstorei16 : flat_st <truncstorei16>; +class MubufLoad <SDPatternOperator op> : PatFrag < + (ops node:$ptr), (op node:$ptr), [{ -def mubuf_load : PatFrag <(ops node:$ptr), (load node:$ptr), [{ - return isGlobalLoad(cast<LoadSDNode>(N)) || - isConstantLoad(cast<LoadSDNode>(N), -1); + const MemSDNode *LD = cast<MemSDNode>(N); + return LD->getAddressSpace() == AMDGPUAS::GLOBAL_ADDRESS || + LD->getAddressSpace() == AMDGPUAS::CONSTANT_ADDRESS; }]>; -def mubuf_load_atomic : PatFrag <(ops node:$ptr), (atomic_load node:$ptr), [{ - return isGlobalLoad(cast<MemSDNode>(N)) || - isConstantLoad(cast<MemSDNode>(N), -1); -}]>; +def mubuf_load : MubufLoad <load>; +def mubuf_az_extloadi8 : MubufLoad <az_extloadi8>; +def mubuf_sextloadi8 : MubufLoad <sextloadi8>; +def mubuf_az_extloadi16 : MubufLoad <az_extloadi16>; +def mubuf_sextloadi16 : MubufLoad <sextloadi16>; +def mubuf_load_atomic : MubufLoad <atomic_load>; def smrd_load : PatFrag <(ops node:$ptr), (load node:$ptr), [{ auto Ld = cast<LoadSDNode>(N); diff --git a/llvm/lib/Target/AMDGPU/SIInstructions.td b/llvm/lib/Target/AMDGPU/SIInstructions.td index 1f7c7ee0e86..93098f65a09 100644 --- a/llvm/lib/Target/AMDGPU/SIInstructions.td +++ b/llvm/lib/Target/AMDGPU/SIInstructions.td @@ -953,16 +953,16 @@ defm BUFFER_STORE_FORMAT_XYZW : MUBUF_Store_Helper < mubuf<0x07>, "buffer_store_format_xyzw", VReg_128 >; defm BUFFER_LOAD_UBYTE : MUBUF_Load_Helper < - mubuf<0x08, 0x10>, "buffer_load_ubyte", VGPR_32, i32, az_extloadi8_global + mubuf<0x08, 0x10>, "buffer_load_ubyte", VGPR_32, i32, mubuf_az_extloadi8 >; defm BUFFER_LOAD_SBYTE : MUBUF_Load_Helper < - mubuf<0x09, 0x11>, "buffer_load_sbyte", VGPR_32, i32, sextloadi8_global + mubuf<0x09, 0x11>, "buffer_load_sbyte", VGPR_32, i32, mubuf_sextloadi8 >; defm BUFFER_LOAD_USHORT : MUBUF_Load_Helper < - mubuf<0x0a, 0x12>, "buffer_load_ushort", VGPR_32, i32, az_extloadi16_global + mubuf<0x0a, 0x12>, "buffer_load_ushort", VGPR_32, i32, mubuf_az_extloadi16 >; defm BUFFER_LOAD_SSHORT : MUBUF_Load_Helper < - mubuf<0x0b, 0x13>, "buffer_load_sshort", VGPR_32, i32, sextloadi16_global + mubuf<0x0b, 0x13>, "buffer_load_sshort", VGPR_32, i32, mubuf_sextloadi16 >; defm BUFFER_LOAD_DWORD : MUBUF_Load_Helper < mubuf<0x0c, 0x14>, "buffer_load_dword", VGPR_32, i32, mubuf_load |

