fix rdar://8407548, I missed the commuted form of xchg/test without a suffix.
authorChris Lattner <sabre@nondot.org>
Wed, 8 Sep 2010 22:27:05 +0000 (22:27 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 8 Sep 2010 22:27:05 +0000 (22:27 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113427 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/AsmParser/X86AsmParser.cpp
test/MC/AsmParser/X86/x86_64-new-encoder.s

index 9a43913b7c087b0b79bd081982dfc282220723ad..7e9dacf776003ca51b3a3f4b6d2e7cf6bb446478 100644 (file)
@@ -850,7 +850,8 @@ ParseInstruction(StringRef Name, SMLoc NameLoc,
   // The assembler accepts "xchgX <reg>, <mem>" and "xchgX <mem>, <reg>" as
   // synonyms.  Our tables only have the "<reg>, <mem>" form, so if we see the
   // other operand order, swap them.
-  if (Name == "xchgb" || Name == "xchgw" || Name == "xchgl" || Name == "xchgq")
+  if (Name == "xchgb" || Name == "xchgw" || Name == "xchgl" || Name == "xchgq"||
+      Name == "xchg")
     if (Operands.size() == 3 &&
         static_cast<X86Operand*>(Operands[1])->isMem() &&
         static_cast<X86Operand*>(Operands[2])->isReg()) {
@@ -860,7 +861,8 @@ ParseInstruction(StringRef Name, SMLoc NameLoc,
   // 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 (Name == "testb" || Name == "testw" || Name == "testl" || Name == "testq"||
+      Name == "test")
     if (Operands.size() == 3 &&
         static_cast<X86Operand*>(Operands[1])->isReg() &&
         static_cast<X86Operand*>(Operands[2])->isMem()) {
index e23c22478ca5eb8529cd431531a3693267d39b52..86619521fdc8f4c2b922cc452d1dea5759d1b501 100644 (file)
@@ -174,6 +174,12 @@ xchgl   368(%rax),%ecx
 xchgl   %ecx, 368(%rax)
 // CHECK: xchgl        %ecx, 368(%rax)
 
+// rdar://8407548
+xchg   0xdeadbeef(%rbx,%rcx,8),%bl
+// CHECK: xchgb        %bl, 3735928559(%rbx,%rcx,8)
+
+
+
 // PR7254
 lock  incl 1(%rsp)
 // CHECK: lock