From nobody Wed May 15 18:38:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1620211965; cv=none; d=zohomail.com; s=zohoarc; b=fa8yixmoby8djFEigvZMWfhhI1nApZSgT5d3BTATnsBa3QtjS+IaVShflNEyesFIApLZ9dV9pM4G//PVb9gS2gt1LnTkM0STGH5S0PXBQ7pSphycXghC7uYiBUNYBH7Vdh+sUyFyCIY+w9yzx20+/Rbg8y3JIHRggJmZyk7OL4c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620211965; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=6+GlYhWHnz6iOlMWUKZRy6xvZVZrZYZEyUyg01fTwbA=; b=O+TNPSIqk2nIClyYW1zpACjCsUG6g0BvJ5kpr3IfVHhf2utkPMleP39keWfKhE5sz3UKA50+9V4aE8mzEiFIbp3rH8IZ9SnJ4kKEKaEBO9h/on94YIqRZQyNVuMgV3Kaci7HP5ZJrcxtg2pM9Ofgp5Aa/x3Bs8AsqG0tRHxFL/k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1620211965966521.6459823359036; Wed, 5 May 2021 03:52:45 -0700 (PDT) Received: from localhost ([::1]:42398 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1leF92-0000Rf-At for importer@patchew.org; Wed, 05 May 2021 06:52:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42830) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1leF6c-0007Fl-62 for qemu-devel@nongnu.org; Wed, 05 May 2021 06:50:15 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:27621) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1leF6T-0005zH-Hh for qemu-devel@nongnu.org; Wed, 05 May 2021 06:50:12 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-496-F5qQPHOFPBiIqCXKQ88Ktw-1; Wed, 05 May 2021 06:50:00 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 74A2450207; Wed, 5 May 2021 10:49:59 +0000 (UTC) Received: from t480s.redhat.com (ovpn-114-245.ams2.redhat.com [10.36.114.245]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0FFE459446; Wed, 5 May 2021 10:49:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620211802; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=6+GlYhWHnz6iOlMWUKZRy6xvZVZrZYZEyUyg01fTwbA=; b=IeL7DiEV9eh6gK1j9MDR5L4t5uVkB9Fm66yLK2N7eOV/IvOZ1Uamu2tGfjN7ZY1zuFx578 9JmQ3mDntF/7VXhE8ISgS1/DDeJQdpOCG7qQDgmXyqBt6v1wMOieoYNoiSDqW+a/Ao8dO1 s7dKAEXrKuYkDhzsftytw3Ssz4PdFVk= X-MC-Unique: F5qQPHOFPBiIqCXKQ88Ktw-1 From: David Hildenbrand To: qemu-devel@nongnu.org Subject: [PATCH v1] softfloat: Silence signaling NaN when converting to/from float128 Date: Wed, 5 May 2021 12:49:52 +0200 Message-Id: <20210505104952.5632-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=david@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.697, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Cc: Peter Maydell , Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Aurelien Jarno , David Hildenbrand Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) We forgot to silence the NaN, just as we already do for the other conversions. Found by comparing the result of running randomly generated FP instructions under s390x/tcg and comparing against the result on real HW. Unfortunately, test cases like f32_to_f128 cannot be unlocked yet as some expected values (with NaN) are wrongly calculated. Cc: Aurelien Jarno Cc: Peter Maydell Cc: "Alex Benn=C3=A9e" Cc: Richard Henderson Signed-off-by: David Hildenbrand --- fpu/softfloat.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/fpu/softfloat.c b/fpu/softfloat.c index 67cfa0fd82..e9f2117a6d 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -4924,7 +4924,9 @@ float128 float32_to_float128(float32 a, float_status = *status) aSign =3D extractFloat32Sign( a ); if ( aExp =3D=3D 0xFF ) { if (aSig) { - return commonNaNToFloat128(float32ToCommonNaN(a, status), stat= us); + float128 res =3D commonNaNToFloat128(float32ToCommonNaN(a, sta= tus), + status); + return float128_silence_nan(res, status); } return packFloat128( aSign, 0x7FFF, 0, 0 ); } @@ -5229,7 +5231,9 @@ float128 float64_to_float128(float64 a, float_status = *status) aSign =3D extractFloat64Sign( a ); if ( aExp =3D=3D 0x7FF ) { if (aSig) { - return commonNaNToFloat128(float64ToCommonNaN(a, status), stat= us); + float128 res =3D commonNaNToFloat128(float64ToCommonNaN(a, sta= tus), + status); + return float128_silence_nan(res, status); } return packFloat128( aSign, 0x7FFF, 0, 0 ); } @@ -6665,7 +6669,9 @@ float32 float128_to_float32(float128 a, float_status = *status) aSign =3D extractFloat128Sign( a ); if ( aExp =3D=3D 0x7FFF ) { if ( aSig0 | aSig1 ) { - return commonNaNToFloat32(float128ToCommonNaN(a, status), stat= us); + float32 res =3D commonNaNToFloat32(float128ToCommonNaN(a, stat= us), + status); + return float32_silence_nan(res, status); } return packFloat32( aSign, 0xFF, 0 ); } @@ -6699,7 +6705,9 @@ float64 float128_to_float64(float128 a, float_status = *status) aSign =3D extractFloat128Sign( a ); if ( aExp =3D=3D 0x7FFF ) { if ( aSig0 | aSig1 ) { - return commonNaNToFloat64(float128ToCommonNaN(a, status), stat= us); + float64 res =3D commonNaNToFloat64(float128ToCommonNaN(a, stat= us), + status); + return float64_silence_nan(res, status); } return packFloat64( aSign, 0x7FF, 0 ); } --=20 2.30.2