From patchwork Tue Sep 17 20:04:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre Muller X-Patchwork-Id: 1163593 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=freepascal.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46XvJ91ZHPz9s00 for ; Wed, 18 Sep 2019 06:06:17 +1000 (AEST) Received: from localhost ([::1]:52036 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iAJjq-0008Q1-Uj for incoming@patchwork.ozlabs.org; Tue, 17 Sep 2019 16:06:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51333) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iAJi5-0006um-VN for qemu-devel@nongnu.org; Tue, 17 Sep 2019 16:04:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iAJi2-00049k-PN for qemu-devel@nongnu.org; Tue, 17 Sep 2019 16:04:25 -0400 Received: from vps46799.freepascal.org ([85.222.228.11]:52008 helo=mail.freepascal.org) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iAJi2-000497-FU for qemu-devel@nongnu.org; Tue, 17 Sep 2019 16:04:22 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.freepascal.org (Postfix) with ESMTP id CFCE581C2F for ; Tue, 17 Sep 2019 22:04:20 +0200 (CEST) Received: from mail.freepascal.org ([127.0.0.1]) by localhost (idefix.freepascal.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id d_y03MgLC-rJ for ; Tue, 17 Sep 2019 22:04:20 +0200 (CEST) Received: from [192.168.1.22] (89-89-1-25.abo.bbox.fr [89.89.1.25]) by mail.freepascal.org (Postfix) with ESMTPSA id 458E581C2E for ; Tue, 17 Sep 2019 22:04:20 +0200 (CEST) To: qemu-devel@nongnu.org From: Pierre Muller Openpgp: preference=signencrypt Autocrypt: addr=pierre@freepascal.org; prefer-encrypt=mutual; keydata= mQINBFktPfMBEADXLobuZD433oMWjhIsxFsFhZCfYlO0CReRIUZNBroyPpxfgu9vepuYzysS qrWzlOxlu+hpatEzeoj/MCsecehyUQFty+c/0VM73QlWbCxGaIbeeulAAgM/QreUEKJHYEXa n9Q05H/rwP/+rbNMryZinb5Qkx+ckwqMuSZIULhsNK3cFjqK2DDuR/F+jqfTRZI0y5YLrNm3 CzuCulCsYO4siLt3QiXlKwhGiAi8ota4d99MiKWeUGFBvEHDxIfCpbWifHWoQDuGMQ+hqhLr VsjjyFG5bKrpyM0tZPr+I5pzbSqf9CxVJDQukNU0atadqkENQrUXxL45om8N2XSm9GeZie6+ havbis94GWIsN075iHKbbylDXwSglNxrSg208kTFl5H1beW6EeqdrUwiIEqN31h6NkLLWTID wHUOD8wGXcj+9MP3+BemMkxb2NxvNGNabvcLuioPa3k1LF4wViqazJqEYlX0COFyMleHQd8N li7ixbpxQb2UTblQIaCRmNWxY5OYOEj3Q57ghoukDCPCQasyCso7gLnM/OfV3ySI94c9PsgV tRIye66palaTflifyzBzOennn+8RDyrEaykhBrCJ2zMQ+gkZTbyM0dIL5DlaVsw9fdacYQkv QHWqnIlRb+ajVjNB3viwAhLEJpGmzsud5yECto1fTvwtP0o+4wARAQABtCVQaWVycmUgTXVs bGVyIDxwaWVycmVAZnJlZXBhc2NhbC5vcmc+iQJUBBMBCAA+FiEEAa6WVDoIGwmDdluDEW8e aiYMgJw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WI5 SPIHG2SUJMGHJJeKm+dgiLPD4WKi3dAdCdqCnfJeQC35kBwhkNxt6tU2Lr4GJ54U2cbdCYs9 Hw== Message-ID: <1615bbe5-3033-3b76-5cfb-52e343dc4d67@freepascal.org> Date: Tue, 17 Sep 2019 22:04:17 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 Content-Language: en-US X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 85.222.228.11 Subject: [Qemu-devel] [PATCH] * include/fpu/softfloat.h (floatx80_invalid_encoding): Handle m68k specific infinity pattern. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Pierre Muller Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Hello, I submitted September 12. a bug report about wrong handling of infinity values for m68k emulator. https://bugs.launchpad.net/qemu/+bug/1843651 The analysis I made in the bug report is wrong, because I did not know that m68k FPU really uses 80-bit representations internally. It thus seems now to me that the m68k specific floatx80_infinity_low corresponds to a different internal encoding of infinity on m68k floating point units, different from the one of the usual x87 floating point unit. The main problem still remains that the function floatx80_invalid_encoding does not properly handle those m68k infinity patterns. The patch below seems to fix the reported problem on current git. Pierre Muller Member of core development team of Free Pascal compiler From e053d3d07b1951faf0b4637ce1ec4194b8d952e5 Mon Sep 17 00:00:00 2001 From: Pierre Muller Date: Thu, 12 Sep 2019 08:10:48 +0000 Subject: [PATCH] * include/fpu/softfloat.h (floatx80_invalid_encoding): Handle m68k specific infinity pattern. Signed-off-by: Pierre Muller --- include/fpu/softfloat.h | 7 +++++++ 1 file changed, 7 insertions(+) -- 2.20.1 diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h index ecb8ba0114..538c35767e 100644 --- a/include/fpu/softfloat.h +++ b/include/fpu/softfloat.h @@ -685,10 +685,17 @@ static inline int floatx80_is_any_nan(floatx80 a) | 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. +| As m68k uses a different pattern for infinity, thus an additional test +| for valid infinity value must be added for m68k CPU. *----------------------------------------------------------------------------*/ static inline bool floatx80_invalid_encoding(floatx80 a) { +#if defined (TARGET_M68K) + return ((a.low & (1ULL << 63)) == 0 && (a.high & 0x7FFF) != 0) + && (! floatx80_is_infinity(a)); +#else return (a.low & (1ULL << 63)) == 0 && (a.high & 0x7FFF) != 0; +#endif } #define floatx80_zero make_floatx80(0x0000, 0x0000000000000000LL)