From c8ae35a8e8a6a39ae05b1c876afbf404e20961ff Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 8 Sep 2010 05:51:12 +0000 Subject: add support for the commuted form of the test instruction, rdar://8018260. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113352 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/X86/AsmParser/X86AsmParser.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lib') diff --git a/lib/Target/X86/AsmParser/X86AsmParser.cpp b/lib/Target/X86/AsmParser/X86AsmParser.cpp index 90bd4e3d1b..7d62c466b2 100644 --- a/lib/Target/X86/AsmParser/X86AsmParser.cpp +++ b/lib/Target/X86/AsmParser/X86AsmParser.cpp @@ -856,6 +856,16 @@ ParseInstruction(StringRef Name, SMLoc NameLoc, std::swap(Operands[1], Operands[2]); } + // The assembler accepts "testX , " and "testX , " as + // synonyms. Our tables only have the ", " form, so if we see the + // other operand order, swap them. + if (Name == "testb" || Name == "testw" || Name == "testl" || Name == "testq") + if (Operands.size() == 3 && + static_cast(Operands[1])->isReg() && + static_cast(Operands[2])->isMem()) { + std::swap(Operands[1], Operands[2]); + } + return false; } -- cgit v1.2.3