diff --git a/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp b/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp --- a/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp +++ b/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp @@ -396,10 +396,6 @@ bool isNegHi() const { return isImmTy(ImmTyNegHi); } bool isHigh() const { return isImmTy(ImmTyHigh); } - bool isMod() const { - return isClampSI() || isOModSI(); - } - bool isRegOrImm() const { return isReg() || isImm(); } @@ -8213,29 +8209,16 @@ ((AMDGPUOperand &)*Operands[I++]).addRegOperands(Inst, 1); } - if (AMDGPU::hasNamedOperand(Opc, AMDGPU::OpName::src0_modifiers)) { - // This instruction has src modifiers - for (unsigned E = Operands.size(); I != E; ++I) { - AMDGPUOperand &Op = ((AMDGPUOperand &)*Operands[I]); - if (isRegOrImmWithInputMods(Desc, Inst.getNumOperands())) { - Op.addRegOrImmWithFPInputModsOperands(Inst, 2); - } else if (Op.isImmModifier()) { - OptionalIdx[Op.getImmTy()] = I; - } else if (Op.isRegOrImm()) { - Op.addRegOrImmOperands(Inst, 1); - } else { - llvm_unreachable("unhandled operand type"); - } - } - } else { - // No src modifiers - for (unsigned E = Operands.size(); I != E; ++I) { - AMDGPUOperand &Op = ((AMDGPUOperand &)*Operands[I]); - if (Op.isMod()) { - OptionalIdx[Op.getImmTy()] = I; - } else { - Op.addRegOrImmOperands(Inst, 1); - } + for (unsigned E = Operands.size(); I != E; ++I) { + AMDGPUOperand &Op = ((AMDGPUOperand &)*Operands[I]); + if (isRegOrImmWithInputMods(Desc, Inst.getNumOperands())) { + Op.addRegOrImmWithFPInputModsOperands(Inst, 2); + } else if (Op.isImmModifier()) { + OptionalIdx[Op.getImmTy()] = I; + } else if (Op.isRegOrImm()) { + Op.addRegOrImmOperands(Inst, 1); + } else { + llvm_unreachable("unhandled operand type"); } } @@ -8737,8 +8720,6 @@ OptionalImmIndexMap OptionalIdx; unsigned Opc = Inst.getOpcode(); const MCInstrDesc &Desc = MII.get(Inst.getOpcode()); - bool HasModifiers = - AMDGPU::hasNamedOperand(Opc, AMDGPU::OpName::src0_modifiers); // MAC instructions are special because they have 'old' // operand which is not tied to dst (but assumed to be). @@ -8780,14 +8761,12 @@ // Add the register arguments if (IsDPP8 && Op.isFI()) { Fi = Op.getImm(); - } else if (HasModifiers && - isRegOrImmWithInputMods(Desc, Inst.getNumOperands())) { + } else if (isRegOrImmWithInputMods(Desc, Inst.getNumOperands())) { Op.addRegOrImmWithFPInputModsOperands(Inst, 2); } else if (Op.isReg()) { Op.addRegOperands(Inst, 1); } else if (Op.isImm() && Desc.OpInfo[Inst.getNumOperands()].RegClass != -1) { - assert(!HasModifiers && "Case should be unreachable with modifiers"); assert(!Op.IsImmKindLiteral() && "Cannot use literal with DPP"); Op.addImmOperands(Inst, 1); } else if (Op.isImm()) { @@ -8829,9 +8808,6 @@ void AMDGPUAsmParser::cvtDPP(MCInst &Inst, const OperandVector &Operands, bool IsDPP8) { OptionalImmIndexMap OptionalIdx; - unsigned Opc = Inst.getOpcode(); - bool HasModifiers = - AMDGPU::hasNamedOperand(Opc, AMDGPU::OpName::src0_modifiers); unsigned I = 1; const MCInstrDesc &Desc = MII.get(Inst.getOpcode()); for (unsigned J = 0; J < Desc.getNumDefs(); ++J) { @@ -8858,8 +8834,7 @@ if (IsDPP8) { if (Op.isDPP8()) { Op.addImmOperands(Inst, 1); - } else if (HasModifiers && - isRegOrImmWithInputMods(Desc, Inst.getNumOperands())) { + } else if (isRegOrImmWithInputMods(Desc, Inst.getNumOperands())) { Op.addRegWithFPInputModsOperands(Inst, 2); } else if (Op.isFI()) { Fi = Op.getImm(); @@ -8869,8 +8844,7 @@ llvm_unreachable("Invalid operand type"); } } else { - if (HasModifiers && - isRegOrImmWithInputMods(Desc, Inst.getNumOperands())) { + if (isRegOrImmWithInputMods(Desc, Inst.getNumOperands())) { Op.addRegWithFPInputModsOperands(Inst, 2); } else if (Op.isReg()) { Op.addRegOperands(Inst, 1);