From patchwork Sat Dec 1 03:10:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zong Li X-Patchwork-Id: 30497 Received: (qmail 124391 invoked by alias); 1 Dec 2018 03:13: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 124250 invoked by uid 89); 1 Dec 2018 03:13:30 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-spam-relays-external:209.85.210.194, H*RU:209.85.210.194 X-HELO: mail-pf1-f194.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=5I7OZGR3EO7nE9LoRl4gJYF+G443ZgpDT+p/iDWNZ+k=; b=Tnzk/cRpV8GM6elmo/9MPbQK6+Ml3UiNf1mIJqYaOcoy2UEY4nfPzrC11bvBuQzRcY GcVInOl4PmPo5KbGp3ZuL0IWJQ91Gnc5Y0wXmOT3vH2FvgKuK7qJ7Z2cEaUfTsELDxPV DP67d8X24AYqa+eI6SokLvegXHCDsv2NpItwTJ9b0Us8/T4wF8eJiujP/nz0Y2bQEQi/ e0kwqu5USV5droItolOBcEp7tcnuswFPjNjZ7TgnOz+9pFCAvBzHfRda3VlzZCozVmzk PZ0m8HG+Z/4uZEldQmnW+WeEC1ytO1UdUVQWFPuBDklk7FI7WY7wJSehfKdcmc/DesKB M5ng== Return-Path: From: Zong Li To: joseph@codesourcery.com, palmer@dabbelt.com, darius@bluespec.com, andrew@sifive.com, dj@redhat.com, libc-alpha@sourceware.org Cc: zong@andestech.com, Zong Li Subject: [PATCH v4 05/10] RISC-V: Hard float support for the 32 bit Date: Sat, 1 Dec 2018 11:10:48 +0800 Message-Id: <45090c136a32bc5607fb8f66c01b1cae73d5cc86.1543572707.git.zongbox@gmail.com> In-Reply-To: References: 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 26fa985..b038a2e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,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. 2018-11-28 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 0000000..4d5bdbc --- /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 0000000..f5d9cf2 --- /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 0000000..08d44fa --- /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 0000000..f31b432 --- /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)