From nobody Sun Nov 9 11:35:39 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.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=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550869234701317.2715032478907; Fri, 22 Feb 2019 13:00:34 -0800 (PST) Received: from localhost ([127.0.0.1]:56817 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gxHvr-0006V6-Lk for importer@patchew.org; Fri, 22 Feb 2019 16:00:31 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38765) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gxHrr-00035y-W3 for qemu-devel@nongnu.org; Fri, 22 Feb 2019 15:56:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gxHgt-0006qL-Hu for qemu-devel@nongnu.org; Fri, 22 Feb 2019 15:45:04 -0500 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:34160) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gxHgt-0006op-5p for qemu-devel@nongnu.org; Fri, 22 Feb 2019 15:45:03 -0500 Received: by mail-wr1-x442.google.com with SMTP id f14so3784704wrg.1 for ; Fri, 22 Feb 2019 12:45:03 -0800 (PST) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id h13sm1892486wrs.42.2019.02.22.12.45.00 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Feb 2019 12:45:00 -0800 (PST) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 7FA2A1FF82; Fri, 22 Feb 2019 20:45:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kYAXsuLgDRoQZZBEVPpoAgxZdoO5asAwCUtHutk2yoc=; b=TDIinfmGaqLr53U/D7U2z1giUr3y2GWmK2NiTt49bn/KMBu9On8dK4cBtUR+TLjmSO wx/FgQeQ/FfGRRPCSsB0wMQV2zbqOtp8pdSIGIejWtHAaHt5VqOnLFb8IX9GEmyWk+qR T0Ry4lFl8HcBK0XR2SG+Cvfz08rsMAcFdtTKFI9Enfb416iQHngDqRwilDviH/i4/Est 2x0XFvIzd6xYKSOlTuo80FrIAEoLAfo9kFlwKTq/l59ZaymKfUfNVYUQd7kmLybJYhTS g1HR2f47wSbTe/T1A2tMqs8kQBSr+JfVSH/h4Rq9d47gHpZHik7fSfKzg1QFgcL8YM1F DIwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kYAXsuLgDRoQZZBEVPpoAgxZdoO5asAwCUtHutk2yoc=; b=taLEbAxcwb6VQ4FoFH7+E5+/2dPyDWqEuedh+ZvgZq70kbwX/QASGkTQnXQZxp9nh9 u6mbmyoVSDYaaL6j1lBGdCHXkEBldnC6swH6mBoRjWj4hIhZDmwuXvvKPmmCvOVDddyb rzibI3tgxt08huBmHm+xsevftl2/fqAnud25S+r72RnABsRy9S6JdLtYddOpXYq60A0S q7aVwdf8V9nUlhcUxYxAM3KuMY+vDHmg9bb1AJuzXsXavND6lh54KJ85Dw1WJ2nzF2/b blFvvMxL9TvDz1Gblhy2ZXFvUYb5a/H9vZu3LRy702fDjWP8KXt/JW8KuNz21SEdKY3I u02g== X-Gm-Message-State: AHQUAuZ6ZMJDOd+5SZ/NkJ10kCbJ/DA3PNwaOn3x4+jRDKDHDtKl4Y3K tl8QxM59DELbukhJkEii5rZssQ== X-Google-Smtp-Source: AHgI3IZBST3Y9pqysWCrzGDDoaSEQL7XTx36GcOs72xP03sUBS/ft/PMtKi5LnN/TeI2Lk9cyybdFQ== X-Received: by 2002:a5d:540f:: with SMTP id g15mr4565819wrv.126.1550868302004; Fri, 22 Feb 2019 12:45:02 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Date: Fri, 22 Feb 2019 20:44:55 +0000 Message-Id: <20190222204500.24434-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190222204500.24434-1-alex.bennee@linaro.org> References: <20190222204500.24434-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::442 Subject: [Qemu-devel] [PATCH v1 1/6] tests: Ignore fp test outputs 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: =?UTF-8?q?Alex=20Benn=C3=A9e?= , qemu-s390x@nongnu.org, "Emilio G . Cota" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Eric Blake Commit 2cade3d wired up new tests, but did not exclude the new *.out files produced by running the tests. Signed-off-by: Eric Blake Reviewed-by: Emilio G. Cota Signed-off-by: Alex Benn=C3=A9e --- tests/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/.gitignore b/tests/.gitignore index 72c18aaab0..f2bf85c8c4 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -5,6 +5,7 @@ benchmark-crypto-hmac check-* !check-*.c !check-*.sh +fp/*.out qht-bench rcutorture test-* --=20 2.20.1 From nobody Sun Nov 9 11:35:39 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.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=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550869447681592.7891232533777; Fri, 22 Feb 2019 13:04:07 -0800 (PST) Received: from localhost ([127.0.0.1]:56887 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gxHzB-0000KM-Jp for importer@patchew.org; Fri, 22 Feb 2019 16:03:57 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38765) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gxHrl-00035y-3m for qemu-devel@nongnu.org; Fri, 22 Feb 2019 15:56:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gxHgu-0006rf-B7 for qemu-devel@nongnu.org; Fri, 22 Feb 2019 15:45:05 -0500 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:46007) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gxHgu-0006q7-0I for qemu-devel@nongnu.org; Fri, 22 Feb 2019 15:45:04 -0500 Received: by mail-wr1-x442.google.com with SMTP id w17so3717702wrn.12 for ; Fri, 22 Feb 2019 12:45:03 -0800 (PST) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id j15sm2559894wrt.1.2019.02.22.12.45.00 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Feb 2019 12:45:00 -0800 (PST) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 8B5F11FF83; Fri, 22 Feb 2019 20:45:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QX9vHdvwnrQQIzWiNBjC4sjIDTbes6ab8cLrV+4UWjE=; b=aeqSN+qUQ6/xXRZWAc7MMqxYQxQ4U4ENwIhvqQfC17B5SOGqNqWY780HKOFKtubUlT pI0KtCJ72NnCM5ynsumxoPU6aX3R2eosRl0D0nioUpe8Np0z6BQMeqhD0fM8oTYJO+uX XrwscjXhdxZ4DizCohxGnzAjlyOAsTeh3BbZ2KmAiNp5semM/D99T+nMDCGWJ5xym//Z CBS5AC5asCggG6JHwGPN3PFAAM0XKf0Mqjh9LaAlqesdgUMAUkxx5UM8o9LaMQc0eslq Vf1amoAWgkJYBnBPmUgVFOMZqduGx0XY391ngaTjXO3jbgkZGIlrD/0iJfGI7oqneRMn S/TA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QX9vHdvwnrQQIzWiNBjC4sjIDTbes6ab8cLrV+4UWjE=; b=CendGVMWCewCRv2f8FWK+swAhK6110yOsLM7J6iBuzLIeTl1LNSMsxiq7UmrSzWXtN TZhf3XL056vPmu5pz5LUenN8RpxnVgkIFL1AGhlTtZgKX0qoD4BsA0zxcGiEgLZ+3TSz 1OwK/aLhFIyw9SZOLLxV1atN3fAi/51K/3o0VxSVCL/KlD8GdemkLspmgCvHzDSAqWg5 lkM5yo89hQ9CISwjRRNQuNhF+v5MbyhVDN71mb0GOULdg6essNhfwGq085wARw2Umftf fNfSjUrrYqmEtygVKafWkfHwJ98i3HFmLSXXA2r004Cvsn90K+PWKVJaEQv/DtsvMmJ9 BnlQ== X-Gm-Message-State: AHQUAuaoQbyfNThR31mgz2OJxp0m0P6Wyollq+VZJKwqYrdUG8NFRPbV jcitSz8tNVwDlZSJ7YHqyJ82lQ== X-Google-Smtp-Source: AHgI3Ia3/K0z5yGFYcAPt1VJMcj0RDZgkqodEExwUYT5A0tpoi9mvLsBDgtjXusIxvRmzH5M6laT5w== X-Received: by 2002:adf:f9c4:: with SMTP id w4mr4447894wrr.218.1550868302887; Fri, 22 Feb 2019 12:45:02 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Date: Fri, 22 Feb 2019 20:44:56 +0000 Message-Id: <20190222204500.24434-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190222204500.24434-1-alex.bennee@linaro.org> References: <20190222204500.24434-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::442 Subject: [Qemu-devel] [PATCH v1 2/6] softfloat: add float128_is_{normal, denormal} 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: =?UTF-8?q?Alex=20Benn=C3=A9e?= , qemu-s390x@nongnu.org, Richard Henderson , David Hildenbrand Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: David Hildenbrand Needed on s390x, to test for the data class of a number. So it will gain soon a user. A number is considered normal if the exponent is neither 0 nor all 1's. That can be checked by adding 1 to the exponent, and comparing against >=3D 2 after dropping an eventual overflow into the sign bit. While at it, convert the other floatXX_is_normal functions to use a similar, less error prone calculation, as suggested by Richard H. Signed-off-by: David Hildenbrand Reviewed-by: Richard Henderson Signed-off-by: Alex Benn=C3=A9e --- include/fpu/softfloat.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h index 38a5e99cf3..3ff5215b81 100644 --- a/include/fpu/softfloat.h +++ b/include/fpu/softfloat.h @@ -466,7 +466,7 @@ static inline int float32_is_zero_or_denormal(float32 a) =20 static inline bool float32_is_normal(float32 a) { - return ((float32_val(a) + 0x00800000) & 0x7fffffff) >=3D 0x01000000; + return (((float32_val(a) >> 23) + 1) & 0xff) >=3D 2; } =20 static inline bool float32_is_denormal(float32 a) @@ -622,7 +622,7 @@ static inline int float64_is_zero_or_denormal(float64 a) =20 static inline bool float64_is_normal(float64 a) { - return ((float64_val(a) + (1ULL << 52)) & -1ULL >> 1) >=3D 1ULL << 53; + return (((float64_val(a) >> 52) + 1) & 0x7ff) >=3D 2; } =20 static inline bool float64_is_denormal(float64 a) @@ -940,6 +940,16 @@ static inline int float128_is_zero_or_denormal(float12= 8 a) return (a.high & 0x7fff000000000000LL) =3D=3D 0; } =20 +static inline bool float128_is_normal(float128 a) +{ + return (((a.high >> 48) + 1) & 0x7fff) >=3D 2; +} + +static inline bool float128_is_denormal(float128 a) +{ + return float128_is_zero_or_denormal(a) && !float128_is_zero(a); +} + static inline int float128_is_any_nan(float128 a) { return ((a.high >> 48) & 0x7fff) =3D=3D 0x7fff && --=20 2.20.1 From nobody Sun Nov 9 11:35:39 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.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=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550869236891338.39236456150877; Fri, 22 Feb 2019 13:00:36 -0800 (PST) Received: from localhost ([127.0.0.1]:56819 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gxHvv-0006X0-RV for importer@patchew.org; Fri, 22 Feb 2019 16:00:35 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38872) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gxHrc-0003Fi-Th for qemu-devel@nongnu.org; Fri, 22 Feb 2019 15:56:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gxHgv-0006tC-Jo for qemu-devel@nongnu.org; Fri, 22 Feb 2019 15:45:06 -0500 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:54591) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gxHgv-0006sF-Bj for qemu-devel@nongnu.org; Fri, 22 Feb 2019 15:45:05 -0500 Received: by mail-wm1-x344.google.com with SMTP id a62so3111595wmh.4 for ; Fri, 22 Feb 2019 12:45:05 -0800 (PST) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id r70sm1451052wme.46.2019.02.22.12.45.01 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Feb 2019 12:45:02 -0800 (PST) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 971B81FF86; Fri, 22 Feb 2019 20:45:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=PH41D0K99rFgQCuzKch0t4SrvJqgrHW/zgeCIlULUOo=; b=U3iVtHo8cpwt0ZYYZey9VHSBxz+aOcFA5+zVp7K6xs4PGigVvGWvOwh907iqcs3WLQ Jl8WLFRD4Uvk5PUm5bCuUHmo6sB4cDXc/TLAuf3Y+vISUG7817sRdK76GYZxGXY1W0ET vm3IA/JCfwsOl5zEuFAhvViotS29w17yUSGGzy9tbN+Wx84b9AYrbPNjHtnJL4EuoOIT NHEu2NgHTZSUyP1m3RiJZjA9Ju306J9J2IgtukWpYqkdwEpq8lMIYr8jus4u16GlrMTc YNKGayV9TyYhgPqp35CprY0jrBiBcFbzAc6hb0G0DqjnCr0JRrfcLZxdTiBZw21mcqdh V+8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PH41D0K99rFgQCuzKch0t4SrvJqgrHW/zgeCIlULUOo=; b=phII/5r6oIGooKKrSB5IAvRq//EzNnUs/IGdcEoq0L9K9JHze4jYm2kBzCIBOM2KPn oNLLBLCYKEca2uKGGIHYTg+g/ZlvfgaOjxFm/k1QOmG5TaLNuYsFu3ewrKri+K2sDuqE JvCoPBFZT6Him0BthQgUT5Up91Sy1M4TZ4yIUt5jpOeFAyScytBeiIPOnOcvkk83ZawX 53KZycH2sleqC2OrbuVGjlshQnJKd/G9fPhUcz7qukKmNwPcAFpX/DouH98lR+b7lgUC zpcKaALLj1g2dK1BVQ6IGAaiOFhl1aazT8d2lToGeN7YSQd6dhSPQQWZTs97ckRAxMQW 5iIA== X-Gm-Message-State: AHQUAuYjGo5oQfZ4mDmAWCV0ssYqnlRn3cSHV8aG8Bg9xZQrPsCXVPJc Jzk61FJZlKhKuZR+kTWeGw1mbg== X-Google-Smtp-Source: AHgI3Ia7vUP8k7o4EeoIB3mp+cUJw+jaA7Jla+aYuccv3oTKSQTVTcZ+5ITiZB+Nm1MhdFJRVKpY2w== X-Received: by 2002:a7b:cc18:: with SMTP id f24mr3871535wmh.42.1550868304351; Fri, 22 Feb 2019 12:45:04 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Date: Fri, 22 Feb 2019 20:44:57 +0000 Message-Id: <20190222204500.24434-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190222204500.24434-1-alex.bennee@linaro.org> References: <20190222204500.24434-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::344 Subject: [Qemu-devel] [PATCH v1 3/6] softfloat: Implement float128_to_uint32 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: =?UTF-8?q?Alex=20Benn=C3=A9e?= , qemu-s390x@nongnu.org, Richard Henderson , David Hildenbrand Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: David Hildenbrand Handling it just like float128_to_uint32_round_to_zero, that hopefully is free of bugs :) Documentation basically copied from float128_to_uint64 Signed-off-by: David Hildenbrand Reviewed-by: Richard Henderson Signed-off-by: Alex Benn=C3=A9e --- fpu/softfloat.c | 29 +++++++++++++++++++++++++++++ include/fpu/softfloat.h | 1 + 2 files changed, 30 insertions(+) diff --git a/fpu/softfloat.c b/fpu/softfloat.c index 9132d7a0b0..c69cd6b5d1 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -6792,6 +6792,35 @@ uint32_t float128_to_uint32_round_to_zero(float128 a= , float_status *status) return res; } =20 +/*------------------------------------------------------------------------= ---- +| Returns the result of converting the quadruple-precision floating-point = value +| `a' to the 32-bit unsigned integer format. The conversion is +| performed according to the IEC/IEEE Standard for Binary Floating-Point +| Arithmetic---which means in particular that the conversion is rounded +| according to the current rounding mode. If `a' is a NaN, the largest +| positive integer is returned. If the conversion overflows, the +| largest unsigned integer is returned. If 'a' is negative, the value is +| rounded and zero is returned; negative values that do not round to zero +| will raise the inexact exception. +*-------------------------------------------------------------------------= ---*/ + +uint32_t float128_to_uint32(float128 a, float_status *status) +{ + uint64_t v; + uint32_t res; + int old_exc_flags =3D get_float_exception_flags(status); + + v =3D float128_to_uint64(a, status); + if (v > 0xffffffff) { + res =3D 0xffffffff; + } else { + return v; + } + set_float_exception_flags(old_exc_flags, status); + float_raise(float_flag_invalid, status); + return res; +} + /*------------------------------------------------------------------------= ---- | Returns the result of converting the quadruple-precision floating-point | value `a' to the single-precision floating-point format. The conversion diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h index 3ff5215b81..3ff3fa5224 100644 --- a/include/fpu/softfloat.h +++ b/include/fpu/softfloat.h @@ -878,6 +878,7 @@ int64_t float128_to_int64(float128, float_status *statu= s); int64_t float128_to_int64_round_to_zero(float128, float_status *status); uint64_t float128_to_uint64(float128, float_status *status); uint64_t float128_to_uint64_round_to_zero(float128, float_status *status); +uint32_t float128_to_uint32(float128, float_status *status); uint32_t float128_to_uint32_round_to_zero(float128, float_status *status); float32 float128_to_float32(float128, float_status *status); float64 float128_to_float64(float128, float_status *status); --=20 2.20.1 From nobody Sun Nov 9 11:35:39 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.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=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550869362339374.52817872617106; Fri, 22 Feb 2019 13:02:42 -0800 (PST) Received: from localhost ([127.0.0.1]:56879 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gxHxp-00088Z-EX for importer@patchew.org; Fri, 22 Feb 2019 16:02:33 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38918) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gxHrf-0003HB-Vu for qemu-devel@nongnu.org; Fri, 22 Feb 2019 15:56:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gxHgv-0006sd-1x for qemu-devel@nongnu.org; Fri, 22 Feb 2019 15:45:05 -0500 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:35841) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gxHgu-0006rN-Po for qemu-devel@nongnu.org; Fri, 22 Feb 2019 15:45:04 -0500 Received: by mail-wm1-x341.google.com with SMTP id j125so3123907wmj.1 for ; Fri, 22 Feb 2019 12:45:04 -0800 (PST) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id d21sm5780168wrc.44.2019.02.22.12.45.00 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Feb 2019 12:45:02 -0800 (PST) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id A28ED1FF87; Fri, 22 Feb 2019 20:45:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7H5qrKyPnUHzhUw0KCPZrtdEbkrKMyIV+FaO4FKGkUU=; b=XYxVRzQjVYaGXW3mwHuwdt/Tt7hLxdYxrDb0dyZZxXnaEC3kslTRFxSMr7phb/0j6w eejReXPly/rXmzcCAVpok/vZ7mUMypPkq9AfOZ+DXfsQkiL+jHOc26IayKjTyKfW/SNS QcMJmHi6Q62Cgswr7WiWg4Ffio3ul+6OiqUGV2BbOKRZNuWhbpX+6/LVk4ZL1tTLOUil HcgcCYyRak+n07K1Yqx3KsVEIZn1QzL44NyZCuR2k/ls9Zx1rBSIi7e6Fi6tMfIyRf4/ Gz+A0EDSH7oWZINsBtP9qIdeYXZKsXC2AANk/o5w6lbcufQdo4fAY6qfN4yGhA78UXbq D0Rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7H5qrKyPnUHzhUw0KCPZrtdEbkrKMyIV+FaO4FKGkUU=; b=mY0DjzMUNQH2lsULCsx9/K9vE49MHMnGYmtdcOr2WEROqoCzxlImm7BV8bMo9wLgGS 7geolb1KFUdCVN6Yx0EPZ/0hhK0Tb5V1qvGhYbYBjng/HtaCABcSHL7VWaZxwxTb10ft kJpzKR1OX0Ag73Hf9xhPnIYk/TNa4GWB1XiCqx4ng0/zPAwWfNKbQaesPMozn80ADrEQ zG3L3ldbjScWX2D6TV+5YfC78+SobcVzv7LlfmoGGR9+eNByfvEljb54xj+RS4cwb8vj VoDwL0sDtaTVOGrRa+WsSdugfK+ko9gUp1TJjYNJ0WTvT2ojTfMTH1nD8jv9qQs8wxwT mvuQ== X-Gm-Message-State: AHQUAuaUYXNDcw7T4pjBwmNhj1Ez9C7PV7vaeRcQKoGQk1MDMlHFNBNZ PL9t2L1BBhhRA89lcJf0UJRewWb3gTg= X-Google-Smtp-Source: AHgI3IYJcLPBSdTJY6sJTQ/Tm4v0LU/mWexjPMjG3FvUDIV2QtOh451SNYbJeqoaGWq8alZnKIX4Bg== X-Received: by 2002:a1c:a3c3:: with SMTP id m186mr3595538wme.16.1550868303539; Fri, 22 Feb 2019 12:45:03 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Date: Fri, 22 Feb 2019 20:44:58 +0000 Message-Id: <20190222204500.24434-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190222204500.24434-1-alex.bennee@linaro.org> References: <20190222204500.24434-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::341 Subject: [Qemu-devel] [PATCH v1 4/6] tests/fp: add wrapping for f128_to_ui32 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: qemu-s390x@nongnu.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Needed to test: softfloat: add float128_is_{normal,denormal} Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson --- tests/fp/fp-test.c | 3 ++- tests/fp/wrap.inc.c | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/fp/fp-test.c b/tests/fp/fp-test.c index 2a35ef601d..4114f346a9 100644 --- a/tests/fp/fp-test.c +++ b/tests/fp/fp-test.c @@ -622,7 +622,8 @@ static void do_testfloat(int op, int rmode, bool exact) test_ab_extF80_z_bool(true_ab_extF80M_z_bool, subj_ab_extF80M_z_bo= ol); break; case F128_TO_UI32: - not_implemented(); + test_a_f128_z_ui32_rx(slow_f128M_to_ui32, qemu_f128M_to_ui32, rmod= e, + exact); break; case F128_TO_UI64: test_a_f128_z_ui64_rx(slow_f128M_to_ui64, qemu_f128M_to_ui64, rmod= e, diff --git a/tests/fp/wrap.inc.c b/tests/fp/wrap.inc.c index d3bf600cd0..0cbd20013e 100644 --- a/tests/fp/wrap.inc.c +++ b/tests/fp/wrap.inc.c @@ -367,6 +367,7 @@ WRAP_80_TO_INT_MINMAG(qemu_extF80M_to_i64_r_minMag, WRAP_128_TO_INT(qemu_f128M_to_i32, float128_to_int32, int_fast32_t) WRAP_128_TO_INT(qemu_f128M_to_i64, float128_to_int64, int_fast64_t) =20 +WRAP_128_TO_INT(qemu_f128M_to_ui32, float128_to_uint32, uint_fast32_t) WRAP_128_TO_INT(qemu_f128M_to_ui64, float128_to_uint64, uint_fast64_t) #undef WRAP_128_TO_INT =20 --=20 2.20.1 From nobody Sun Nov 9 11:35:39 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.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=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550869091032708.0021318973194; Fri, 22 Feb 2019 12:58:11 -0800 (PST) Received: from localhost ([127.0.0.1]:56787 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gxHtT-0004hf-NI for importer@patchew.org; Fri, 22 Feb 2019 15:58:03 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38918) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gxHra-0003HB-MU for qemu-devel@nongnu.org; Fri, 22 Feb 2019 15:56:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gxHgx-0006vP-M7 for qemu-devel@nongnu.org; Fri, 22 Feb 2019 15:45:08 -0500 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:43109) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gxHgx-0006u8-19 for qemu-devel@nongnu.org; Fri, 22 Feb 2019 15:45:07 -0500 Received: by mail-wr1-x443.google.com with SMTP id d17so3725638wre.10 for ; Fri, 22 Feb 2019 12:45:06 -0800 (PST) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id h126sm2021166wmf.2.2019.02.22.12.45.01 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Feb 2019 12:45:02 -0800 (PST) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id AE5831FF88; Fri, 22 Feb 2019 20:45:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KXHtqzyTgzr/IEYjnPpKDEyWD58lU3YNGD6QhuOFRHo=; b=ZlvJdwenGPxULpPXPHiot5mA6q1JkKhHgseQJeCpaH8pQ6BSaZHPr7oVyoB0lL1vE9 MHWpBqvYdxnCTnT8ARLdk+GczIQKlRJSv6uRa+sRbmweEWqQarSBA2VXHxqftX5/3Q/g wSHRmFN9C+gGvi2eeQWYnd8vc2d+SE5U+CRElMO3ovyTLkbJZ27iCZsOOPGA64AQizqr kRzMdGOoLZWge7dZhOXtWoqjy8DT4I1aYXPiKciDJ7bIti2R4jQjNj7lTHp0Ejmk5CwE 6g+vlV5sO3uuSd2xqPs74IG3xpmJ7IiVeA4KR6Nq7VHJA9kGfFsTTiEjIKQ86KoQlaWf hygg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KXHtqzyTgzr/IEYjnPpKDEyWD58lU3YNGD6QhuOFRHo=; b=lvjfQehPwVZ/jdTsiPtwtFGCitKVC7rFCYa0n5ne1sJOl2BzQpjNTw+qHRv7za6T53 jt2NbIuZXdda7v2lNTan5H3WvizbigkeK1VBTsYKJl597KkSz9VZhwHbui3bkfmuFUgp rQNJ8Jp5tLX8LbXOSFbOYf1TRGuxjbjlgvXpWff/JPNzwB7n6ZVy495u8UwLGYGLBVPb pDTgLshF6NJUv/GAzRDYOFXM/YR17z2r0RJJtO6XQYX+ca5SawdHXTgxrr0bRmISC5uU 0O5ElFNh/Wm9pC/ChpV5Xrf6tCI6aWNZGrcdASq+/HNbi2GUOH6ZQACAva6CiwNW0gvO cgmg== X-Gm-Message-State: AHQUAuaynqxCFbFMq62dw1a2ZNAtTFuPZjxLHxlNB6N02Jt4f//iHOgb KrXGqJFuNtaFyl5nfqQ2IWNd11cOvGc= X-Google-Smtp-Source: AHgI3IY7utrEMUQpUh4/QOYezntyq3BkfKZRC5AGDasn4KvyVxGGbfGDToKpmlgdBWidNUbdHFQqnQ== X-Received: by 2002:a5d:6446:: with SMTP id d6mr3605844wrw.72.1550868306088; Fri, 22 Feb 2019 12:45:06 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Date: Fri, 22 Feb 2019 20:44:59 +0000 Message-Id: <20190222204500.24434-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190222204500.24434-1-alex.bennee@linaro.org> References: <20190222204500.24434-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::443 Subject: [Qemu-devel] [PATCH v1 5/6] tests/fp: enable f128_to_ui[32/64] tests in float-to-uint 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: qemu-s390x@nongnu.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) We've just added f128_to_ui32 and we missed out the f128_to_ui64 tests last time. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson --- tests/Makefile.include | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/Makefile.include b/tests/Makefile.include index 3741f8f6dd..060f765b0e 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -909,8 +909,7 @@ test-softfloat =3D $(call quiet-command, \ =20 # Conversion Routines: # FIXME: i32_to_extF80 (broken), i64_to_extF80 (broken) -# ui32_to_f128 (not implemented), f128_to_ui32 (not implemented) -# extF80_roundToInt (broken) +# ui32_to_f128 (not implemented), extF80_roundToInt (broken) # check-softfloat-conv: $(FP_TEST_BIN) $(call test-softfloat, \ @@ -939,9 +938,11 @@ check-softfloat-conv: $(FP_TEST_BIN) f16_to_ui32 f16_to_ui32_r_minMag \ f32_to_ui32 f32_to_ui32_r_minMag \ f64_to_ui32 f64_to_ui32_r_minMag \ + f128_to_ui32 f128_to_ui32_r_minMag \ f16_to_ui64 f16_to_ui64_r_minMag \ f32_to_ui64 f32_to_ui64_r_minMag \ - f64_to_ui64 f64_to_ui64_r_minMag, \ + f64_to_ui64 f64_to_ui64_r_minMag \ + f128_to_ui64 f128_to_ui64_r_minMag, \ float-to-uint) $(call test-softfloat, \ f16_roundToInt f32_roundToInt \ --=20 2.20.1 From nobody Sun Nov 9 11:35:39 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.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=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550869090602204.9131050530042; Fri, 22 Feb 2019 12:58:10 -0800 (PST) Received: from localhost ([127.0.0.1]:56789 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gxHtV-0004j2-Bf for importer@patchew.org; Fri, 22 Feb 2019 15:58:05 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38765) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gxHra-00035y-NE for qemu-devel@nongnu.org; Fri, 22 Feb 2019 15:56:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gxHgw-0006uU-O0 for qemu-devel@nongnu.org; Fri, 22 Feb 2019 15:45:07 -0500 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]:46009) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gxHgw-0006tR-FU for qemu-devel@nongnu.org; Fri, 22 Feb 2019 15:45:06 -0500 Received: by mail-wr1-x444.google.com with SMTP id w17so3717774wrn.12 for ; Fri, 22 Feb 2019 12:45:06 -0800 (PST) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id v20sm1730953wmj.2.2019.02.22.12.45.01 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Feb 2019 12:45:02 -0800 (PST) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id BA55E1FF89; Fri, 22 Feb 2019 20:45:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Yzy7H0G0WI09NToG/3M3PGsN3ZzXzNj17W3uLaSVmn8=; b=TTW8adxKnR8a0Bp1JszQ2R4sCzVra12LpI/YHx7rXEdU/EudNZtKEAZ5uRHrLAD5hh ZIRUv6A+0P62a82KSnw+fGh5m7swM9YkS1BFZtkhxdcsAu5GLwh4ywSBoBvzWN3mFoSg 0N+blZBn/TkYvUupdnEfjj/mWujz8tifkkjTLA47g1o+Uii3GHksve0/8au8QvBnq6hE stME2Sxv1KRqyxUDE1nnRQPt/hoq4XfDCfVvoYU4aqgvibYDcsbWfVoJ0wa2L+0Sii/N IQLG2if/xF5xNRyeBjzgVtPnoh3EJSIsHO6121SC1FvQoSfIiiG19voN5iZY+cW1Ndqs GpSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Yzy7H0G0WI09NToG/3M3PGsN3ZzXzNj17W3uLaSVmn8=; b=dlIOv5M9D8KeMpK9E5WYW0pNbkJF2U2rbFpGiE9MJss1p/XtpwwhApq9ZS4tQIrMvB xSWpsqPtiqX8Qu8A1brJVZEerf8/wSK8pUQXsPHNzln1esD8a9pisWBux43Nh8Bdmfz6 //hFDrO53b1H9gUG7w0VcD401uymBm3uF2pnl3Oof7YEqiZ3laR9j0dGB4PR2I3EoWkU veSeQOv3J5gJphxX04xV+PZfDG0ie7u/6FbmL9diCKGeMKpl9vRhDRVVniNelnXErd/f 4Lg0fP/FREbkk/qU9T15XneKK/xrCXcPZ3XnvvWJCGdt/+AuaAgiiu7+Ld4/n6PGnPgN QobA== X-Gm-Message-State: AHQUAubUS+OyPzRYHCK9E/whOvF8OwlYB/Mq2YxyzUsxbWf/CmwxL5U7 NDk5/CQps7JxEpobWZSTdzwa+Q== X-Google-Smtp-Source: AHgI3IY70fDlTUhHMxs0i97SY6Iw9U1juSV7p9P/D8FC7eyEDbaxOq7kUWaJr+b6LIjhOU+EQzIDoA== X-Received: by 2002:a05:6000:1152:: with SMTP id d18mr4481308wrx.128.1550868305153; Fri, 22 Feb 2019 12:45:05 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Date: Fri, 22 Feb 2019 20:45:00 +0000 Message-Id: <20190222204500.24434-7-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190222204500.24434-1-alex.bennee@linaro.org> References: <20190222204500.24434-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::444 Subject: [Qemu-devel] [PATCH v1 6/6] softfloat: Support float_round_to_odd more places 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: =?UTF-8?q?Alex=20Benn=C3=A9e?= , qemu-s390x@nongnu.org, Richard Henderson , David Hildenbrand Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Richard Henderson Previously this was only supported for roundAndPackFloat64. New support in round_canonical, round_to_int, float128_round_to_int, roundAndPackFloat32, roundAndPackInt32, roundAndPackInt64, roundAndPackUint64. This does not include any of the floatx80 routines, as we do not have users for that rounding mode there. Signed-off-by: Richard Henderson Message-Id: <20190215170225.15537-1-richard.henderson@linaro.org> Tested-by: David Hildenbrand Signed-off-by: Alex Benn=C3=A9e --- fpu/softfloat.c | 64 ++++++++++++++++++++++++++++++++++++++++++---- tests/fp/fp-test.c | 43 ++++++++++++++++++++++++------- 2 files changed, 93 insertions(+), 14 deletions(-) diff --git a/fpu/softfloat.c b/fpu/softfloat.c index c69cd6b5d1..99c7cc2c3d 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -696,6 +696,7 @@ static FloatParts sf_canonicalize(FloatParts part, cons= t FloatFmt *parm, static FloatParts round_canonical(FloatParts p, float_status *s, const FloatFmt *parm) { + const uint64_t frac_lsb =3D parm->frac_lsb; const uint64_t frac_lsbm1 =3D parm->frac_lsbm1; const uint64_t round_mask =3D parm->round_mask; const uint64_t roundeven_mask =3D parm->roundeven_mask; @@ -731,6 +732,10 @@ static FloatParts round_canonical(FloatParts p, float_= status *s, inc =3D p.sign ? round_mask : 0; overflow_norm =3D !p.sign; break; + case float_round_to_odd: + overflow_norm =3D true; + inc =3D frac & frac_lsb ? 0 : round_mask; + break; default: g_assert_not_reached(); } @@ -778,9 +783,14 @@ static FloatParts round_canonical(FloatParts p, float_= status *s, shift64RightJamming(frac, 1 - exp, &frac); if (frac & round_mask) { /* Need to recompute round-to-even. */ - if (s->float_rounding_mode =3D=3D float_round_nearest_even= ) { + switch (s->float_rounding_mode) { + case float_round_nearest_even: inc =3D ((frac & roundeven_mask) !=3D frac_lsbm1 ? frac_lsbm1 : 0); + break; + case float_round_to_odd: + inc =3D frac & frac_lsb ? 0 : round_mask; + break; } flags |=3D float_flag_inexact; frac +=3D inc; @@ -1988,6 +1998,9 @@ static FloatParts round_to_int(FloatParts a, int rmod= e, case float_round_down: one =3D a.sign; break; + case float_round_to_odd: + one =3D true; + break; default: g_assert_not_reached(); } @@ -2021,6 +2034,9 @@ static FloatParts round_to_int(FloatParts a, int rmod= e, case float_round_down: inc =3D a.sign ? rnd_mask : 0; break; + case float_round_to_odd: + inc =3D a.frac & frac_lsb ? 0 : rnd_mask; + break; default: g_assert_not_reached(); } @@ -3314,6 +3330,9 @@ static int32_t roundAndPackInt32(flag zSign, uint64_t= absZ, float_status *status case float_round_down: roundIncrement =3D zSign ? 0x7f : 0; break; + case float_round_to_odd: + roundIncrement =3D absZ & 0x80 ? 0 : 0x7f; + break; default: abort(); } @@ -3368,6 +3387,9 @@ static int64_t roundAndPackInt64(flag zSign, uint64_t= absZ0, uint64_t absZ1, case float_round_down: increment =3D zSign && absZ1; break; + case float_round_to_odd: + increment =3D !(absZ0 & 1) && absZ1; + break; default: abort(); } @@ -3424,6 +3446,9 @@ static int64_t roundAndPackUint64(flag zSign, uint64_= t absZ0, case float_round_down: increment =3D zSign && absZ1; break; + case float_round_to_odd: + increment =3D !(absZ0 & 1) && absZ1; + break; default: abort(); } @@ -3526,6 +3551,8 @@ static float32 roundAndPackFloat32(flag zSign, int zE= xp, uint32_t zSig, case float_round_down: roundIncrement =3D zSign ? 0x7f : 0; break; + case float_round_to_odd: + roundIncrement =3D zSig & 0x80 ? 0 : 0x7f; default: abort(); break; @@ -3536,8 +3563,10 @@ static float32 roundAndPackFloat32(flag zSign, int z= Exp, uint32_t zSig, || ( ( zExp =3D=3D 0xFD ) && ( (int32_t) ( zSig + roundIncrement ) < 0 ) ) ) { + bool overflow_to_inf =3D roundingMode !=3D float_round_to_odd = && + roundIncrement !=3D 0; float_raise(float_flag_overflow | float_flag_inexact, status); - return packFloat32( zSign, 0xFF, - ( roundIncrement =3D=3D 0 )= ); + return packFloat32(zSign, 0xFF, -!overflow_to_inf); } if ( zExp < 0 ) { if (status->flush_to_zero) { @@ -3555,6 +3584,13 @@ static float32 roundAndPackFloat32(flag zSign, int z= Exp, uint32_t zSig, if (isTiny && roundBits) { float_raise(float_flag_underflow, status); } + if (roundingMode =3D=3D float_round_to_odd) { + /* + * For round-to-odd case, the roundIncrement depends on + * zSig which just changed. + */ + roundIncrement =3D zSig & 0x80 ? 0 : 0x7f; + } } } if (roundBits) { @@ -6987,6 +7023,15 @@ float128 float128_round_to_int(float128 a, float_sta= tus *status) add128(z.high, z.low, 0, roundBitsMask, &z.high, &z.low); } break; + case float_round_to_odd: + /* + * Note that if lastBitMask =3D=3D 0, the last bit is the lsb + * of high, and roundBitsMask =3D=3D -1. + */ + if ((lastBitMask ? z.low & lastBitMask : z.high & 1) =3D=3D 0)= { + add128(z.high, z.low, 0, roundBitsMask, &z.high, &z.low); + } + break; default: abort(); } @@ -6998,7 +7043,7 @@ float128 float128_round_to_int(float128 a, float_stat= us *status) status->float_exception_flags |=3D float_flag_inexact; aSign =3D extractFloat128Sign( a ); switch (status->float_rounding_mode) { - case float_round_nearest_even: + case float_round_nearest_even: if ( ( aExp =3D=3D 0x3FFE ) && ( extractFloat128Frac0( a ) | extractFloat128Frac1( a ) ) @@ -7011,14 +7056,17 @@ float128 float128_round_to_int(float128 a, float_st= atus *status) return packFloat128(aSign, 0x3FFF, 0, 0); } break; - case float_round_down: + case float_round_down: return aSign ? packFloat128( 1, 0x3FFF, 0, 0 ) : packFloat128( 0, 0, 0, 0 ); - case float_round_up: + case float_round_up: return aSign ? packFloat128( 1, 0, 0, 0 ) : packFloat128( 0, 0x3FFF, 0, 0 ); + + case float_round_to_odd: + return packFloat128(aSign, 0x3FFF, 0, 0); } return packFloat128( aSign, 0, 0, 0 ); } @@ -7051,6 +7099,12 @@ float128 float128_round_to_int(float128 a, float_sta= tus *status) z.high +=3D roundBitsMask; } break; + case float_round_to_odd: + if ((z.high & lastBitMask) =3D=3D 0) { + z.high |=3D (a.low !=3D 0); + z.high +=3D roundBitsMask; + } + break; default: abort(); } diff --git a/tests/fp/fp-test.c b/tests/fp/fp-test.c index 4114f346a9..7d0faf2b47 100644 --- a/tests/fp/fp-test.c +++ b/tests/fp/fp-test.c @@ -125,17 +125,42 @@ static void not_implemented(void) =20 static bool blacklisted(unsigned op, int rmode) { - /* odd has only been implemented for a few 128-bit ops */ + /* odd has not been implemented for any 80-bit ops */ if (rmode =3D=3D softfloat_round_odd) { switch (op) { - case F128_ADD: - case F128_SUB: - case F128_MUL: - case F128_DIV: - case F128_TO_F64: - case F128_SQRT: - return false; - default: + case EXTF80_TO_UI32: + case EXTF80_TO_UI64: + case EXTF80_TO_I32: + case EXTF80_TO_I64: + case EXTF80_TO_UI32_R_MINMAG: + case EXTF80_TO_UI64_R_MINMAG: + case EXTF80_TO_I32_R_MINMAG: + case EXTF80_TO_I64_R_MINMAG: + case EXTF80_TO_F16: + case EXTF80_TO_F32: + case EXTF80_TO_F64: + case EXTF80_TO_F128: + case EXTF80_ROUNDTOINT: + case EXTF80_ADD: + case EXTF80_SUB: + case EXTF80_MUL: + case EXTF80_DIV: + case EXTF80_REM: + case EXTF80_SQRT: + case EXTF80_EQ: + case EXTF80_LE: + case EXTF80_LT: + case EXTF80_EQ_SIGNALING: + case EXTF80_LE_QUIET: + case EXTF80_LT_QUIET: + case UI32_TO_EXTF80: + case UI64_TO_EXTF80: + case I32_TO_EXTF80: + case I64_TO_EXTF80: + case F16_TO_EXTF80: + case F32_TO_EXTF80: + case F64_TO_EXTF80: + case F128_TO_EXTF80: return true; } } --=20 2.20.1