From patchwork Thu Aug 29 16:50:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 34341 Received: (qmail 1523 invoked by alias); 29 Aug 2019 16:54:31 -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 1422 invoked by uid 89); 29 Aug 2019 16:54:30 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.6 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: esa4.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=1567097668; x=1598633668; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=JsVolrW5fxaG7n4sD6LzDOgufdwlrie8f5A+uymL7EM=; b=oa5eWlL241tLKN/3/7P5KtyMZ03IyO0TrZw1BG5IRwB3q2Nq01WOedvY h/hGZi2HBI9hCZWHIznQxCDrNqXHH83SDHL5fsXX88VR8d9HEur0hghxY yhRng+vy9L0kgwplhnu1fVxmq1vp4ACA1HSOLoADBxHxT/LAzHSUvTc0P OBcesKrxx5P3jQ/B3V8F5/kjuITdbKWBCA3p2KL6i9pK3pp4xRT3hNBT0 XpD0Db0NrNLrcIuvfSDSRyigMLNHYJ0QaUr35m1M7p36vP81ZZvZMmvTH 3z3j4ObGLo6yhyBzAWiro7zdQkgrtt31ZUW4nz9PDRxDlM72idXjPErWm g==; IronPort-SDR: 72jhMJOF3s/Z55LPm+0EbYp+IUVvm8RqD0r6urWOoK6d/wOAtXobstEwQnpZxLVJg0FVzQmJqp njCmr3YcddYkRR25wEP/DJMqhstq10qUIPH7hi2EhU3PtYH2h2E6rOvUp8PpG9iWq2+Mpk2zWA qdCj5IbbuaTRQPIpkqP7jILmZ/+MtFVwOPXkRcv5egKtMDaMZHiIJw1XmROl+VL+CmERXZIcf/ 523kWWd5g98hGTLR/ahqdpZg8PIXkjWb4l1B/bYIoRg9OzngIjY3bQQYi2LJKl6FGxWy1r2w4r aSs= IronPort-SDR: KwQ7NIw0uwOXMnk6BnmsMmnuQYFK0nnuGfyhReZxDxJdXn/DU/6f01mgzWUQK6xzeSG9fHAD/s sOe+VbxsuGZFiCmQFxAxXvSGI5Su4bxI6Ey1a66AkqakkkMhoXvmNtkdrFBVSa3BqKY5J+Uy7H FQ8vhUmluaKlyKPau2Uc+Xa0fUsA4Rm+TsSHk5CENZd687DZLukmy2Y3YYmV8iQu/8UoHQCdx3 8mK0jG/12g8eWalwuF9axglnuk0IOPIhPkjgH8dVw48RGhYHrBQ/2bImKhBVswOjVAEe+bw891 RCTcC2rJWrI6nZo/kN9IqfO4 IronPort-SDR: nvOP2BvYwyTSeU//SKPW8Q+RDQ1teRlgN7SFYq5yZI783duzOZ1d28IVQu0nnTbjdonPUW0k4x SfM+YUK1zOphwX9itOCjI83MYFngYf9ES2Td5X+1y7rp3walyj9jiUDMLxDqYiYsek2ZpxFgNE k2RRiAnhvTZFmiN6GTh23j674ts3KyX1zgks2asgcxgMzgDOe1Z87AT9KWtej2nN7jkg7hoSF5 DFOjWT1RGG3k1w09On3uKb3G9IFC8HiK7KlldUEN+P30xEzOAublJ2SOlTFRFG9Ay2LCEFg02f Z2I= WDCIronportException: Internal 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 v5 16/21] RISC-V: Hard float support for the 32 bit Date: Thu, 29 Aug 2019 09:50:43 -0700 Message-Id: <100c8604711c94ac504780d56a4e2a4952f3c90e.1567097252.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. --- 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 ++++++++++++++++++++++++++++++ 4 files changed, 124 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/sysdeps/riscv/rv32/rvd/s_lrint.c b/sysdeps/riscv/rv32/rvd/s_lrint.c new file mode 100644 index 00000000000..4d5bdbc200e --- /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 00000000000..f5d9cf2e070 --- /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 00000000000..08d44fa7385 --- /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 00000000000..f31b4329362 --- /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)