[PATCH] D49995: [AMDGPU] Minor change to d16 buffer load implementation
Tim Renouf via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 30 10:12:09 PDT 2018
tpr created this revision.
Herald added subscribers: llvm-commits, t-tye, dstuttard, yaxunl, nhaehnle, wdng, kzhuravl, arsenm.
By not reconstructing the operand list of the SDNode, this change makes
it easier to add the forthcoming new tbuffer and buffer intrinsics.
Change-Id: I0cb79ef0801532645d7dd954a6d7355139db7b38
Repository:
rL LLVM
https://reviews.llvm.org/D49995
Files:
lib/Target/AMDGPU/SIISelLowering.cpp
lib/Target/AMDGPU/SIISelLowering.h
Index: lib/Target/AMDGPU/SIISelLowering.h
===================================================================
--- lib/Target/AMDGPU/SIISelLowering.h
+++ lib/Target/AMDGPU/SIISelLowering.h
@@ -81,7 +81,7 @@
SDValue LowerBRCOND(SDValue Op, SelectionDAG &DAG) const;
SDValue adjustLoadValueType(unsigned Opcode, MemSDNode *M,
- SelectionDAG &DAG,
+ SelectionDAG &DAG, ArrayRef<SDValue> Ops,
bool IsIntrinsic = false) const;
SDValue handleD16VData(SDValue VData, SelectionDAG &DAG) const;
Index: lib/Target/AMDGPU/SIISelLowering.cpp
===================================================================
--- lib/Target/AMDGPU/SIISelLowering.cpp
+++ lib/Target/AMDGPU/SIISelLowering.cpp
@@ -3659,18 +3659,9 @@
SDValue SITargetLowering::adjustLoadValueType(unsigned Opcode,
MemSDNode *M,
SelectionDAG &DAG,
+ ArrayRef<SDValue> Ops,
bool IsIntrinsic) const {
SDLoc DL(M);
- SmallVector<SDValue, 10> Ops;
- Ops.reserve(M->getNumOperands());
-
- Ops.push_back(M->getOperand(0));
- if (IsIntrinsic)
- Ops.push_back(DAG.getConstant(Opcode, DL, MVT::i32));
-
- // Skip 1, as it is the intrinsic ID.
- for (unsigned I = 2, E = M->getNumOperands(); I != E; ++I)
- Ops.push_back(M->getOperand(I));
bool Unpacked = Subtarget->hasUnpackedD16VMem();
EVT LoadVT = M->getValueType(0);
@@ -5107,20 +5098,16 @@
EVT IntVT = VT.changeTypeToInteger();
auto *M = cast<MemSDNode>(Op);
EVT LoadVT = Op.getValueType();
- bool IsD16 = LoadVT.getScalarType() == MVT::f16;
- if (IsD16)
- return adjustLoadValueType(AMDGPUISD::BUFFER_LOAD_FORMAT_D16, M, DAG);
+ if (LoadVT.getScalarType() == MVT::f16)
+ return adjustLoadValueType(AMDGPUISD::BUFFER_LOAD_FORMAT_D16,
+ M, DAG, Ops);
return DAG.getMemIntrinsicNode(Opc, DL, Op->getVTList(), Ops, IntVT,
M->getMemOperand());
}
case Intrinsic::amdgcn_tbuffer_load: {
MemSDNode *M = cast<MemSDNode>(Op);
EVT LoadVT = Op.getValueType();
- bool IsD16 = LoadVT.getScalarType() == MVT::f16;
- if (IsD16) {
- return adjustLoadValueType(AMDGPUISD::TBUFFER_LOAD_FORMAT_D16, M, DAG);
- }
SDValue Ops[] = {
Op.getOperand(0), // Chain
@@ -5135,6 +5122,9 @@
Op.getOperand(10) // slc
};
+ if (LoadVT.getScalarType() == MVT::f16)
+ return adjustLoadValueType(AMDGPUISD::TBUFFER_LOAD_FORMAT_D16,
+ M, DAG, Ops);
return DAG.getMemIntrinsicNode(AMDGPUISD::TBUFFER_LOAD_FORMAT, DL,
Op->getVTList(), Ops, LoadVT,
M->getMemOperand());
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49995.157992.patch
Type: text/x-patch
Size: 2924 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180730/8fa4efff/attachment.bin>
More information about the llvm-commits
mailing list