Skip to content

Commit

Permalink
[X86] Add assembler support for {vex} prefix to match GNU as.
Browse files Browse the repository at this point in the history
This does the same thing as {vex2}. Which is give an error
if the instruction can't be done with VEX. It doesn't force
the instruction to use 2 byte VEX. That's already the preference
if its possible. Therefore {vex} is a clearer name.
  • Loading branch information
topperc committed May 8, 2020
1 parent aa2ddfc commit adf3b8e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 4 additions & 4 deletions llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
Expand Up @@ -74,7 +74,7 @@ class X86AsmParser : public MCTargetAsmParser {

enum VEXEncoding {
VEXEncoding_Default,
VEXEncoding_VEX2,
VEXEncoding_VEX,
VEXEncoding_VEX3,
VEXEncoding_EVEX,
};
Expand Down Expand Up @@ -2473,8 +2473,8 @@ bool X86AsmParser::ParseInstruction(ParseInstructionInfo &Info, StringRef Name,
return Error(Parser.getTok().getLoc(), "Expected '}'");
Parser.Lex(); // Eat curly.

if (Prefix == "vex2")
ForcedVEXEncoding = VEXEncoding_VEX2;
if (Prefix == "vex" || Prefix == "vex2")
ForcedVEXEncoding = VEXEncoding_VEX;
else if (Prefix == "vex3")
ForcedVEXEncoding = VEXEncoding_VEX3;
else if (Prefix == "evex")
Expand Down Expand Up @@ -3223,7 +3223,7 @@ unsigned X86AsmParser::checkTargetMatchPredicate(MCInst &Inst) {
(MCID.TSFlags & X86II::EncodingMask) != X86II::EVEX)
return Match_Unsupported;

if ((ForcedVEXEncoding == VEXEncoding_VEX2 ||
if ((ForcedVEXEncoding == VEXEncoding_VEX ||
ForcedVEXEncoding == VEXEncoding_VEX3) &&
(MCID.TSFlags & X86II::EncodingMask) != X86II::VEX)
return Match_Unsupported;
Expand Down
4 changes: 4 additions & 0 deletions llvm/test/MC/X86/x86_errors.s
Expand Up @@ -168,6 +168,10 @@ cltq
// 32: error: instruction requires: 64-bit mode
cmpxchg16b (%eax)

// 32: error: unsupported instruction
// 64: error: unsupported instruction
{vex} vmovdqu32 %xmm0, %xmm0

// 32: error: unsupported instruction
// 64: error: unsupported instruction
{vex2} vmovdqu32 %xmm0, %xmm0
Expand Down

0 comments on commit adf3b8e

Please sign in to comment.