[llvm-commits] [llvm] r122557 - in /llvm/trunk: lib/MC/MCParser/AsmLexer.cpp test/MC/X86/x86-64.s

Chris Lattner sabre at nondot.org
Sat Dec 25 13:36:35 PST 2010


Author: lattner
Date: Sat Dec 25 15:36:35 2010
New Revision: 122557

URL: http://llvm.org/viewvc/llvm-project?rev=122557&view=rev
Log:
Generalize a previous change, fixing PR8855 - an valid large immediate
rejected by the mc assembler.

Modified:
    llvm/trunk/lib/MC/MCParser/AsmLexer.cpp
    llvm/trunk/test/MC/X86/x86-64.s

Modified: llvm/trunk/lib/MC/MCParser/AsmLexer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/AsmLexer.cpp?rev=122557&r1=122556&r2=122557&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCParser/AsmLexer.cpp (original)
+++ llvm/trunk/lib/MC/MCParser/AsmLexer.cpp Sat Dec 25 15:36:35 2010
@@ -184,12 +184,12 @@
 
     long long Value;
     if (Result.getAsInteger(10, Value)) {
-      // We have to handle minint_as_a_positive_value specially, because
-      // - minint_as_a_positive_value = minint and it is valid.
-      if (Result == "9223372036854775808")
-        Value = -9223372036854775808ULL;
-      else
-        return ReturnError(TokStart, "Invalid decimal number");
+      // Allow positive values that are too large to fit into a signed 64-bit
+      // integer, but that do fit in an unsigned one, we just convert them over.
+      unsigned long long UValue;
+      if (Result.getAsInteger(10, UValue))
+        return ReturnError(TokStart, "invalid decimal number");
+      Value = (long long)UValue;
     }
     
     // The darwin/x86 (and x86-64) assembler accepts and ignores ULL and LL

Modified: llvm/trunk/test/MC/X86/x86-64.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/X86/x86-64.s?rev=122557&r1=122556&r2=122557&view=diff
==============================================================================
--- llvm/trunk/test/MC/X86/x86-64.s (original)
+++ llvm/trunk/test/MC/X86/x86-64.s Sat Dec 25 15:36:35 2010
@@ -916,3 +916,7 @@
 
 rex64 // CHECK: rex64 # encoding: [0x48]
 data16 // CHECK: data16 # encoding: [0x66]
+
+// PR8855
+movq 18446744073709551615,%rbx   // CHECK: movq	-1, %rbx
+





More information about the llvm-commits mailing list