[llvm] b67ea3d - [AMDGPU] Allow no-modifier operands in cvtDPP
Joe Nash via llvm-commits
llvm-commits at lists.llvm.org
Tue May 25 08:11:14 PDT 2021
Author: Joe Nash
Date: 2021-05-25T10:58:06-04:00
New Revision: b67ea3d0c90c6a06576a806c67c7fa8721b7f5eb
URL: https://github.com/llvm/llvm-project/commit/b67ea3d0c90c6a06576a806c67c7fa8721b7f5eb
DIFF: https://github.com/llvm/llvm-project/commit/b67ea3d0c90c6a06576a806c67c7fa8721b7f5eb.diff
LOG: [AMDGPU] Allow no-modifier operands in cvtDPP
NFC, since no instructions have their AsmMatchConverter
changed, but prepares for that to happen.
Reviewed By: rampitec
Differential Revision: https://reviews.llvm.org/D103046
Change-Id: I6afefad899076de7b9a412374d09b95b29e012fa
Added:
Modified:
llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp b/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
index 611733218412..250876bd0c69 100644
--- a/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
+++ b/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
@@ -7950,6 +7950,9 @@ AMDGPUOperand::Ptr AMDGPUAsmParser::defaultFI() const {
void AMDGPUAsmParser::cvtDPP(MCInst &Inst, const OperandVector &Operands, bool IsDPP8) {
OptionalImmIndexMap OptionalIdx;
+ unsigned Opc = Inst.getOpcode();
+ bool HasModifiers =
+ AMDGPU::getNamedOperandIdx(Opc, AMDGPU::OpName::src0_modifiers) != -1;
unsigned I = 1;
const MCInstrDesc &Desc = MII.get(Inst.getOpcode());
for (unsigned J = 0; J < Desc.getNumDefs(); ++J) {
@@ -7976,7 +7979,8 @@ void AMDGPUAsmParser::cvtDPP(MCInst &Inst, const OperandVector &Operands, bool I
if (IsDPP8) {
if (Op.isDPP8()) {
Op.addImmOperands(Inst, 1);
- } else if (isRegOrImmWithInputMods(Desc, Inst.getNumOperands())) {
+ } else if (HasModifiers &&
+ isRegOrImmWithInputMods(Desc, Inst.getNumOperands())) {
Op.addRegWithFPInputModsOperands(Inst, 2);
} else if (Op.isFI()) {
Fi = Op.getImm();
@@ -7986,8 +7990,11 @@ void AMDGPUAsmParser::cvtDPP(MCInst &Inst, const OperandVector &Operands, bool I
llvm_unreachable("Invalid operand type");
}
} else {
- if (isRegOrImmWithInputMods(Desc, Inst.getNumOperands())) {
+ if (HasModifiers &&
+ isRegOrImmWithInputMods(Desc, Inst.getNumOperands())) {
Op.addRegWithFPInputModsOperands(Inst, 2);
+ } else if (Op.isReg()) {
+ Op.addRegOperands(Inst, 1);
} else if (Op.isDPPCtrl()) {
Op.addImmOperands(Inst, 1);
} else if (Op.isImm()) {
More information about the llvm-commits
mailing list