diff options
Diffstat (limited to 'llvm/lib/Target/X86/InstPrinter/X86IntelInstPrinter.cpp')
-rw-r--r-- | llvm/lib/Target/X86/InstPrinter/X86IntelInstPrinter.cpp | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/llvm/lib/Target/X86/InstPrinter/X86IntelInstPrinter.cpp b/llvm/lib/Target/X86/InstPrinter/X86IntelInstPrinter.cpp index 6c597166dbf..81a62e2b9f2 100644 --- a/llvm/lib/Target/X86/InstPrinter/X86IntelInstPrinter.cpp +++ b/llvm/lib/Target/X86/InstPrinter/X86IntelInstPrinter.cpp @@ -45,7 +45,8 @@ void X86IntelInstPrinter::printInst(const MCInst *MI, raw_ostream &OS, if (MI->getOpcode() == X86::DATA16_PREFIX && STI.getFeatureBits()[X86::Mode16Bit]) { OS << "\tdata32"; - } else if (!printAliasInstr(MI, OS)) + } else if (!printAliasInstr(MI, OS) && + !printVecCompareInstr(MI, OS)) printInstruction(MI, OS); // Next always print the annotation. @@ -56,6 +57,44 @@ void X86IntelInstPrinter::printInst(const MCInst *MI, raw_ostream &OS, EmitAnyX86InstComments(MI, *CommentStream, MII); } +bool X86IntelInstPrinter::printVecCompareInstr(const MCInst *MI, raw_ostream &OS) { + if (MI->getNumOperands() == 0 || + !MI->getOperand(MI->getNumOperands() - 1).isImm()) + return false; + + unsigned Imm = MI->getOperand(MI->getNumOperands() - 1).getImm(); + + const MCInstrDesc &Desc = MII.get(MI->getOpcode()); + + // Custom print the vector compare instructions to get the immediate + // translated into the mnemonic. + switch (MI->getOpcode()) { + case X86::VPCOMBmi: case X86::VPCOMBri: + case X86::VPCOMDmi: case X86::VPCOMDri: + case X86::VPCOMQmi: case X86::VPCOMQri: + case X86::VPCOMUBmi: case X86::VPCOMUBri: + case X86::VPCOMUDmi: case X86::VPCOMUDri: + case X86::VPCOMUQmi: case X86::VPCOMUQri: + case X86::VPCOMUWmi: case X86::VPCOMUWri: + case X86::VPCOMWmi: case X86::VPCOMWri: + if (Imm >= 0 && Imm <= 7) { + printVPCOMMnemonic(MI, OS); + printOperand(MI, 0, OS); + OS << ", "; + printOperand(MI, 1, OS); + OS << ", "; + if ((Desc.TSFlags & X86II::FormMask) == X86II::MRMSrcMem) + printi128mem(MI, 2, OS); + else + printOperand(MI, 2, OS); + return true; + } + break; + } + + return false; +} + void X86IntelInstPrinter::printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O) { const MCOperand &Op = MI->getOperand(OpNo); |