From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2101) id 31B8F3954C5A; Wed, 22 Apr 2020 22:16:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 31B8F3954C5A Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Alistair Francis To: glibc-cvs@sourceware.org Subject: [glibc/alistair/rv32.next] RISC-V: Fix llrint and llround missing exceptions on RV32 X-Act-Checkin: glibc X-Git-Author: Zong Li X-Git-Refname: refs/heads/alistair/rv32.next X-Git-Oldrev: 8b0850a29cd331aa43fc65f5157907aee2bcfff5 X-Git-Newrev: 5c3d1923735d4f425d3cb826819c23cb6d7ba569 Message-Id: <20200422221615.31B8F3954C5A@sourceware.org> Date: Wed, 22 Apr 2020 22:16:15 +0000 (GMT) X-BeenThere: glibc-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Glibc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Apr 2020 22:16:15 -0000 https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=5c3d1923735d4f425d3cb826819c23cb6d7ba569 commit 5c3d1923735d4f425d3cb826819c23cb6d7ba569 Author: Zong Li Date: Fri Nov 30 17:18:20 2018 +0800 RISC-V: Fix llrint and llround missing exceptions on RV32 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. Diff: --- sysdeps/riscv/rv32/fix-fp-int-convert-overflow.h | 38 ++++++++++++++++++++++++ 1 file changed, 38 insertions(+) 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 */