summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/X86/AsmParser
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@gmail.com>2015-02-13 07:42:25 +0000
committerCraig Topper <craig.topper@gmail.com>2015-02-13 07:42:25 +0000
commit916708f1527bf9e18e9dfb29616293610b1f3003 (patch)
treeef1585f6b58ba115871d8135b70c5a7aef6de55f /llvm/lib/Target/X86/AsmParser
parente32546dd2988d9f2141da758725a55101201895c (diff)
downloadbcm5719-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.cpp27
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())
OpenPOWER on IntegriCloud