From: Dmitry Preobrazhensky Date: Mon, 2 Sep 2019 14:19:52 +0000 (+0000) Subject: [AMDGPU][MC][GFX10] Corrected constant bus checks to exclude null X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bdaf3471d5becbf49043fce74a620950b337dc2a;p=llvm [AMDGPU][MC][GFX10] Corrected constant bus checks to exclude null See AMD SWDEV-157286 Reviewers: atamazov, arsenm Differential Revision: https://reviews.llvm.org/D65229 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370665 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp b/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp index 519f809cce6..b8e91d3f364 100644 --- a/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp +++ b/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp @@ -2657,7 +2657,6 @@ unsigned AMDGPUAsmParser::findImplicitSGPRReadInVOP(const MCInst &Inst) const { case AMDGPU::VCC_LO: case AMDGPU::VCC_HI: case AMDGPU::M0: - case AMDGPU::SGPR_NULL: return Reg; default: break; @@ -2731,9 +2730,13 @@ bool AMDGPUAsmParser::usesConstantBus(const MCInst &Inst, unsigned OpIdx) { const MCOperand &MO = Inst.getOperand(OpIdx); if (MO.isImm()) { return !isInlineConstant(Inst, OpIdx); + } else if (MO.isReg()) { + auto Reg = MO.getReg(); + const MCRegisterInfo *TRI = getContext().getRegisterInfo(); + return isSGPR(mc2PseudoReg(Reg), TRI) && Reg != SGPR_NULL; + } else { + return true; } - return !MO.isReg() || - isSGPR(mc2PseudoReg(MO.getReg()), getContext().getRegisterInfo()); } bool AMDGPUAsmParser::validateConstantBusLimitations(const MCInst &Inst) { diff --git a/test/MC/AMDGPU/gfx10-constant-bus.s b/test/MC/AMDGPU/gfx10-constant-bus.s index 685a7c04f0c..d2034ae1354 100644 --- a/test/MC/AMDGPU/gfx10-constant-bus.s +++ b/test/MC/AMDGPU/gfx10-constant-bus.s @@ -55,3 +55,9 @@ v_mad_u64_u32 v[5:6], s12, v1, 0x12345678, 0x12345678 v_mad_u64_u32 v[5:6], s12, s1, 0x12345678, 0x12345678 // GFX10-ERR: error: invalid operand (violates constant bus restrictions) + +//----------------------------------------------------------------------------------------- +// null is free + +v_bfe_u32 v5, s1, s2, null +// GFX10: v_bfe_u32 v5, s1, s2, null ; encoding: [0x05,0x00,0x48,0xd5,0x01,0x04,0xf4,0x01]