From nobody Tue Feb 10 06:58:20 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 1498682874704345.65015717850804; Wed, 28 Jun 2017 13:47:54 -0700 (PDT) Received: from localhost ([::1]:35596 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dQJsP-00016K-C4 for importer@patchew.org; Wed, 28 Jun 2017 16:47:53 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39810) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dQJo6-0005ZL-9V for qemu-devel@nongnu.org; Wed, 28 Jun 2017 16:43:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dQJo3-0003Xz-7A for qemu-devel@nongnu.org; Wed, 28 Jun 2017 16:43:26 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:50845) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dQJo2-0003XB-Sh for qemu-devel@nongnu.org; Wed, 28 Jun 2017 16:43:23 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue104 [212.227.15.183]) with ESMTPSA (Nemesis) id 0McnL7-1d941p1O3l-00HxYu; Wed, 28 Jun 2017 22:42:48 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Wed, 28 Jun 2017 22:42:38 +0200 Message-Id: <20170628204241.32106-5-laurent@vivier.eu> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170628204241.32106-1-laurent@vivier.eu> References: <20170628204241.32106-1-laurent@vivier.eu> X-Provags-ID: V03:K0:CjfD7kJwSzIoYgpSqN/HWQVMPHG8Rt2l7OhlVueqIROOsSYk92W QBNV7LsRWpQrhPH+AJ0EJdNj97zGxPlZqH8ssQFTyIKp3RDCWy/5ilx4H9HqIwrN9+aNd9v DOc8WyzbhmkycU6mkQraCWlkqERMhZ2v3BBNftSxKK4wH1hL3XZs7qcw/eSC8WfAA4LJ6A0 WfV/B7vCqJiSm5ngyyt8Q== X-UI-Out-Filterresults: notjunk:1;V01:K0:K0yRDwOYfc0=:0/H3CKH80ueTiDTBQ//gXI 2eaGFoMoRi+AlTGaEauBHs8yb6YT8laDIVn6Ff2uzPsX8mHGJ9Bm9FRSr8btRXTjcVvNaw76x zSANpDdzk3DNzjfEBgI1wA4mpOT3Lg2uVtfzXbMZuRV5s35VQRcqT/fKPFt4udyLruJ474ld7 9DeM9TbGt+69hxHcIbZ6Rf+k/3PMtqvsGNuDoMH/pfRobZwG+wBj6PcaN6sybd4w0IVKKR8ar 0ClBvRANjmT/oHz7EXve98zjAtTkKLBifOc4YnwO3SK5ktsmokVFOCOxcZSEXQZUDLmr/5z79 xxQ4rgOvd4Dk0dWKcLcf6zz2U6zTrgTexJZgejIFoFJvS38U8u8k/Xi4Y/uvjjjs4s9VpG2nT cewvZh9uxlo1Fm2xObsTfRNBBbK9UIoGIu6ifqIFsTPVu4R5uPiCK0bKVreiEBvHIeapabkRo pVL+xUPExuM2BNLqrfnoAqFgJyWHUeZE7reNUAf+8WnQWrhWhM6jV0cr3VSfwzBJiKPC3DdF1 xNeeN++IZNBmdak0U7wCMbG/IcxAGzqhKSIL4tM8uH73y5O2GkBJlv9CJhLBj+1T5ruKlGuDX JtlQEyVu2OJbD+OIpif/nR/pMt2HKBxBNkmXlGml20Lr52rsNc6UlpVPGtdhx0uXRJuQDtCkn cDSBQ+C1Lbym2T4uY+flvqviCgBwSRQcw2utmTl3OOBRh5dWlSa/EpBJlAJFNqLyaQAk= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.17.13 Subject: [Qemu-devel] [PATCH v4 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 Reviewed-by: Aurelien Jarno --- fpu/softfloat.c | 16 ++++++++++++++++ include/fpu/softfloat.h | 1 + 2 files changed, 17 insertions(+) diff --git a/fpu/softfloat.c b/fpu/softfloat.c index 7af14e2..433c5da 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -5086,6 +5086,22 @@ float128 floatx80_to_float128(floatx80 a, float_stat= us *status) } =20 /*------------------------------------------------------------------------= ---- +| Rounds the extended double-precision floating-point value `a' +| to the precision provided by floatx80_rounding_precision 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