summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-09-08 05:51:12 +0000
committerChris Lattner <sabre@nondot.org>2010-09-08 05:51:12 +0000
commitc8ae35a8e8a6a39ae05b1c876afbf404e20961ff (patch)
tree4c2db0e64e10822c84974334b2be0abd6fbeae56 /lib
parentba8e81cca281a92fe30c25a10d8990521128be39 (diff)
downloadllvm-c8ae35a8e8a6a39ae05b1c876afbf404e20961ff.tar.gz
llvm-c8ae35a8e8a6a39ae05b1c876afbf404e20961ff.tar.bz2
llvm-c8ae35a8e8a6a39ae05b1c876afbf404e20961ff.tar.xz
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.cpp10
1 files changed, 10 insertions, 0 deletions
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 <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;
}