From patchwork Sun Jul 12 15:47:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 40057 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 BD36F3860C37; Sun, 12 Jul 2020 15:57:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BD36F3860C37 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1594569451; bh=0pCmMcDI3+/LGw5UyS9Wt50/Lr59AuFGv4JfsvobLcc=; 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=jH9+ZkhYSqBifbgLIQIvkZwD3yZBRz5XlwX2ljCOX7mEZ0Ts0WirfbluD2/bbDP60 86EE9GNTG7XzM+bSCIBGKUhnGbsJuN6InhLNkJtMb9COEw4q5VOfUENRGc5rvh7c69 WBxv+mHKztxYRTLsdj5qSrGMBMRRTnTq4zvE8Iy0= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from esa5.hgst.iphmx.com (esa5.hgst.iphmx.com [216.71.153.144]) by sourceware.org (Postfix) with ESMTPS id 547CA3851C13 for ; Sun, 12 Jul 2020 15:57:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 547CA3851C13 IronPort-SDR: ljzJyRsmbPiVCseHnkhEjE/h4wdS7+JmiMyJt18ujRoydtXo8qqm6vETnGzRbVFvO5f5Qy3QBs UpEmlaxUErsGNK36plGWW7AbBJRSNquEN/omo19T/UK5hkfIUApps9MPo2ffsUrzSpOsFjNZjz WKKVb1val7QMSgrUoKa9zfAJMo9iFsuckXQBSH8/bzzXL3GZfTHeM7MQmWMhYY6KOtJRtKcExa eIZFHk3GW95JjSylJdR7eFSz0icCSGEgb9fM8ddb0/lgcLq9dmPpMnbwVgt1YIycwxbLVELuz4 SEE= X-IronPort-AV: E=Sophos;i="5.75,344,1589212800"; d="scan'208";a="142401281" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 12 Jul 2020 23:57:28 +0800 IronPort-SDR: q/zg4O53cuZDxraofFguy7XH8hDf/sXhf5q73esn/KSlekuttKtcicQbo7cgRjQtwn674xz2+A 3XQmEdvhbv5vf9pjMesjWspjYhjZv5QF8= Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jul 2020 08:45:59 -0700 IronPort-SDR: Awxaf/w4Bc24DJhlbGyTk6WdoKuyUBHIGwIBVWKeJdAhKUC/zxEVsTtOdniqg1/XsdEZGN0W2U 1ZDmrTj/Xo3g== WDCIronportException: Internal Received: from usa002626.ad.shared (HELO risc6-mainframe.hgst.com) ([10.86.57.178]) by uls-op-cesaip02.wdc.com with ESMTP; 12 Jul 2020 08:57:28 -0700 To: libc-alpha@sourceware.org Subject: [PATCH v3 14/19] RISC-V: Fix llrint and llround missing exceptions on RV32 Date: Sun, 12 Jul 2020 08:47:58 -0700 Message-Id: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Status: No, score=-14.4 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_PASS, 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..2ab1497587 --- /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) 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 */