Skip to content

Commit d159dd0

Browse files
committed
softfloat,m68k: disable floatx80_invalid_encoding() for m68k
According to the comment, this definition of invalid encoding is given by intel developer's manual, and doesn't comply with 680x0 FPU. With m68k, the explicit integer bit can be zero in the case of: - zeros (exp == 0, mantissa == 0) - denormalized numbers (exp == 0, mantissa != 0) - unnormalized numbers (exp != 0, exp < 0x7FFF) - infinities (exp == 0x7FFF, mantissa == 0) - not-a-numbers (exp == 0x7FFF, mantissa != 0) For infinities and NaNs, the explicit integer bit can be either one or zero. The IEEE 754 standard does not define a zero integer bit. Such a number is an unnormalized number. Hardware does not directly support denormalized and unnormalized numbers, but implicitly supports them by trapping them as unimplemented data types, allowing efficient conversion in software. See "M68000 FAMILY PROGRAMMER’S REFERENCE MANUAL", "1.6 FLOATING-POINT DATA TYPES" We will implement in the m68k TCG emulator the FP_UNIMP exception to trap into the kernel to normalize the number. In case of linux-user, the number will be normalized by QEMU. Signed-off-by: Laurent Vivier <[email protected]> Reviewed-by: Alex Bennée <[email protected]> Message-Id: <[email protected]>
1 parent 852002b commit d159dd0

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

include/fpu/softfloat.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,31 @@ static inline bool floatx80_unordered_quiet(floatx80 a, floatx80 b,
794794
*----------------------------------------------------------------------------*/
795795
static inline bool floatx80_invalid_encoding(floatx80 a)
796796
{
797+
#if defined(TARGET_M68K)
798+
/*-------------------------------------------------------------------------
799+
| With m68k, the explicit integer bit can be zero in the case of:
800+
| - zeros (exp == 0, mantissa == 0)
801+
| - denormalized numbers (exp == 0, mantissa != 0)
802+
| - unnormalized numbers (exp != 0, exp < 0x7FFF)
803+
| - infinities (exp == 0x7FFF, mantissa == 0)
804+
| - not-a-numbers (exp == 0x7FFF, mantissa != 0)
805+
|
806+
| For infinities and NaNs, the explicit integer bit can be either one or
807+
| zero.
808+
|
809+
| The IEEE 754 standard does not define a zero integer bit. Such a number
810+
| is an unnormalized number. Hardware does not directly support
811+
| denormalized and unnormalized numbers, but implicitly supports them by
812+
| trapping them as unimplemented data types, allowing efficient conversion
813+
| in software.
814+
|
815+
| See "M68000 FAMILY PROGRAMMER’S REFERENCE MANUAL",
816+
| "1.6 FLOATING-POINT DATA TYPES"
817+
*------------------------------------------------------------------------*/
818+
return false;
819+
#else
797820
return (a.low & (1ULL << 63)) == 0 && (a.high & 0x7FFF) != 0;
821+
#endif
798822
}
799823

800824
#define floatx80_zero make_floatx80(0x0000, 0x0000000000000000LL)

0 commit comments

Comments
 (0)