From patchwork Wed Aug 12 14:41:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 40261 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 9AD453844041; Wed, 12 Aug 2020 14:51:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9AD453844041 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1597243905; bh=TLybtM6ptHtc1N9e6O+iZ/LCteDsT4rdkiz+yc0x58Q=; 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=vwu1DoQJIAnLg7+jmYhA+sIZnc6byDKcr0fyV2ulCYTJ9g9q2MDYcABOX/KDlvZrm o0OX3tV9DjZS8IaoU82ZCSCKZI0ZGtL0UFMpzkS/NDPYdj5wi/46evXDGZWqPqIGe5 B/CAUnAF+LQQSO7IMs4q60LwUdXlODc6ReiyxMpY= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) by sourceware.org (Postfix) with ESMTPS id EB2623846416 for ; Wed, 12 Aug 2020 14:51:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org EB2623846416 IronPort-SDR: pV0YqI9e/rXBRXWYRXAj2ofJ7jYugawyWxnjsww5p5BWY6oxew3Id5sgcFvncxcXyNLPw32kXn TsF4lxLje61dQ4oBaXXme/YRqAc6TiG0rXMklnBwAZfrRRqAsZ9rBqyR5brPdrUuO3SgIBiDsq ckJ0vIFWBDi6bABveIIGVuniW+s3RS/9zul0CN+AOuefeAkrZ/IxhslJE+dEWODXqJWft+a0AS 2YY0HZufj7hS2ov8Pu2CcSUPLyBS8xmI9tQQ65EWgKtZ2rE3sBUwHS8VG+rT4q+IxhhZHPpeG4 VPk= X-IronPort-AV: E=Sophos;i="5.76,304,1592841600"; d="scan'208";a="144758234" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 12 Aug 2020 22:51:41 +0800 IronPort-SDR: klul0r2WQvZGNlXWVhrJvp82RPVrQf3S4thyZhw0NQK9kfnOr6/9vMyEN48OG++ynbX/rpPT0d SPKEr0MlvfTQ== 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 Aug 2020 07:39:33 -0700 IronPort-SDR: rjVVMUv+W9MyzxVc8+0gvFQevcgQVzYbfYUCJMZFpkIRfSQxdscuA2MjRXutedTMBMaXKp0KVn E1u+cqTOYQjA== WDCIronportException: Internal Received: from jbfyk72.ad.shared (HELO risc6-mainframe.hgst.com) ([10.86.59.14]) by uls-op-cesaip02.wdc.com with ESMTP; 12 Aug 2020 07:51:41 -0700 To: libc-alpha@sourceware.org Subject: [PATCH v4 13/18] RISC-V: Fix llrint and llround missing exceptions on RV32 Date: Wed, 12 Aug 2020 07:41:32 -0700 Message-Id: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Status: No, score=-13.7 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: macro@wdc.com, alistair.francis@wdc.com Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" From: Zong Li Conversions from a float to a long long on 32-bit RISC-V (RV32) may not raise the correct exceptions on overflow, it also may raise spurious "inexact" exceptions on non overflow cases. This patch fixes the problem, similary to the fix for MIPS, ARM and S390. --- .../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..ddf9e3c351 --- /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 */