diff options
| author | Stanislav Mekhanoshin <Stanislav.Mekhanoshin@amd.com> | 2019-04-26 23:16:16 +0000 |
|---|---|---|
| committer | Stanislav Mekhanoshin <Stanislav.Mekhanoshin@amd.com> | 2019-04-26 23:16:16 +0000 |
| commit | 4f331cb1f31ed122ffdc66208b7911c5e8bfb587 (patch) | |
| tree | 22eb2e7ae020b807d5214d459a9be437e32119b8 /llvm/lib/Target/AMDGPU/InstPrinter | |
| parent | a9fdf375b3769a1df18d72aa6eb1e627a22a29e7 (diff) | |
| download | bcm5719-llvm-4f331cb1f31ed122ffdc66208b7911c5e8bfb587.tar.gz bcm5719-llvm-4f331cb1f31ed122ffdc66208b7911c5e8bfb587.zip | |
[AMDGPU] gfx1010 VOPC implementation
Differential Revision: https://reviews.llvm.org/D61208
llvm-svn: 359358
Diffstat (limited to 'llvm/lib/Target/AMDGPU/InstPrinter')
| -rw-r--r-- | llvm/lib/Target/AMDGPU/InstPrinter/AMDGPUInstPrinter.cpp | 76 | ||||
| -rw-r--r-- | llvm/lib/Target/AMDGPU/InstPrinter/AMDGPUInstPrinter.h | 2 |
2 files changed, 69 insertions, 9 deletions
diff --git a/llvm/lib/Target/AMDGPU/InstPrinter/AMDGPUInstPrinter.cpp b/llvm/lib/Target/AMDGPU/InstPrinter/AMDGPUInstPrinter.cpp index d511f59cb3a..1ed9129e3bc 100644 --- a/llvm/lib/Target/AMDGPU/InstPrinter/AMDGPUInstPrinter.cpp +++ b/llvm/lib/Target/AMDGPU/InstPrinter/AMDGPUInstPrinter.cpp @@ -393,16 +393,31 @@ void AMDGPUInstPrinter::printRegOperand(unsigned RegNo, raw_ostream &O, void AMDGPUInstPrinter::printVOPDst(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O) { - if (MII.get(MI->getOpcode()).TSFlags & SIInstrFlags::VOP3) - O << "_e64 "; - else if (MII.get(MI->getOpcode()).TSFlags & SIInstrFlags::DPP) - O << "_dpp "; - else if (MII.get(MI->getOpcode()).TSFlags & SIInstrFlags::SDWA) - O << "_sdwa "; - else - O << "_e32 "; + if (OpNo == 0) { + if (MII.get(MI->getOpcode()).TSFlags & SIInstrFlags::VOP3) + O << "_e64 "; + else if (MII.get(MI->getOpcode()).TSFlags & SIInstrFlags::DPP) + O << "_dpp "; + else if (MII.get(MI->getOpcode()).TSFlags & SIInstrFlags::SDWA) + O << "_sdwa "; + else + O << "_e32 "; + } printOperand(MI, OpNo, STI, O); + + switch (MI->getOpcode()) { + default: break; + + case AMDGPU::V_ADD_CO_CI_U32_e32_gfx10: + case AMDGPU::V_SUB_CO_CI_U32_e32_gfx10: + case AMDGPU::V_SUBREV_CO_CI_U32_e32_gfx10: + case AMDGPU::V_ADD_CO_CI_U32_sdwa_gfx10: + case AMDGPU::V_SUB_CO_CI_U32_sdwa_gfx10: + case AMDGPU::V_SUBREV_CO_CI_U32_sdwa_gfx10: + printDefaultVccOperand(1, STI, O); + break; + } } void AMDGPUInstPrinter::printVINTRPDst(const MCInst *MI, unsigned OpNo, @@ -527,9 +542,25 @@ void AMDGPUInstPrinter::printImmediate64(uint64_t Imm, } } +void AMDGPUInstPrinter::printDefaultVccOperand(unsigned OpNo, + const MCSubtargetInfo &STI, + raw_ostream &O) { + if (OpNo > 0) + O << ", "; + printRegOperand(AMDGPU::VCC, O, MRI); + if (OpNo == 0) + O << ", "; +} + void AMDGPUInstPrinter::printOperand(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O) { + const MCInstrDesc &Desc = MII.get(MI->getOpcode()); + if (OpNo == 0 && (Desc.TSFlags & SIInstrFlags::VOPC) && + (Desc.hasImplicitDefOfPhysReg(AMDGPU::VCC) || + Desc.hasImplicitDefOfPhysReg(AMDGPU::VCC_LO))) + printDefaultVccOperand(OpNo, STI, O); + if (OpNo >= MI->getNumOperands()) { O << "/*Missing OP" << OpNo << "*/"; return; @@ -539,7 +570,6 @@ void AMDGPUInstPrinter::printOperand(const MCInst *MI, unsigned OpNo, if (Op.isReg()) { printRegOperand(Op.getReg(), O, MRI); } else if (Op.isImm()) { - const MCInstrDesc &Desc = MII.get(MI->getOpcode()); switch (Desc.OpInfo[OpNo].OperandType) { case AMDGPU::OPERAND_REG_IMM_INT32: case AMDGPU::OPERAND_REG_IMM_FP32: @@ -599,6 +629,22 @@ void AMDGPUInstPrinter::printOperand(const MCInst *MI, unsigned OpNo, } else { O << "/*INV_OP*/"; } + + switch (MI->getOpcode()) { + default: break; + + case AMDGPU::V_CNDMASK_B32_e32_gfx10: + case AMDGPU::V_ADD_CO_CI_U32_e32_gfx10: + case AMDGPU::V_SUB_CO_CI_U32_e32_gfx10: + case AMDGPU::V_SUBREV_CO_CI_U32_e32_gfx10: + + case AMDGPU::V_CNDMASK_B32_e32_gfx6_gfx7: + case AMDGPU::V_CNDMASK_B32_e32_vi: + if ((int)OpNo == AMDGPU::getNamedOperandIdx(MI->getOpcode(), + AMDGPU::OpName::src1)) + printDefaultVccOperand(OpNo, STI, O); + break; + } } void AMDGPUInstPrinter::printOperandAndFPInputMods(const MCInst *MI, @@ -646,6 +692,18 @@ void AMDGPUInstPrinter::printOperandAndIntInputMods(const MCInst *MI, printOperand(MI, OpNo + 1, STI, O); if (InputModifiers & SISrcMods::SEXT) O << ')'; + + switch (MI->getOpcode()) { + default: break; + + case AMDGPU::V_ADD_CO_CI_U32_sdwa_gfx10: + case AMDGPU::V_SUB_CO_CI_U32_sdwa_gfx10: + case AMDGPU::V_SUBREV_CO_CI_U32_sdwa_gfx10: + if ((int)OpNo + 1 == AMDGPU::getNamedOperandIdx(MI->getOpcode(), + AMDGPU::OpName::src1)) + printDefaultVccOperand(OpNo, STI, O); + break; + } } void AMDGPUInstPrinter::printDPPCtrl(const MCInst *MI, unsigned OpNo, diff --git a/llvm/lib/Target/AMDGPU/InstPrinter/AMDGPUInstPrinter.h b/llvm/lib/Target/AMDGPU/InstPrinter/AMDGPUInstPrinter.h index 084350c3f67..5f5a7fe5c16 100644 --- a/llvm/lib/Target/AMDGPU/InstPrinter/AMDGPUInstPrinter.h +++ b/llvm/lib/Target/AMDGPU/InstPrinter/AMDGPUInstPrinter.h @@ -149,6 +149,8 @@ private: const MCSubtargetInfo &STI, raw_ostream &O); void printMemOperand(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O); + void printDefaultVccOperand(unsigned OpNo, const MCSubtargetInfo &STI, + raw_ostream &O); template <unsigned N> |

