diff options
| author | Craig Topper <craig.topper@gmail.com> | 2015-02-13 07:42:25 +0000 |
|---|---|---|
| committer | Craig Topper <craig.topper@gmail.com> | 2015-02-13 07:42:25 +0000 |
| commit | 916708f1527bf9e18e9dfb29616293610b1f3003 (patch) | |
| tree | ef1585f6b58ba115871d8135b70c5a7aef6de55f /llvm/lib/Target/X86/AsmParser | |
| parent | e32546dd2988d9f2141da758725a55101201895c (diff) | |
| download | bcm5719-llvm-916708f1527bf9e18e9dfb29616293610b1f3003.tar.gz bcm5719-llvm-916708f1527bf9e18e9dfb29616293610b1f3003.zip | |
[X86] Add support for parsing and printing the mnemonic aliases for the XOP VPCOM instructions.
llvm-svn: 229078
Diffstat (limited to 'llvm/lib/Target/X86/AsmParser')
| -rw-r--r-- | llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp index 9f17ca07424..2517a6c79d7 100644 --- a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp +++ b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp @@ -2022,6 +2022,33 @@ bool X86AsmParser::ParseInstruction(ParseInstructionInfo &Info, StringRef Name, } } + // FIXME: Hack to recognize vpcom<comparison code>{ub,uw,ud,uq,b,w,d,q}. + if (PatchedName.startswith("vpcom") && + (PatchedName.endswith("b") || PatchedName.endswith("w") || + PatchedName.endswith("d") || PatchedName.endswith("q"))) { + unsigned XOPIdx = PatchedName.drop_back().endswith("u") ? 2 : 1; + unsigned XOPComparisonCode = StringSwitch<unsigned>( + PatchedName.slice(5, PatchedName.size() - XOPIdx)) + .Case("lt", 0x0) + .Case("le", 0x1) + .Case("gt", 0x2) + .Case("ge", 0x3) + .Case("eq", 0x4) + .Case("neq", 0x5) + .Case("false", 0x6) + .Case("true", 0x7) + .Default(~0U); + if (XOPComparisonCode != ~0U) { + Operands.push_back(X86Operand::CreateToken("vpcom", NameLoc)); + + const MCExpr *ImmOp = MCConstantExpr::Create(XOPComparisonCode, + getParser().getContext()); + Operands.push_back(X86Operand::CreateImm(ImmOp, NameLoc, NameLoc)); + + PatchedName = PatchedName.substr(PatchedName.size() - XOPIdx); + } + } + Operands.push_back(X86Operand::CreateToken(PatchedName, NameLoc)); if (ExtraImmOp && !isParsingIntelSyntax()) |

