Skip to content

Commit 7d5c6d4

Browse files
committed
AMDGPU: Remove most manual AVLdSt decoder code
This was additional hacking around using incorrect register class constraints for paired data operands. I'm not really sure why we need any of what's left. In particular the IS_VGPR special case seems backwards from how the encoding works.
1 parent 0b696a8 commit 7d5c6d4

File tree

1 file changed

+0
-42
lines changed

1 file changed

+0
-42
lines changed

llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -368,51 +368,9 @@ static DecodeStatus decodeOperandVOPDDstY(MCInst &Inst, unsigned Val,
368368
return addOperand(Inst, DAsm->decodeVOPDDstYOp(Inst, Val));
369369
}
370370

371-
static bool IsAGPROperand(const MCInst &Inst, int OpIdx,
372-
const MCRegisterInfo *MRI) {
373-
if (OpIdx < 0)
374-
return false;
375-
376-
const MCOperand &Op = Inst.getOperand(OpIdx);
377-
if (!Op.isReg())
378-
return false;
379-
380-
MCRegister Sub = MRI->getSubReg(Op.getReg(), AMDGPU::sub0);
381-
auto Reg = Sub ? Sub : Op.getReg();
382-
return Reg >= AMDGPU::AGPR0 && Reg <= AMDGPU::AGPR255;
383-
}
384-
385371
static DecodeStatus decodeAVLdSt(MCInst &Inst, unsigned Imm, unsigned Opw,
386372
const MCDisassembler *Decoder) {
387373
const auto *DAsm = static_cast<const AMDGPUDisassembler *>(Decoder);
388-
if (!DAsm->isGFX90A()) {
389-
Imm &= 511;
390-
} else {
391-
// If atomic has both vdata and vdst their register classes are tied.
392-
// The bit is decoded along with the vdst, first operand. We need to
393-
// change register class to AGPR if vdst was AGPR.
394-
// If a DS instruction has both data0 and data1 their register classes
395-
// are also tied.
396-
unsigned Opc = Inst.getOpcode();
397-
uint64_t TSFlags = DAsm->getMCII()->get(Opc).TSFlags;
398-
AMDGPU::OpName DataName = (TSFlags & SIInstrFlags::DS)
399-
? AMDGPU::OpName::data0
400-
: AMDGPU::OpName::vdata;
401-
const MCRegisterInfo *MRI = DAsm->getContext().getRegisterInfo();
402-
int DataIdx = AMDGPU::getNamedOperandIdx(Opc, DataName);
403-
if ((int)Inst.getNumOperands() == DataIdx) {
404-
int DstIdx = AMDGPU::getNamedOperandIdx(Opc, AMDGPU::OpName::vdst);
405-
if (IsAGPROperand(Inst, DstIdx, MRI))
406-
Imm |= 512;
407-
}
408-
409-
if (TSFlags & SIInstrFlags::DS) {
410-
int Data2Idx = AMDGPU::getNamedOperandIdx(Opc, AMDGPU::OpName::data1);
411-
if ((int)Inst.getNumOperands() == Data2Idx &&
412-
IsAGPROperand(Inst, DataIdx, MRI))
413-
Imm |= 512;
414-
}
415-
}
416374
return addOperand(Inst, DAsm->decodeSrcOp(Opw, Imm | 256));
417375
}
418376

0 commit comments

Comments
 (0)