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

Daniel Dunbar daniel at zuster.org
Tue Aug 24 12:13:38 PDT 2010


Author: ddunbar
Date: Tue Aug 24 14:13:38 2010
New Revision: 111945

URL: http://llvm.org/viewvc/llvm-project?rev=111945&view=rev
Log:
MC/X86: Warn on scale factors > 1 without index register, instead of erroring,
for 'as' compatibility.

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=111945&r1=111944&r2=111945&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp Tue Aug 24 14:13:38 2010
@@ -588,7 +588,7 @@
         }
       }
     } else if (getLexer().isNot(AsmToken::RParen)) {
-      // Otherwise we have the unsupported form of a scale amount without an
+      // A scale amount without an index is ignored.
       // index.
       SMLoc Loc = Parser.getTok().getLoc();
 
@@ -596,8 +596,9 @@
       if (getParser().ParseAbsoluteExpression(Value))
         return 0;
 
-      Error(Loc, "cannot have scale factor without index register");
-      return 0;
+      if (Value != 1)
+        Warning(Loc, "scale factor without index register is ignored");
+      Scale = 1;
     }
   }
 

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=111945&r1=111944&r2=111945&view=diff
==============================================================================
--- llvm/trunk/test/MC/AsmParser/X86/x86_instructions.s (original)
+++ llvm/trunk/test/MC/AsmParser/X86/x86_instructions.s Tue Aug 24 14:13:38 2010
@@ -1,4 +1,6 @@
-// RUN: llvm-mc -triple x86_64-unknown-unknown %s | FileCheck %s
+// RUN: llvm-mc -triple x86_64-unknown-unknown %s > %t 2> %t.err
+// RUN: FileCheck < %t %s
+// RUN: FileCheck --check-prefix=CHECK-STDERR < %t.err %s
 
 // CHECK: subb %al, %al
         subb %al, %al
@@ -151,3 +153,8 @@
 // CHECK: int3
 INT3
 
+
+// Allow scale factor without index register.
+// CHECK: movaps	%xmm3, (%esi)
+// CHECK-STDERR: warning: scale factor without index register is ignored
+movaps %xmm3, (%esi, 2)





More information about the llvm-commits mailing list