Skip to content

Commit c7238cf

Browse files
committed
AMDGPU: Remove the DS special case in getRegClass
These instructions should now have proper representation with separate instructions for operands which must be paired.
1 parent 22f1911 commit c7238cf

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

llvm/lib/Target/AMDGPU/SIInstrInfo.cpp

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5960,7 +5960,7 @@ adjustAllocatableRegClass(const GCNSubtarget &ST, const SIRegisterInfo &RI,
59605960
if ((IsAllocatable || !ST.hasGFX90AInsts()) &&
59615961
(((TID.mayLoad() || TID.mayStore()) &&
59625962
!(TID.TSFlags & SIInstrFlags::Spill)) ||
5963-
(TID.TSFlags & (SIInstrFlags::DS | SIInstrFlags::MIMG)))) {
5963+
(TID.TSFlags & SIInstrFlags::MIMG))) {
59645964
switch (RCID) {
59655965
case AMDGPU::AV_32RegClassID:
59665966
RCID = AMDGPU::VGPR_32RegClassID;
@@ -5996,23 +5996,18 @@ const TargetRegisterClass *SIInstrInfo::getRegClass(const MCInstrDesc &TID,
59965996
return nullptr;
59975997
auto RegClass = TID.operands()[OpNum].RegClass;
59985998
bool IsAllocatable = false;
5999-
if (TID.TSFlags & (SIInstrFlags::DS | SIInstrFlags::FLAT)) {
5999+
if (TID.TSFlags & SIInstrFlags::FLAT) {
60006000
// vdst and vdata should be both VGPR or AGPR, same for the DS instructions
60016001
// with two data operands. Request register class constrained to VGPR only
60026002
// of both operands present as Machine Copy Propagation can not check this
60036003
// constraint and possibly other passes too.
60046004
//
6005-
// The check is limited to FLAT and DS because atomics in non-flat encoding
6006-
// have their vdst and vdata tied to be the same register.
6007-
const int VDstIdx = AMDGPU::getNamedOperandIdx(TID.Opcode,
6008-
AMDGPU::OpName::vdst);
6009-
const int DataIdx = AMDGPU::getNamedOperandIdx(TID.Opcode,
6010-
(TID.TSFlags & SIInstrFlags::DS) ? AMDGPU::OpName::data0
6011-
: AMDGPU::OpName::vdata);
6012-
if (DataIdx != -1) {
6013-
IsAllocatable = VDstIdx != -1 || AMDGPU::hasNamedOperand(
6014-
TID.Opcode, AMDGPU::OpName::data1);
6015-
}
6005+
// The check is limited to FLAT because atomics in non-flat encoding have
6006+
// their vdst and vdata tied to be the same register, and DS instructions
6007+
// have separate instruction definitions with AGPR and VGPR operand lists.
6008+
IsAllocatable =
6009+
AMDGPU::hasNamedOperand(TID.Opcode, AMDGPU::OpName::vdata) &&
6010+
AMDGPU::hasNamedOperand(TID.Opcode, AMDGPU::OpName::vdst);
60166011
} else if (TID.getOpcode() == AMDGPU::AV_MOV_B64_IMM_PSEUDO) {
60176012
// Special pseudos have no alignment requirement
60186013
return RI.getRegClass(RegClass);

0 commit comments

Comments
 (0)