diff options
author | Chris Lattner <sabre@nondot.org> | 2010-09-08 05:51:12 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-09-08 05:51:12 +0000 |
commit | c8ae35a8e8a6a39ae05b1c876afbf404e20961ff (patch) | |
tree | 4c2db0e64e10822c84974334b2be0abd6fbeae56 /lib | |
parent | ba8e81cca281a92fe30c25a10d8990521128be39 (diff) | |
download | external_llvm-c8ae35a8e8a6a39ae05b1c876afbf404e20961ff.zip external_llvm-c8ae35a8e8a6a39ae05b1c876afbf404e20961ff.tar.gz external_llvm-c8ae35a8e8a6a39ae05b1c876afbf404e20961ff.tar.bz2 |
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
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Target/X86/AsmParser/X86AsmParser.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/Target/X86/AsmParser/X86AsmParser.cpp b/lib/Target/X86/AsmParser/X86AsmParser.cpp index 90bd4e3..7d62c46 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 <reg>, <mem>" and "testX <mem>, <reg>" as + // synonyms. Our tables only have the "<mem>, <reg>" 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<X86Operand*>(Operands[1])->isReg() && + static_cast<X86Operand*>(Operands[2])->isMem()) { + std::swap(Operands[1], Operands[2]); + } + return false; } |