summaryrefslogtreecommitdiff
path: root/test/MC/AsmParser
diff options
context:
space:
mode:
authorTim Northover <tnorthover@apple.com>2013-08-14 14:23:31 +0000
committerTim Northover <tnorthover@apple.com>2013-08-14 14:23:31 +0000
commit337439d12d2e2a9e820e0aeee261bbdb935fc0a5 (patch)
tree605c854f4db448fa58f7d806c204947745dbfe60 /test/MC/AsmParser
parent79663c1910ebf9bda8f758388eaa3171fb9a5134 (diff)
Support C99 hexadecimal floating-point literals in assembly
It's useful to be able to write down floating-point numbers without having to worry about what they'll be rounded to (as C99 discovered), this extends that ability to the MC assembly parsers. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188370 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/MC/AsmParser')
-rw-r--r--test/MC/AsmParser/floating-literals.s37
1 files changed, 36 insertions, 1 deletions
diff --git a/test/MC/AsmParser/floating-literals.s b/test/MC/AsmParser/floating-literals.s
index d44bb9830c0..512b7b36207 100644
--- a/test/MC/AsmParser/floating-literals.s
+++ b/test/MC/AsmParser/floating-literals.s
@@ -1,4 +1,5 @@
-# RUN: llvm-mc -triple i386-unknown-unknown %s | FileCheck %s
+# RUN: not llvm-mc -triple i386-unknown-unknown %s 2> /dev/null | FileCheck %s
+# RUN: not llvm-mc -triple i386-unknown-unknown %s 2>&1 > /dev/null| FileCheck %s --check-prefix=CHECK-ERROR
# CHECK: .long 1067412619
# CHECK: .long 1075000115
@@ -42,3 +43,37 @@
// APFloat should reject these with an error, not crash:
//.double -1.2e+
//.double -1.2e
+
+# CHECK: .long 1310177520
+.float 0x12f7.1ep+17
+# CHECK: .long 1084227584
+.float 0x.ap+3
+# CHECK: .quad 4602678819172646912
+.double 0x2.p-2
+# CHECK: .long 1094713344
+.float 0x3p2
+# CHECK: .long 872284160
+.float 0x7fp-30
+# CHECK: .long 3212836864
+.float -0x1.0p0
+
+# CHECK-ERROR: invalid hexadecimal floating-point constant: expected at least one exponent digit
+# CHECK-ERROR: unexpected token in directive
+.float 0xa.apa
+
+# CHECK-ERROR: invalid hexadecimal floating-point constant: expected at least one exponent digit
+# CHECK-ERROR: unexpected token in directive
+.double -0x1.2p+
+
+# CHECK-ERROR: invalid hexadecimal floating-point constant: expected at least one exponent digit
+# CHECK-ERROR: unexpected token in directive
+.double -0x1.2p
+
+# CHECK-ERROR: invalid hexadecimal floating-point constant: expected at least one significand digit
+# CHECK-ERROR: unexpected token in directive
+.float 0xp2
+
+# CHECK-ERROR: invalid hexadecimal floating-point constant: expected at least one significand digit
+# CHECK-ERROR: unexpected token in directive
+.float 0x.p5
+