From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7475 invoked by alias); 12 Aug 2019 17:07:23 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 7467 invoked by uid 89); 12 Aug 2019 17:07:22 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-14.5 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_NUMSUBJECT,SPF_PASS autolearn=ham version=3.3.1 spammy=ds, dld X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.110.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 12 Aug 2019 17:07:21 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 343DD15AB; Mon, 12 Aug 2019 10:07:20 -0700 (PDT) Received: from arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4B5E03F706; Mon, 12 Aug 2019 10:07:19 -0700 (PDT) Date: Mon, 12 Aug 2019 17:08:00 -0000 From: James Greenhalgh To: Wilco Dijkstra Cc: GCC Patches , Richard Earnshaw , Ramana Radhakrishnan , Richard Sandiford , nd Subject: Re: [PATCH][AArch64] Fix PR81800 Message-ID: <20190812170716.GD8207@arm.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-IsSubscribed: yes X-SW-Source: 2019-08/txt/msg00760.txt.bz2 On Tue, May 28, 2019 at 06:11:29PM +0100, Wilco Dijkstra wrote: > PR81800 is about the lrint inline giving spurious FE_INEXACT exceptions. > The previous change for PR81800 didn't fix this: when lrint is disabled > in the backend, the midend will simply use llrint. This actually makes > things worse since llrint now also ignores FE_INVALID exceptions! > The fix is to disable lrint/llrint on double if the size of a long is > smaller (ie. ilp32). > > Passes regress and bootstrap on AArch64. OK for commit? OK. Thanks, James > > ChangeLog > 2018-11-13 Wilco Dijkstra > > gcc/ > PR target/81800 > * gcc/config/aarch64/aarch64.md (lrint): Disable lrint pattern if GPF > operand is larger than a long int. > > testsuite/ > PR target/81800 > * gcc.target/aarch64/no-inline-lrint_3.c: New test. > > -- > > diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md > index 5a1894063a1ed2db1cc947c9c449d48808ed96ae..f08cd0930b3fc6527fbca218ad3c464f1ead0103 100644 > --- a/gcc/config/aarch64/aarch64.md > +++ b/gcc/config/aarch64/aarch64.md > @@ -6304,7 +6304,7 @@ (define_expand "lrint2" > [(match_operand:GPI 0 "register_operand") > (match_operand:GPF 1 "register_operand")] > "TARGET_FLOAT > - && ((GET_MODE_SIZE (mode) <= GET_MODE_SIZE (mode)) > + && ((GET_MODE_BITSIZE (mode) <= LONG_TYPE_SIZE) > || !flag_trapping_math || flag_fp_int_builtin_inexact)" > { > rtx cvt = gen_reg_rtx (mode); > diff --git a/gcc/testsuite/gcc.target/aarch64/no-inline-lrint_3.c b/gcc/testsuite/gcc.target/aarch64/no-inline-lrint_3.c > new file mode 100644 > index 0000000000000000000000000000000000000000..ca772cb999e7b6cfbd3f080111d3eb479d43f47b > --- /dev/null > +++ b/gcc/testsuite/gcc.target/aarch64/no-inline-lrint_3.c > @@ -0,0 +1,17 @@ > +/* { dg-do compile } */ > +/* { dg-require-effective-target ilp32 } */ > +/* { dg-options "-O3 -fno-math-errno -fno-fp-int-builtin-inexact" } */ > + > +#define TEST(name, float_type, int_type, fn) void f_##name (float_type x) \ > +{ \ > + volatile int_type b = __builtin_##fn (x); \ > +} > + > +TEST (dld, double, long, lrint) > +TEST (flf, float , long, lrintf) > + > +TEST (did, double, int, lrint) > +TEST (fif, float , int, lrintf) > + > +/* { dg-final { scan-assembler-times "fcvtzs\tw\[0-9\]+, \[d,s\]\[0-9\]+" 2 } } */ > +/* { dg-final { scan-assembler-times "bl\tlrint" 2 } } */ >