From patchwork Tue Feb 7 00:59:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 724829 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vHQz55hT3z9s2P for ; Tue, 7 Feb 2017 12:01:53 +1100 (AEDT) Received: from localhost ([::1]:51330 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cauAH-00060c-MB for incoming@patchwork.ozlabs.org; Mon, 06 Feb 2017 20:01:49 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32861) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cau8U-0004jd-LA for qemu-devel@nongnu.org; Mon, 06 Feb 2017 19:59:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cau8P-0005uv-V3 for qemu-devel@nongnu.org; Mon, 06 Feb 2017 19:59:58 -0500 Received: from mout.kundenserver.de ([212.227.126.130]:63507) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cau8P-0005uV-KV for qemu-devel@nongnu.org; Mon, 06 Feb 2017 19:59:53 -0500 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue004 [212.227.15.167]) with ESMTPSA (Nemesis) id 0MBo5j-1cl77w0g6B-00AoLs; Tue, 07 Feb 2017 01:59:35 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Tue, 7 Feb 2017 01:59:16 +0100 Message-Id: <20170207005930.28327-3-laurent@vivier.eu> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170207005930.28327-1-laurent@vivier.eu> References: <20170207005930.28327-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K0:f4DPurCb6YceEJ0pSb0GPaqfVC1rf/pkN7iZkI7NdnU2H6x5tec ufTJq77w3RSddapb1HI9lGhwRtr+P+3irhEskIKnxOyg6IeVojDZwL9qNbXDarcZAgTeNlb ofe0AdfyLVRKQDQ24KxB2iXtlUuvzvqHUdYdVkkDFglG4hm/m9HvmE3YPAfxx1aIptB+24j /Q8746w3W+5wx8ylcozAA== X-UI-Out-Filterresults: notjunk:1; V01:K0:uKwl7rFQUEo=:v00A1KW66PDTc5ui3JAVYh VktT5KJT3OnSumqD2njYEkxvRtFkTBKFAJpx5v739CrCLCiEHB1ZrMf5rwe+hUiYe6KB1R0Jl w+xxXfu8aFI5RHyJ7f7wXCOJUVEqhbLEJ+kqwL4u7tqu5R3CLsafScmeIZBF91ybPRc7WCtz7 5mARtZfrJEciXaeNl7iOqlbchAEHx4aWXlG2W1yOxfjiLCVyZfm2iVVcmZShKwzVZpMAZ+9rS IkaeLMYmFX6cCAsVXdv3NUJmXamdej4xFeFa0lCWd/2fhiL94VoWSEV87cMe3Q1qgJIudTELg yqQ5YJW+uU9Y+OYNPwP31L2JuhrQ1EQLv+do96b2s7CpC7mm/mSSZ60jTwxXWH86j4LCeY/wy Z7FjSTNFEy403Q7tBH+wLhbRWFy2z19qz9ENLo9KxEnUBhVDXXtYZpNiHECibp97UF1EvC/kV TUQLQlyzUWJYr50JYUO17vDPm5h76rdzZ8vLPwNBzZ/CuUkjmEf0pbTU1R5eJRXxVwZ3PDDk8 W9gYL4OlATYZZJ5FBS4pNBd2ODQDz+/0F+X5aAHozRmUnArPhEacI07RBicUBTAIV25FFUKbW pshHH9atVLq2+wr+kmkRwZsrK0jz9DE1QVe5ejGPIyIoXiQYYnodhrooSfGGEtNFB+NSf8hBm jtpgvIUp+4XEY7SQ82bn48ojhGSlEpggOlRiZR8KTx8reOao3CnaRUixwdcDwVwDJZd0zBdO4 CoekiaBBrQnCcaXz X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.126.130 Subject: [Qemu-devel] [PATCH v3 02/16] softloat: disable floatx80_invalid_encoding() for m68k X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andreas Schwab , Laurent Vivier , Aurelien Jarno , Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" According to the comment, this definition of invalid encoding is given by intel developer's manual, and doesn't work with the behavior of 680x0 FPU. CC: Andreas Schwab Signed-off-by: Laurent Vivier Reviewed-by: Richard Henderson --- fpu/softfloat.c | 31 +++++++++++++++++++++++++++++++ include/fpu/softfloat.h | 15 --------------- 2 files changed, 31 insertions(+), 15 deletions(-) diff --git a/fpu/softfloat.c b/fpu/softfloat.c index c295f31..f95b19f 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -4799,6 +4799,37 @@ int float64_unordered_quiet(float64 a, float64 b, float_status *status) } /*---------------------------------------------------------------------------- +| Return whether the given value is an invalid floatx80 encoding. +| Invalid floatx80 encodings arise when the integer bit is not set, but +| the exponent is not zero. The only times the integer bit is permitted to +| be zero is in subnormal numbers and the value zero. +| This includes what the Intel software developer's manual calls pseudo-NaNs, +| pseudo-infinities and un-normal numbers. It does not include +| pseudo-denormals, which must still be correctly handled as inputs even +| if they are never generated as outputs. +*----------------------------------------------------------------------------*/ +static inline bool floatx80_invalid_encoding(floatx80 a) +{ +#if defined(TARGET_M68K) + /*------------------------------------------------------------------------- + | M68000 FAMILY PROGRAMMER’S REFERENCE MANUAL + | 1.6.2 Denormalized Numbers + | Since the extended-precision data format has an explicit integer bit, + | a number can be formatted with a nonzero exponent, less than the maximum + | value, and a zero integer bit. 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. + *------------------------------------------------------------------------*/ + return 0; +#else + return (a.low & (1ULL << 63)) == 0 && (a.high & 0x7FFF) != 0; +#endif +} + + +/*---------------------------------------------------------------------------- | Returns the result of converting the extended double-precision floating- | point value `a' to the 32-bit two's complement integer format. The | conversion is performed according to the IEC/IEEE Standard for Binary diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h index 842ec6b..3920c0a 100644 --- a/include/fpu/softfloat.h +++ b/include/fpu/softfloat.h @@ -678,21 +678,6 @@ static inline int floatx80_is_any_nan(floatx80 a) return ((a.high & 0x7fff) == 0x7fff) && (a.low<<1); } -/*---------------------------------------------------------------------------- -| Return whether the given value is an invalid floatx80 encoding. -| Invalid floatx80 encodings arise when the integer bit is not set, but -| the exponent is not zero. The only times the integer bit is permitted to -| be zero is in subnormal numbers and the value zero. -| This includes what the Intel software developer's manual calls pseudo-NaNs, -| pseudo-infinities and un-normal numbers. It does not include -| pseudo-denormals, which must still be correctly handled as inputs even -| if they are never generated as outputs. -*----------------------------------------------------------------------------*/ -static inline bool floatx80_invalid_encoding(floatx80 a) -{ - return (a.low & (1ULL << 63)) == 0 && (a.high & 0x7FFF) != 0; -} - #define floatx80_zero make_floatx80(0x0000, 0x0000000000000000LL) #define floatx80_one make_floatx80(0x3fff, 0x8000000000000000LL) #define floatx80_ln2 make_floatx80(0x3ffe, 0xb17217f7d1cf79acLL)