summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2007-10-29 20:20:12 -0700
committerH. Peter Anvin <hpa@zytor.com>2007-10-29 20:20:12 -0700
commit2ce0274303000c95f5f503f1fb0db86fd108b06e (patch)
treeac275b173a622172cac59dec5c1c374463cb9d2b /test
parent052c0bd4843e9222711bec40093ce294d0e32540 (diff)
downloadnasm-2ce0274303000c95f5f503f1fb0db86fd108b06e.tar.gz
nasm-2ce0274303000c95f5f503f1fb0db86fd108b06e.tar.bz2
nasm-2ce0274303000c95f5f503f1fb0db86fd108b06e.zip
Use a 32-bit floating-point limb size; support 8-bit float
Use a 32-bit limb size ("like a digit, but bigger") for floating-point conversion. This cuts the number of multiplications per constant by a factor of four. This means supporting fractional-limb-sized numbers, so while we're at it, add support for 8-bit floating point numbers (apparently used in graphics and in audio compression applications.)
Diffstat (limited to 'test')
-rw-r--r--test/float.asm37
-rw-r--r--test/floatexp.asm26
2 files changed, 62 insertions, 1 deletions
diff --git a/test/float.asm b/test/float.asm
index 759b61c..df2d96c 100644
--- a/test/float.asm
+++ b/test/float.asm
@@ -2,6 +2,36 @@
; Test of floating-point formats
;
+; 8-bit
+ db 1.0
+ db +1.0
+ db -1.0
+ db 1.5
+ db +1.5
+ db -1.5
+ db 0.0
+ db +0.0
+ db -0.0
+ db 1.83203125
+ db +1.83203125
+ db -1.83203125
+ db 1.83203125e1
+ db +1.83203125e1
+ db -1.83203125e1
+ db 1.83203125e-1
+ db +1.83203125e-1
+ db -1.83203125e-1
+ db 1.13203125e-2 ; Denormal!
+ db +1.13203125e-2 ; Denormal!
+ db -1.13203125e-2 ; Denormal!
+ db __Infinity__
+ db +__Infinity__
+ db -__Infinity__
+ db __NaN__
+ db __QNaN__
+ db __SNaN__
+ db 3.1415926535_8979323846_2643383279_5028841971_6939937510_5
+
; 16-bit
dw 1.0
dw +1.0
@@ -30,6 +60,7 @@
dw __NaN__
dw __QNaN__
dw __SNaN__
+ dw 3.1415926535_8979323846_2643383279_5028841971_6939937510_5
; 32-bit
dd 1.0
@@ -59,6 +90,7 @@
dd __NaN__
dd __QNaN__
dd __SNaN__
+ dd 3.1415926535_8979323846_2643383279_5028841971_6939937510_5
; 64-bit
dq 1.0
@@ -88,7 +120,8 @@
dq __NaN__
dq __QNaN__
dq __SNaN__
-
+ dq 3.1415926535_8979323846_2643383279_5028841971_6939937510_5
+
; 80-bit
dt 1.0
dt +1.0
@@ -117,6 +150,7 @@
dt __NaN__
dt __QNaN__
dt __SNaN__
+ dt 3.1415926535_8979323846_2643383279_5028841971_6939937510_5
; 128-bit
do 1.0
@@ -146,3 +180,4 @@
do __NaN__
do __QNaN__
do __SNaN__
+ do 3.1415926535_8979323846_2643383279_5028841971_6939937510_5
diff --git a/test/floatexp.asm b/test/floatexp.asm
index 7e6a01c..b3d14f7 100644
--- a/test/floatexp.asm
+++ b/test/floatexp.asm
@@ -3,6 +3,32 @@
; Test of floating-point formats
;
+; 8-bit
+ mov al,__float8__(1.0)
+ mov al,__float8__(+1.0)
+ mov al,__float8__(-1.0)
+ mov al,__float8__(0.0)
+ mov al,__float8__(+0.0)
+ mov al,__float8__(-0.0)
+ mov al,__float8__(1.83203125)
+ mov al,__float8__(+1.83203125)
+ mov al,__float8__(-1.83203125)
+ mov al,__float8__(1.83203125e1)
+ mov al,__float8__(+1.83203125e1)
+ mov al,__float8__(-1.83203125e1)
+ mov al,__float8__(1.83203125e-1)
+ mov al,__float8__(+1.83203125e-1)
+ mov al,__float8__(-1.83203125e-1)
+ mov al,__float8__(1.13203125e-2) ; Denormal!
+ mov al,__float8__(+1.13203125e-2) ; Denormal!
+ mov al,__float8__(-1.13203125e-2) ; Denormal!
+ mov al,__float8__(__Infinity__)
+ mov al,__float8__(+__Infinity__)
+ mov al,__float8__(-__Infinity__)
+ mov al,__float8__(__NaN__)
+ mov al,__float8__(__QNaN__)
+ mov al,__float8__(__SNaN__)
+
; 16-bit
mov ax,__float16__(1.0)
mov ax,__float16__(+1.0)