From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4577 invoked by alias); 2 Aug 2012 08:51:38 -0000 Received: (qmail 4567 invoked by uid 22791); 2 Aug 2012 08:51:37 -0000 X-SWARE-Spam-Status: No, hits=-4.9 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-ob0-f175.google.com (HELO mail-ob0-f175.google.com) (209.85.214.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 02 Aug 2012 08:51:24 +0000 Received: by obcva7 with SMTP id va7so14572775obc.20 for ; Thu, 02 Aug 2012 01:51:23 -0700 (PDT) MIME-Version: 1.0 Received: by 10.182.167.41 with SMTP id zl9mr34468259obb.43.1343897483181; Thu, 02 Aug 2012 01:51:23 -0700 (PDT) Received: by 10.76.90.71 with HTTP; Thu, 2 Aug 2012 01:51:23 -0700 (PDT) In-Reply-To: References: Date: Thu, 02 Aug 2012 08:51:00 -0000 Message-ID: Subject: Re: ORDERED_EXPR in invert_tree_comparison From: Richard Guenther To: Marc Glisse Cc: gcc-patches@gcc.gnu.org Content-Type: text/plain; charset=ISO-8859-1 X-IsSubscribed: yes 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 X-SW-Source: 2012-08/txt/msg00073.txt.bz2 On Wed, Aug 1, 2012 at 9:21 PM, Marc Glisse wrote: > Hello, > > an opinion on this? > > (I just noticed: I'll update the list in the comment visible at the top of > the patch if this gets in). It looks ok to me but I am no floating-point expert. Can you add a testcase? Ok with that change. Thanks, Richard. > > On Thu, 19 Jul 2012, Marc Glisse wrote: > >> Hello, >> >> the simple patch below passes the testsuite after a c,c++ bootstrap >> without new regressions. Note however that >> >> #include >> int f(double a, double b){ >> return (!isunordered(a,b))&&(a> } >> >> is then optimized by ifcombine to "return (a> the absence of -fno-trapping-math. I don't know if there are ways to trigger >> this latent bug without the patch. >> >> >> >> 2012-06-15 Marc Glisse >> >> PR tree-optimization/53805 >> * fold-const.c (invert_tree_comparison): Do invert ORDERED_EXPR and >> UNORDERED_EXPR for floating point. >> >> --- fold-const.c (revision 189622) >> +++ fold-const.c (working copy) >> @@ -2096,13 +2096,14 @@ pedantic_non_lvalue_loc (location_t loc, >> It is generally not safe to do this for floating-point comparisons, >> except >> for EQ_EXPR and NE_EXPR, so we return ERROR_MARK in this case. */ >> >> enum tree_code >> invert_tree_comparison (enum tree_code code, bool honor_nans) >> { >> - if (honor_nans && flag_trapping_math && code != EQ_EXPR && code != >> NE_EXPR) >> + if (honor_nans && flag_trapping_math && code != EQ_EXPR && code != >> NE_EXPR >> + && code != ORDERED_EXPR && code != UNORDERED_EXPR) >> return ERROR_MARK; >> >> switch (code) >> { >> case EQ_EXPR: >> return NE_EXPR; > > > -- > Marc Glisse