From patchwork Tue Jun 27 19:12:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 781347 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wxwYx1yVrz9s2G for ; Wed, 28 Jun 2017 05:13:24 +1000 (AEST) Received: from localhost ([::1]:57756 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dPvvN-0006Kd-LK for incoming@patchwork.ozlabs.org; Tue, 27 Jun 2017 15:13:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39472) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dPvuv-0006KM-01 for qemu-devel@nongnu.org; Tue, 27 Jun 2017 15:12:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dPvur-0001Mr-QO for qemu-devel@nongnu.org; Tue, 27 Jun 2017 15:12:52 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:50871) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dPvur-0001LH-Gf for qemu-devel@nongnu.org; Tue, 27 Jun 2017 15:12:49 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue104 [212.227.15.183]) with ESMTPSA (Nemesis) id 0LbJZC-1e9OkR2ffe-00kvJy; Tue, 27 Jun 2017 21:12:29 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Tue, 27 Jun 2017 21:12:18 +0200 Message-Id: <20170627191221.31650-5-laurent@vivier.eu> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170627191221.31650-1-laurent@vivier.eu> References: <20170627191221.31650-1-laurent@vivier.eu> X-Provags-ID: V03:K0:kghYLlKh/o4qSbHNXr4sfUx+wtcUGFFwxD1Qf6k8zsLRohIOGAl zCrImexBM5EElAk0YdWxhKoKbyXoulCn03HDEGujogljJYfMs5B6Kh3ilMfgvZbKRmyZNOO nXPi6GCXpHcQQioP8zpD0GV2lmjXtk9yE+En69rn2OIcOzloyZhZMeXD80tk58KQRBX6vZV Ad0kVFq5uJG5Ugu+D6VSw== X-UI-Out-Filterresults: notjunk:1; V01:K0:EfOnvb9gxrE=:TCsrMYFIoeDsvzRiok/pg/ RONZ/TlzrAkxSIEVK3F0c5NGiHna4vEKmFA+pfDjTc+8uerw4y9kiXVjccTeU+DXw1Vw9DAkT SWUVj3+NBiV5wLqcLulGaqHksk/N3jFrhhzprFjpG7tbm3pJCxmmAqikUYhkDl6RpKxdOopD3 SdAtqlo+POp0YNaWdooUaKUm3N86EeyCCOmHirFQpbkM+PLKwq/Ns35IBUmmJ3wpYf2b/cjqo wmtl3R80dsxt/u2R3lRIUOD/fKbBpdnYDRWeoqM84tHfXC8ljA1Mx44jpvR7JB/4xamSSd0VA yfnu09LxYTUHLrSFjCxroGvh8wCt72Hq/nuVwDY5pgf2tAYO3NOyriFkK79+UBioitl7VDKEC Jy+5oeso9OjpNBsmOCUDgF787QSz43mbym7SYqrEAgE0TL0adIUWODbK3g3evm29usXabeHvK BFxpOdql5QddPrEI37KvhmPv22+nqpytM9JCkIlbQTZlXg0x6jU2mrB/aaUyp4kc8It3CXxTC ngm0BBGXG7R76vxR2OG3AGtcAAirEsHl+IG8qxYIejLAXbHyihSMgySbdMUORwmO+RduvcDzF +0valQUMUDwUwUkg3Z/KNY96P7oCb5EgJbme1KNKaZLxd84VREmEe+F3VvOxERcVHH+tfvC8a tJ3z4buVOUSbLPNlZRJk8aygLosiVsKtBWNbVHf2jcbDK8V7eCX/cvNgR0nwKm4obWjU= 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 v3 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 | 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_status *status) } /*---------------------------------------------------------------------------- +| 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 integer, | 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 *status); /*---------------------------------------------------------------------------- | 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);