From patchwork Wed Jul 17 00:09:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 33716 Received: (qmail 20466 invoked by alias); 17 Jul 2019 00:12:24 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 20369 invoked by uid 89); 17 Jul 2019 00:12:23 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT autolearn=ham version=3.3.1 spammy= X-HELO: esa6.hgst.iphmx.com DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1563322340; x=1594858340; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=UW4838tq7ILqH4/YEJS1gZhfCT3QI97q/egFGpctKI8=; b=XNnl5LtnRxv8s9YKYvJjxc52MRkAT+gikFyjtxvfTjWdQXzndp9fsaPt UJP+xG15g4ATqxfesZuo/2sI7WNvomzVTiF7CUiAWJpznVcC/0Rt5H5PL XPKluuf1Qkcusz1UC4yw5sftURFTQparzISQYcqyQ9VjoXUAtYxVYVoE7 1uTkl44H7nCdglV+ASYTO11u9XHYpaBkm8FI24bon4P3182jeEmtBziOx JP3GahIFiyWYp8rDS06jNs20TOKoxKtPuBZioU1i7e2eH6TimUSDznW+a 9gG4vqLWE9H80TR6zuubl2FH2xWmBILEw1/IJtNiNe/H+qpHhSc2Q3K2I A==; IronPort-SDR: EZwDuvK2B2I1wj4lWFXU2dGn+/Af13lZOViWJvCrpWCW0jtF0HHL8R7rCMaPKRKDH3k6AqXiBK Wj+7DJGt3Luf0JIGluG86ncw0IAdkVu4ouGS+cJmJdiex8lOUmu+LqzKBxpFW4F5wcM2uPswWg V5rrSXF0GAzYFjFJT5JD4oFde4r0hUGIsxABSrQzOtcRLItiB8x5PxU+/dTZ6gPdEUH/d9gnyV UGjExZlWgiitXd+FTBeQr4rqaN2JOHGdX4K9+1zhCaxIpTbmNL9lwLvHQZwNltXyEpSqMVL34m B/k= IronPort-SDR: tDXr8U3FkkSPz7qJgdIFRw8VRQ5xTH6ZngVYiU4sbmKkmYdCBjqMCETIC+OsYJ1YaWT18iJXF3 ghmNghjHutXy2/g0o2Wh3EahxO1xHdnJtNEAC/oA27qEPFLjN7eLLquhXYEP1GMaQU5+YvEdB9 OKWOOFvdB6pu5sknlHUrnEloQ5Vf46nga2KHdGUAbix5JSwXASq8d6tyjCs3HM0pzoaN/JkmFM OqQu0eDupkaFcEZJpr5inSgNAzqXRsdH07xj2LfDnjaEKz+gQZDcj341BoUx3BDonrDgGtS9vn IcK8BUKzLKlM1BDL9zNjF2Zz IronPort-SDR: wPd8w0s4SwKt1+rHJ7kjN7ioL26dZqIZk2OoTna4azNpuB8IsHKiiqE+V7KWngQt12a7YafKiE VPhppoaalrDWNhoLqyQtWruGYQ3woLNmAX5f5zr3qGr3SiPM4egsna6HnGUxWw1c7tvcHOOQ5R kApKKCqTUiDRhouwetAnyUuOYYoVIymlQg/2uUR9MK/cqyh6kOKnaIQtmTLX57Qan2DEnpoGHa Vvrt92ArWxZbjdcNLTL/kLXoGnN/9WhvBsvxpJWGx8YiGzshgdwxVjtT3rMBM3ZpePm9hGV4jS mgM= From: Alistair Francis To: libc-alpha@sourceware.org Cc: arnd@arndb.de, adhemerval.zanella@linaro.org, fweimer@redhat.com, palmer@sifive.com, macro@wdc.com, zongbox@gmail.com, alistair.francis@wdc.com, alistair23@gmail.com Subject: [RFC v3 17/23] RISC-V: Hard float support for the 32 bit Date: Tue, 16 Jul 2019 17:09:26 -0700 Message-Id: <06af644b9e498dd7496b06cda922650ffa1c90b0.1563321716.git.alistair.francis@wdc.com> In-Reply-To: References: MIME-Version: 1.0 From: Zong Li This patch contains hardware floating-point support for the RV32IF and RV32IFD 2018-11-29 Zong Li * sysdeps/riscv/rv32/rvd/s_lrint.c: New file. * sysdeps/riscv/rv32/rvd/s_lround.c: Likewise. * sysdeps/riscv/rv32/rvf/s_lrintf.c: Likewise. * sysdeps/riscv/rv32/rvf/s_lroundf.c: Likewise. --- ChangeLog | 4 ++++ sysdeps/riscv/rv32/rvd/s_lrint.c | 31 ++++++++++++++++++++++++++++++ sysdeps/riscv/rv32/rvd/s_lround.c | 31 ++++++++++++++++++++++++++++++ sysdeps/riscv/rv32/rvf/s_lrintf.c | 31 ++++++++++++++++++++++++++++++ sysdeps/riscv/rv32/rvf/s_lroundf.c | 31 ++++++++++++++++++++++++++++++ 5 files changed, 128 insertions(+) create mode 100644 sysdeps/riscv/rv32/rvd/s_lrint.c create mode 100644 sysdeps/riscv/rv32/rvd/s_lround.c create mode 100644 sysdeps/riscv/rv32/rvf/s_lrintf.c create mode 100644 sysdeps/riscv/rv32/rvf/s_lroundf.c diff --git a/ChangeLog b/ChangeLog index e0446d70a0..9c61de6470 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1051,6 +1051,10 @@ * sysdeps/riscv/sfp-machine.h: Likewise. * sysdeps/riscv/sys/asm.h: Likewise. * sysdeps/unix/sysv/linux/riscv/rv32/jmp_buf-macros.h: New file. + * sysdeps/riscv/rv32/rvd/s_lrint.c: New file. + * sysdeps/riscv/rv32/rvd/s_lround.c: Likewise. + * sysdeps/riscv/rv32/rvf/s_lrintf.c: Likewise. + * sysdeps/riscv/rv32/rvf/s_lroundf.c: Likewise. 2019-06-20 Dmitry V. Levin Florian Weimer diff --git a/sysdeps/riscv/rv32/rvd/s_lrint.c b/sysdeps/riscv/rv32/rvd/s_lrint.c new file mode 100644 index 0000000000..4d5bdbc200 --- /dev/null +++ b/sysdeps/riscv/rv32/rvd/s_lrint.c @@ -0,0 +1,31 @@ +/* lrint(). RISC-V version. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#include +#include +#include + +long int +__lrint (double x) +{ + int32_t res; + asm ("fcvt.w.d %0, %1" : "=r" (res) : "f" (x)); + return res; +} + +libm_alias_double (__lrint, lrint) diff --git a/sysdeps/riscv/rv32/rvd/s_lround.c b/sysdeps/riscv/rv32/rvd/s_lround.c new file mode 100644 index 0000000000..f5d9cf2e07 --- /dev/null +++ b/sysdeps/riscv/rv32/rvd/s_lround.c @@ -0,0 +1,31 @@ +/* lround(). RISC-V version. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#include +#include +#include + +long int +__lround (double x) +{ + int32_t res; + asm ("fcvt.w.d %0, %1, rmm" : "=r" (res) : "f" (x)); + return res; +} + +libm_alias_double (__lround, lround) diff --git a/sysdeps/riscv/rv32/rvf/s_lrintf.c b/sysdeps/riscv/rv32/rvf/s_lrintf.c new file mode 100644 index 0000000000..08d44fa738 --- /dev/null +++ b/sysdeps/riscv/rv32/rvf/s_lrintf.c @@ -0,0 +1,31 @@ +/* lrintf(). RISC-V version. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#include +#include +#include + +long int +__lrintf (float x) +{ + int32_t res; + asm ("fcvt.w.s %0, %1" : "=r" (res) : "f" (x)); + return res; +} + +libm_alias_float (__lrint, lrint) diff --git a/sysdeps/riscv/rv32/rvf/s_lroundf.c b/sysdeps/riscv/rv32/rvf/s_lroundf.c new file mode 100644 index 0000000000..f31b432936 --- /dev/null +++ b/sysdeps/riscv/rv32/rvf/s_lroundf.c @@ -0,0 +1,31 @@ +/* lroundf(). RISC-V version. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#include +#include +#include + +long int +__lroundf (float x) +{ + int32_t res; + asm ("fcvt.w.s %0, %1, rmm" : "=r" (res) : "f" (x)); + return res; +} + +libm_alias_float (__lround, lround)