diff options
author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2016-02-13 04:18:53 +0000 |
---|---|---|
committer | Matt Arsenault <Matthew.Arsenault@amd.com> | 2016-02-13 04:18:53 +0000 |
commit | f2ddbf00ede6e23279b509371c15011f00db56a0 (patch) | |
tree | 08dbe4f784470be09621a301b0c2f3eae896f7e6 /llvm/lib/Target | |
parent | 5f826bbc516a596a9168174013a0f2d536a3433c (diff) | |
download | bcm5719-llvm-f2ddbf00ede6e23279b509371c15011f00db56a0.tar.gz bcm5719-llvm-f2ddbf00ede6e23279b509371c15011f00db56a0.zip |
AMDGPU: Prepare for reducing private element size.
Tests for the new scalarize all private access options will be
included with a future commit.
The only functional change is to make the split/scalarize behavior
for private access of > 4 element vectors to be consistent
with the flat/global handling. This makes the spilling worse
in the two changed tests.
llvm-svn: 260804
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r-- | llvm/lib/Target/AMDGPU/SIISelLowering.cpp | 62 |
1 files changed, 48 insertions, 14 deletions
diff --git a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp index 0f464e28f84..818956b1e06 100644 --- a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp +++ b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp @@ -1693,11 +1693,31 @@ SDValue SITargetLowering::LowerLOAD(SDValue Op, SelectionDAG &DAG) const { // // Fall-through case AMDGPUAS::GLOBAL_ADDRESS: - case AMDGPUAS::PRIVATE_ADDRESS: - if (NumElements >= 8) + case AMDGPUAS::FLAT_ADDRESS: + if (NumElements > 4) return SplitVectorLoad(Op, DAG); // v4 loads are supported for private and global memory. return SDValue(); + case AMDGPUAS::PRIVATE_ADDRESS: { + // Depending on the setting of the private_element_size field in the + // resource descriptor, we can only make private accesses up to a certain + // size. + switch (Subtarget->getMaxPrivateElementSize()) { + case 4: + return ScalarizeVectorLoad(Op, DAG); + case 8: + if (NumElements > 2) + return SplitVectorLoad(Op, DAG); + return SDValue(); + case 16: + // Same as global/flat + if (NumElements > 4) + return SplitVectorLoad(Op, DAG); + return SDValue(); + default: + llvm_unreachable("unsupported private_element_size"); + } + } case AMDGPUAS::LOCAL_ADDRESS: // If properly aligned, if we split we might be able to use ds_read_b64. return SplitVectorLoad(Op, DAG); @@ -1907,21 +1927,35 @@ SDValue SITargetLowering::LowerSTORE(SDValue Op, SelectionDAG &DAG) const { assert(Store->getValue().getValueType().getScalarType() == MVT::i32); - unsigned NElts = VT.getVectorNumElements(); - unsigned AS = Store->getAddressSpace(); - if (AS == AMDGPUAS::LOCAL_ADDRESS) { + unsigned NumElements = VT.getVectorNumElements(); + switch (Store->getAddressSpace()) { + case AMDGPUAS::GLOBAL_ADDRESS: + case AMDGPUAS::FLAT_ADDRESS: + if (NumElements > 4) + return SplitVectorStore(Op, DAG); + return SDValue(); + case AMDGPUAS::PRIVATE_ADDRESS: { + switch (Subtarget->getMaxPrivateElementSize()) { + case 4: + return ScalarizeVectorStore(Op, DAG); + case 8: + if (NumElements > 2) + return SplitVectorStore(Op, DAG); + return SDValue(); + case 16: + if (NumElements > 4) + return SplitVectorStore(Op, DAG); + return SDValue(); + default: + llvm_unreachable("unsupported private_element_size"); + } + } + case AMDGPUAS::LOCAL_ADDRESS: // If properly aligned, if we split we might be able to use ds_write_b64. return SplitVectorStore(Op, DAG); + default: + llvm_unreachable("unhandled address space"); } - - if (AS == AMDGPUAS::PRIVATE_ADDRESS && NElts > 4) - return ScalarizeVectorStore(Op, DAG); - - // These stores are legal. private, global and flat. - if (NElts >= 8) - return SplitVectorStore(Op, DAG); - - return SDValue(); } SDValue SITargetLowering::LowerTrig(SDValue Op, SelectionDAG &DAG) const { |