mirror of
https://github.com/yasm/yasm
synced 2026-08-26 22:26:05 -04:00
Add support for IEEE-754r "half precision" (16-bit) float format.
This format is used by SSE5. Update minor tests; more extensive tests will be added soon. svn path=/trunk/yasm/; revision=1954
This commit is contained in:
parent
a1137cdf67
commit
1f6c405d98
5 changed files with 24 additions and 4 deletions
|
|
@ -631,7 +631,17 @@ floatnum_get_common(const yasm_floatnum *flt, /*@out@*/ unsigned char *ptr,
|
|||
return retval;
|
||||
}
|
||||
|
||||
/* IEEE-754 (Intel) "single precision" format:
|
||||
/* IEEE-754r "half precision" format:
|
||||
* 16 bits:
|
||||
* 15 9 Bit 0
|
||||
* | | |
|
||||
* seee eemm mmmm mmmm
|
||||
*
|
||||
* e = bias 15 exponent
|
||||
* s = sign bit
|
||||
* m = mantissa bits, bit 10 is an implied one bit.
|
||||
*
|
||||
* IEEE-754 (Intel) "single precision" format:
|
||||
* 32 bits:
|
||||
* Bit 31 Bit 22 Bit 0
|
||||
* | | |
|
||||
|
|
@ -672,6 +682,9 @@ yasm_floatnum_get_sized(const yasm_floatnum *flt, unsigned char *ptr,
|
|||
yasm_internal_error(N_("unsupported floatnum functionality"));
|
||||
}
|
||||
switch (destsize) {
|
||||
case 2:
|
||||
retval = floatnum_get_common(flt, ptr, 2, 10, 1, 5);
|
||||
break;
|
||||
case 4:
|
||||
retval = floatnum_get_common(flt, ptr, 4, 23, 1, 8);
|
||||
break;
|
||||
|
|
@ -702,6 +715,7 @@ int
|
|||
yasm_floatnum_check_size(/*@unused@*/ const yasm_floatnum *flt, size_t size)
|
||||
{
|
||||
switch (size) {
|
||||
case 16:
|
||||
case 32:
|
||||
case 64:
|
||||
case 80:
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
; Tests illegal float handling
|
||||
db 1.2
|
||||
dw 3.14
|
||||
dw 3.14e500
|
||||
dd 5.12e100000
|
||||
dq 3.141592653589793e-158105
|
||||
dt 5653894745.318293470142875104710284019245e-1999
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
-:2: invalid floating point constant size
|
||||
-:3: invalid floating point constant size
|
||||
-:3: warning: overflow in floating point expression
|
||||
-:4: warning: overflow in floating point expression
|
||||
-:5: warning: underflow in floating point expression
|
||||
-:8: invalid floating point constant size
|
||||
-:9: invalid floating point constant size
|
||||
-:9: warning: overflow in floating point expression
|
||||
-:11: warning: overflow in floating point expression
|
||||
-:12: warning: underflow in floating point expression
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
; Tests float handling
|
||||
dw 3.14
|
||||
dd 5.12
|
||||
dq 3.141592653589793
|
||||
dt 5653894745.318293470142875104710284019245e335
|
||||
|
||||
dw -62000.0
|
||||
dd -47102940.467103581
|
||||
dq -45102571092751092341095.5827509174509178450917845019
|
||||
dt -1.e-1000
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
48
|
||||
42
|
||||
0a
|
||||
d7
|
||||
a3
|
||||
|
|
@ -20,6 +22,8 @@ f1
|
|||
97
|
||||
78
|
||||
44
|
||||
92
|
||||
fb
|
||||
f7
|
||||
ae
|
||||
33
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue