From nobody Tue Feb 10 02:28:09 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1498514891357187.83691864238983; Mon, 26 Jun 2017 15:08:11 -0700 (PDT) Received: from localhost ([::1]:49219 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dPcAz-0002by-Tk for importer@patchew.org; Mon, 26 Jun 2017 18:08:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56781) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dPc7C-0007Eh-8q for qemu-devel@nongnu.org; Mon, 26 Jun 2017 18:04:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dPc79-0005Cv-44 for qemu-devel@nongnu.org; Mon, 26 Jun 2017 18:04:14 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:58590) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dPc78-0005By-QL for qemu-devel@nongnu.org; Mon, 26 Jun 2017 18:04:11 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue103 [212.227.15.183]) with ESMTPSA (Nemesis) id 0MXnnj-1dDuOs1vhn-00Wqjb; Tue, 27 Jun 2017 00:03:37 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Tue, 27 Jun 2017 00:03:27 +0200 Message-Id: <20170626220330.6785-5-laurent@vivier.eu> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170626220330.6785-1-laurent@vivier.eu> References: <20170626220330.6785-1-laurent@vivier.eu> X-Provags-ID: V03:K0:oam3qc2P6zh8G43IeIvKnnjcMtiN1i2CwH9Y/bTaKY8bUTsWz8c Tjt6bBQxzCqacU3HM8k+AJBq8dLu2s8hVl44OfoF4UdlMgH5t9I7pbDZNWTf3ftq7nQZIh7 K3Zz1mJef2vpkFcyaKXyvCfxKeIl9QgTtiw4bqonbfeRgg31zPN0SqFzgaBDqei8IM3ZMmN YsbmdWn2dqxTTPqUqWz8g== X-UI-Out-Filterresults: notjunk:1;V01:K0:epriH0SiC6M=:iwis15AvMgmrwmC7KhfYq0 eAUiS9aj6lBbfYF82VXJODHeHqpEpnqprAFZHrMEfbgv6Zy2oA88Vf720L5nJbqDEWtZk1/+1 j/H5UM8/2zibOv7qz6BCUqAV3VhC5KYaBRS+KOuJFWoxGRkzq8E2NWmx/hjNrNa58J+at1s4z DsxZEDkG3KFJsI6OdIWu9imewfZY0adUo+kg3OV+YNIrJOJ33jXHj93T30drDtlL8un86+C8k /hDx5WGjhqTfm9ltNUEBy2cFRy7jvjGru666pxoGn6y9/79rwM0vEDste2Nie/LuspyoTUXaS fiN8y3g1BdSCyjbpPw3xm6A/XjsMh5VqrnRzBuo1A4q1kdBzB0TnCRkJwPuh4F41ETJ/uD0+h m9KbxnoLUCyRbj+N5fYzHzAcMVArM/MFXv+cfJlmLEEgJzMi+eNMC3+VZU76bACiXP+7uy3+j bzybkGpxePezIIxEXzxCsdI2aLPp+k0q/XSmlu7vrHXMtZdWBgdBy5QagXmyZK/CR5WltTSbw L37mxS0J4nwCiNCGpcHb7NOhvlKi5zQRBf7AHDRzw/pFvNEqv6zwr/HSTOlxVSd5UuZYLRcF2 NzrORD68Se5NByuJESuhwS40W7RvQDvZQ8UyDhI6Rr3FYr50VjH582MXqNXW8LolWmtR8rLw3 wEpPcOr5Dhq/qA6ssVV2pYIetvlilbHJJt1Di+rHCpkqYNFLQMZLUx5balE2p4KSgwnw= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 217.72.192.75 Subject: [Qemu-devel] [PATCH v2 4/7] softfloat: define floatx80_round() 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: Laurent Vivier , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Aurelien Jarno , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Add a function to round a floatx80 to the defined precision (floatx80_rounding_precision) Signed-off-by: Laurent Vivier Reviewed-by: Richard Henderson --- fpu/softfloat.c | 15 +++++++++++++++ include/fpu/softfloat.h | 1 + 2 files changed, 16 insertions(+) diff --git a/fpu/softfloat.c b/fpu/softfloat.c index 7af14e2..e9bf359 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -5086,6 +5086,21 @@ float128 floatx80_to_float128(floatx80 a, float_stat= us *status) } =20 /*------------------------------------------------------------------------= ---- +| Rounds the extended double-precision floating-point value `a' +| and returns the result as an extended double-precision floating-point +| value. The operation is performed according to the IEC/IEEE Standard for +| Binary Floating-Point Arithmetic. +*-------------------------------------------------------------------------= ---*/ + +floatx80 floatx80_round(floatx80 a, float_status *status) +{ + return roundAndPackFloatx80(status->floatx80_rounding_precision, + extractFloatx80Sign(a), + extractFloatx80Exp(a), + extractFloatx80Frac(a), 0, status); +} + +/*------------------------------------------------------------------------= ---- | Rounds the extended double-precision floating-point value `a' to an inte= ger, | and returns the result as an extended quadruple-precision floating-point | value. The operation is performed according to the IEC/IEEE Standard for diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h index f1288ef..d9689ec 100644 --- a/include/fpu/softfloat.h +++ b/include/fpu/softfloat.h @@ -621,6 +621,7 @@ float128 floatx80_to_float128(floatx80, float_status *s= tatus); /*------------------------------------------------------------------------= ---- | Software IEC/IEEE extended double-precision operations. *-------------------------------------------------------------------------= ---*/ +floatx80 floatx80_round(floatx80 a, float_status *status); floatx80 floatx80_round_to_int(floatx80, float_status *status); floatx80 floatx80_add(floatx80, floatx80, float_status *status); floatx80 floatx80_sub(floatx80, floatx80, float_status *status); --=20 2.9.4