From patchwork Wed Jun 3 16:26:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 39448 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9DB1F388A82C; Wed, 3 Jun 2020 16:34:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9DB1F388A82C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1591202090; bh=ES66Hi/KOOMRMHYIGyjnEh2UGGwofK98jfnqQwxstSA=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=jfiSysmaK+4lDD7z8WeDcJ9FLdNM70HK/Ckf+MCzZED56zMrfLzY9bUgONltuUGkm RCyW0zUyjCmcrWSwrp/NIAUrw8aHeoCGUglQG+t87zSes5PZtjMpvNFiGQzjWhnbqz r1WWbIoKwODMqAK6RrZ+yVWza4NDZSAzgllG8N20= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from esa1.hgst.iphmx.com (esa1.hgst.iphmx.com [68.232.141.245]) by sourceware.org (Postfix) with ESMTPS id 6A826388B003 for ; Wed, 3 Jun 2020 16:34:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 6A826388B003 IronPort-SDR: 3qVnANN89qKGVsHIfwMsuGVwti6wfrf78dn7Nhy0X2+5yEHC5fe+jXLsbFHn9E/C0asgLQJT42 F3pr6QuFHvh93wUFI4ahYu2s7hIfjvW2Pbz+BmrxtCj93U4autYN4MTij3epNv8YDk+QdRxEIM /YCCuk+mTpjReGuyfnrI3ZDVh8qNU6g8vDv43g+t4Jq3jE1HncmDuJ94436l4Lw65IRfyOTrGx eBsAA6TBtlCAxwDOGuKUXnaSXuZHOPiC6tTqg9WMdso4xrdT71rQblRZVNXCXB91h1oiZcySbR n6A= X-IronPort-AV: E=Sophos;i="5.73,468,1583164800"; d="scan'208";a="248216399" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 04 Jun 2020 00:34:46 +0800 IronPort-SDR: 8Cv1aEL5e0OcYZNFVR0s0MQm7CwLWMcTFHAbP6x5Biz/mppvUVhBYR6EXlgSrNy7ZMOq700FOb FDLAtvNvkdRg92wjFwBbUSfNnW26j9de0= Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jun 2020 09:23:51 -0700 IronPort-SDR: CLADwQ8kJ+xGkdMfVELYVkxaFb6brPN8K4n/LAJ4kTMbL8V3judbZ4eLLrZpzQDkIs/Vs1mS+V 0GSNp7Y4SfRw== WDCIronportException: Internal Received: from cne220230.ad.shared (HELO risc6-mainframe.hgst.com) ([10.86.57.144]) by uls-op-cesaip02.wdc.com with ESMTP; 03 Jun 2020 09:34:46 -0700 To: libc-alpha@sourceware.org Subject: [PATCH v2 13/18] RISC-V: Fix llrint and llround missing exceptions on RV32 Date: Wed, 3 Jun 2020 09:26:01 -0700 Message-Id: <1ded17a7de68b0bd4923ec480863c64d6056dfe6.1591201405.git.alistair.francis@wdc.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Status: No, score=-15.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, KAM_SHORT, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Alistair Francis via Libc-alpha From: Alistair Francis Reply-To: Alistair Francis Cc: alistair.francis@wdc.com Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" From: Zong Li Similar to the fix for MIPS, ARM and S/390, RV32 is missing correct exception on overflow from llrint and llround functions because cast from floating-point types to long long do not result in correct exceptions on overflow. --- .../riscv/rv32/fix-fp-int-convert-overflow.h | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 sysdeps/riscv/rv32/fix-fp-int-convert-overflow.h diff --git a/sysdeps/riscv/rv32/fix-fp-int-convert-overflow.h b/sysdeps/riscv/rv32/fix-fp-int-convert-overflow.h new file mode 100644 index 0000000000..9137ee0fd8 --- /dev/null +++ b/sysdeps/riscv/rv32/fix-fp-int-convert-overflow.h @@ -0,0 +1,38 @@ +/* Fix for conversion of floating point to integer overflow. RISC-V version. + Copyright (C) 2015-2020 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 + . */ + +#ifndef FIX_FP_INT_CONVERT_OVERFLOW_H +#define FIX_FP_INT_CONVERT_OVERFLOW_H 1 + +/* The generic libgcc2.c conversions from floating point + to long long may not raise the correct exceptions on overflow (and + may raise spurious "inexact" exceptions even in non-overflow cases, + see ). */ +#define FIX_FLT_LONG_CONVERT_OVERFLOW 0 +#define FIX_FLT_LLONG_CONVERT_OVERFLOW 1 + +#define FIX_DBL_LONG_CONVERT_OVERFLOW 0 +#define FIX_DBL_LLONG_CONVERT_OVERFLOW 1 + +#define FIX_LDBL_LONG_CONVERT_OVERFLOW 0 +#define FIX_LDBL_LLONG_CONVERT_OVERFLOW 0 + +#define FIX_FLT128_LONG_CONVERT_OVERFLOW 0 +#define FIX_FLT128_LLONG_CONVERT_OVERFLOW 0 + +#endif /* fix-fp-int-convert-overflow.h */