[llvm-commits] [llvm] r113936 - in /llvm/trunk: lib/Target/X86/AsmParser/X86AsmParser.cpp test/MC/AsmParser/X86/x86_instructions.s

Chris Lattner sabre at nondot.org
Tue Sep 14 21:33:27 PDT 2010


Author: lattner
Date: Tue Sep 14 23:33:27 2010
New Revision: 113936

URL: http://llvm.org/viewvc/llvm-project?rev=113936&view=rev
Log:
fix rdar://8431880 - rcl/rcr with no shift amount not recognized

Modified:
    llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
    llvm/trunk/test/MC/AsmParser/X86/x86_instructions.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=113936&r1=113935&r2=113936&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp Tue Sep 14 23:33:27 2010
@@ -813,7 +813,7 @@
   if (getLexer().is(AsmToken::EndOfStatement))
     Parser.Lex(); // Consume the EndOfStatement
 
-  // FIXME: Hack to handle recognize s{hr,ar,hl} <op>, $1.  Canonicalize to
+  // FIXME: Hack to handle recognize s{hr,ar,hl} $1, <op>.  Canonicalize to
   // "shift <op>".
   if ((Name.startswith("shr") || Name.startswith("sar") ||
        Name.startswith("shl")) &&
@@ -825,6 +825,14 @@
       Operands.erase(Operands.begin() + 1);
     }
   }
+  
+  // FIXME: Hack to handle recognize "rc[lr] <op>" -> "rcl $1, <op>".
+  if ((Name.startswith("rcl") || Name.startswith("rcr")) &&
+      Operands.size() == 2) {
+    const MCExpr *One = MCConstantExpr::Create(1, getParser().getContext());
+    Operands.push_back(X86Operand::CreateImm(One, NameLoc, NameLoc));
+    std::swap(Operands[1], Operands[2]);
+  }
 
   // FIXME: Hack to handle recognize "in[bwl] <op>".  Canonicalize it to
   // "inb <op>, %al".

Modified: llvm/trunk/test/MC/AsmParser/X86/x86_instructions.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/X86/x86_instructions.s?rev=113936&r1=113935&r2=113936&view=diff
==============================================================================
--- llvm/trunk/test/MC/AsmParser/X86/x86_instructions.s (original)
+++ llvm/trunk/test/MC/AsmParser/X86/x86_instructions.s Tue Sep 14 23:33:27 2010
@@ -257,3 +257,14 @@
 fnstsw %ax
 fnstsw %eax
 fnstsw %al
+
+// rdar://8431880
+// CHECK: rclb	$1, %bl
+// CHECK: rcll	$1, 3735928559(%ebx,%ecx,8)
+// CHECK: rcrl	$1, %ecx
+// CHECK: rcrl	$1, 305419896
+
+rcl	%bl
+rcll	0xdeadbeef(%ebx,%ecx,8)
+rcr	%ecx
+rcrl	0x12345678





More information about the llvm-commits mailing list