From patchwork Sun Jun 25 19:21:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 780497 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 3wwhwC4rXhz9s3w for ; Mon, 26 Jun 2017 05:24:59 +1000 (AEST) Received: from localhost ([::1]:43566 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dPD9V-0008MW-C7 for incoming@patchwork.ozlabs.org; Sun, 25 Jun 2017 15:24:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46760) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dPD6k-0005vu-31 for qemu-devel@nongnu.org; Sun, 25 Jun 2017 15:22:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dPD6f-0003n2-E0 for qemu-devel@nongnu.org; Sun, 25 Jun 2017 15:22:06 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:64682) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dPD6f-0003mq-3k for qemu-devel@nongnu.org; Sun, 25 Jun 2017 15:22:01 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue104 [212.227.15.183]) with ESMTPSA (Nemesis) id 0Mg6ir-1d4fRB19Xx-00NRiq; Sun, 25 Jun 2017 21:21:32 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Sun, 25 Jun 2017 21:21:23 +0200 Message-Id: <20170625192125.9992-6-laurent@vivier.eu> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170625192125.9992-1-laurent@vivier.eu> References: <20170625192125.9992-1-laurent@vivier.eu> X-Provags-ID: V03:K0:Ux3H12rrOw8FMlXS7V25eme2ehQ2RwiXY+Lsp3w6+hx8SPqVB9l Vu7JE/I2uG0MPU9zBY6wRed7/TP2zxdIh2Mb7e+592K4rDh3S7OqcYLozVFm6kOHVmQSzVV dB4OzFtqsMFq8qBsz/E0+Z2k9RSEt91bF0ZKytDMg7TIsXMNkWP/4BYHtLkDw/qRakB+Zlu CxRSME/8dvgbiGRAxGZog== X-UI-Out-Filterresults: notjunk:1; V01:K0:OjThE0W67EY=:8tSs8BmSxfqkqsNIcy52Zv OPHumnYAGvorQel3r1lIkML4OU6sewpUNDENHILiO9Ku8tR0qLiW1C1TfTZxeVg4+rq+VsBPh /88URpbUS+R3o6RK+wSFUpkxayM5XpgK4LOz5RAEcWrqQ2NgJ25bQuIo6B1PcY1xYxxPKVJ50 Y+8a/cvWsx4cuLLT47yyw0YI0DEMXOVP5FVJHFsiebafM8IY5O16iU42ZCYgv5MFgvWFkaXWr /kYCGEhXxaInss9n4TNIth5gz/1UjuDeYq5y9Otjfg7A24rIa0JEvzApSXiB9gUOSo6VheInG /VYqXLvwCP+fnWgUakwXJwxu3F153RDl5btxIx0/t1hyOysRB7C8l+6agGgKL3E+Ood1H0Wk+ K2S55nFfEuzUk9XvhpMJQO7DCtSznKHPGLyv1wkr/hACDv7/adQqGr+1NbkI86ZvpUFQmvMmZ oMWzhPZIl2dYehbWMf3Mwsf+o2pW86POul9RBLSNj4rpp3oHWwaCkhy54t8RDd/fx1ECcXRBF 9Cfx9Fj95RLtrbm7Oaowd0d/GIe7U/UnRB7NzUMTZHogIJk26Au7rjO27vylVosCb7agvJ9Ms aGGM0O85YcQotAZ1Lr74cWDveelwkr7mYxCqXiTOJC4Ezpy9h8v0w6JC+GN6/iJAtLtesms90 9FDMX30c/Q9YUK+Te5Ydyxh+0jymWl91vXZ/z97a7ZfKmeUXAfVT3bq2FHL5YshtJb54= 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 5/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 , 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: 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_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);