MC: Fix .octa output for APInts with BitWidth > 128
authorDavid Woodhouse <dwmw2@infradead.org>
Sat, 1 Feb 2014 16:52:33 +0000 (16:52 +0000)
committerDavid Woodhouse <dwmw2@infradead.org>
Sat, 1 Feb 2014 16:52:33 +0000 (16:52 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200615 91177308-0d34-0410-b5e6-96231b3b80d8

lib/MC/MCParser/AsmParser.cpp
test/MC/AsmParser/directive_values.s

index 37b759e64f52005d9aaa774006469cb250417479..63a00fedfa7f8a036818ee48224a8c4df3ba22ca 100644 (file)
@@ -2335,7 +2335,8 @@ bool AsmParser::parseDirectiveOctaValue() {
         hi = 0;
         lo = IntValue.getZExtValue();
       } else if (IntValue.isIntN(128)) {
-        hi = IntValue.getHiBits(64).getZExtValue();
+        // It might actually have more than 128 bits, but the top ones are zero.
+        hi = IntValue.getHiBits(IntValue.getBitWidth() - 64).getZExtValue();
         lo = IntValue.getLoBits(64).getZExtValue();
       } else
         return Error(ExprLoc, "literal value out of range for directive");
index c4aea51ca506ffad602c9dbcae9f1b5245425949..6941a1a59409da8348718e5699b33c4ea4ae63a3 100644 (file)
@@ -71,13 +71,13 @@ TEST8:
 # CHECK: .long 2097153
 
 TEST9:
-       .octa 0x1234567812345678abcdef, 12345678901234567890123456789
+       .octa 0x1234567812345678abcdef, 340282366920938463463374607431768211455
        .octa 0b00111010010110100101101001011010010110100101101001011010010110100101101001011010010110100101101001011010010110100101101001011010
 # CHECK: TEST9
 # CHECK: .quad 8652035380128501231
 # CHECK: .quad 1193046
-# CHECK: .quad 5097733592125636885
-# CHECK: .quad 669260594
+# CHECK: .quad -1
+# CHECK: .quad -1
 # CHECK: .quad 6510615555426900570
 # CHECK: .quad 4204772546213206618