aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-12-25 21:36:35 +0000
committerChris Lattner <sabre@nondot.org>2010-12-25 21:36:35 +0000
commit7ab3cc32d6bd3c3166184e27713c91f5317c7f85 (patch)
treed192461826ec03f463b93c9a02a0325a2f606dc3
parentae47be1ea023e4b1e6bbbdc4687333eea54c84c8 (diff)
Generalize a previous change, fixing PR8855 - an valid large immediate
rejected by the mc assembler. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122557 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/MC/MCParser/AsmLexer.cpp12
-rw-r--r--test/MC/X86/x86-64.s4
2 files changed, 10 insertions, 6 deletions
diff --git a/lib/MC/MCParser/AsmLexer.cpp b/lib/MC/MCParser/AsmLexer.cpp
index e474a1501c..5c617bc93d 100644
--- a/lib/MC/MCParser/AsmLexer.cpp
+++ b/lib/MC/MCParser/AsmLexer.cpp
@@ -184,12 +184,12 @@ AsmToken AsmLexer::LexDigit() {
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
diff --git a/test/MC/X86/x86-64.s b/test/MC/X86/x86-64.s
index a285c6f645..5375919d55 100644
--- a/test/MC/X86/x86-64.s
+++ b/test/MC/X86/x86-64.s
@@ -916,3 +916,7 @@ movq %mm5, %rbx // CHECK: movd %mm5, %rbx # encoding: [0x48,0x0f,0x7e,0xeb]
rex64 // CHECK: rex64 # encoding: [0x48]
data16 // CHECK: data16 # encoding: [0x66]
+
+// PR8855
+movq 18446744073709551615,%rbx // CHECK: movq -1, %rbx
+