From patchwork Sat Jun 22 04:37:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 33271 Received: (qmail 95309 invoked by alias); 22 Jun 2019 04:47:01 -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 95257 invoked by uid 89); 22 Jun 2019 04:47:00 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.0 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: esa5.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=1561178819; x=1592714819; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=VHmeihghKbRcdlddZQfSKEATHA99v2zyanVYcEBAa24=; b=VKdZZCurpVH3jHEqT3KuNitfdY3uMM6KhpohbQ1y3AWy5soaJmgPuqCn egzS0Xib9i3EQwBCFYd6vi2jcFyUNx16jjZ0u1TQ36tgXdHbQziNDyTn0 1n6uQNtTv599TtCtjtMgPCkYOEjEAj8w1EtFx4CgO6bHqJlgd/mhxceES jYB8dOaSIbwNAvk1Ohr4oybKcTbtMp943eoVvFR2LrjDzZG1BTZ4UWp9h j4gUAvtCY/Sh8NampQ7POsBooDodXLnxWzBDE0mRN7ixPybOCcvqpFy7p pbrzpMUieEayz4/tvV5PBK4sDgekWXOKcHE1Aaeqz4p2isqjSod0b5nKl A==; X-URL-LookUp-ScanningError: 1 IronPort-SDR: u8rHj9a4wXYxQ1RAafdBXj1VH33Ij8HnirNZ5SNtRnbkbhplNPG4HpdtrdMcp8TGZTR4h4HR9k v3WQZkqtomFWIr4N5d84cgFaFcu2zB1uHSBluJXfYZe7FL27huOnetMSjLP4FWGvySXvoUhIYn l41Ne7rNDH2tw4ko1a+a6HevV5cMIwYDtZx3aviKlUVqAVq205q/P6MljXDoml+xKnEuAbOGhG /McSFfTTt/aZi3m6khNNJ6qTmnRSe9LWV9ph3/QO5dg2Wn2nsHgbzxBRwVE6Qz+C/ylpyrNUQm 95Cqe3eRdmFVjueENA7Y75GQ IronPort-SDR: Z5A+q/2THKcNndF0ImNqB0A3fYrOUituFpNHBpeyfXHM2Eg7K+5Kbwfvmo4nbBPbJHVhbLxUr/ OqB0/ajprV14E505dCt0lkQXMloQLEE+QZN5DYJCENzop+4KUyeNMbOLmqpQWOrfPV8PXOeq5Z FUmDCo8MR1AKyZ4BbLAknt6Nl0Ei8kU3OkDSfpRs1OB2yWPDXlf5JMWIjsnYU4gQ3jtBkUWPJm 7nyYV/bO6Lt+xvNIq0blyrHVwU8CI+d4RH4Jfy1L7MPyR5Gtnr6bk0QSM43Mz1H/ZOFiBVTfTG z/w= From: Alistair Francis To: libc-alpha@sourceware.org Cc: alistair.francis@wdc.com, alistair23@gmail.com Subject: [RFC v1 11/16] RISC-V: Hard float support for the 32 bit Date: Fri, 21 Jun 2019 21:37:41 -0700 Message-Id: <6eb99f9355903ed42aa0799829dc0f6fd1f2377d.1561177967.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 2ee614e093..26aa28ed4e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -29,6 +29,10 @@ * sysdeps/riscv/sys/asm.h: Likewise. * sysdeps/unix/sysv/linux/riscv/rv32/jmp_buf-macros.h: New file. * sysdeps/unix/sysv/linux/riscv/rv32/lockf64.c: Likewise. + * 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)