[llvm-commits] [llvm] r113352 - in /llvm/trunk: lib/Target/X86/AsmParser/X86AsmParser.cpp test/MC/AsmParser/X86/x86_32-new-encoder.s
Chris Lattner
sabre at nondot.org
Tue Sep 7 22:51:13 PDT 2010
Author: lattner
Date: Wed Sep 8 00:51:12 2010
New Revision: 113352
URL: http://llvm.org/viewvc/llvm-project?rev=113352&view=rev
Log:
add support for the commuted form of the test instruction, rdar://8018260.
Modified:
llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
llvm/trunk/test/MC/AsmParser/X86/x86_32-new-encoder.s
Modified: llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp?rev=113352&r1=113351&r2=113352&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp Wed Sep 8 00:51:12 2010
@@ -856,6 +856,16 @@
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;
}
Modified: llvm/trunk/test/MC/AsmParser/X86/x86_32-new-encoder.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/X86/x86_32-new-encoder.s?rev=113352&r1=113351&r2=113352&view=diff
==============================================================================
--- llvm/trunk/test/MC/AsmParser/X86/x86_32-new-encoder.s (original)
+++ llvm/trunk/test/MC/AsmParser/X86/x86_32-new-encoder.s Wed Sep 8 00:51:12 2010
@@ -452,3 +452,10 @@
sysretl
// CHECK: sysretl
// CHECK: encoding: [0x0f,0x07]
+
+// rdar://8018260
+testl %ecx, -24(%ebp)
+// CHECK: testl -24(%ebp), %ecx
+testl -24(%ebp), %ecx
+// CHECK: testl -24(%ebp), %ecx
+
More information about the llvm-commits
mailing list