From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 41913 invoked by alias); 13 Apr 2015 12:36:59 -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 41903 invoked by uid 89); 13 Apr 2015 12:36:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.2 required=5.0 tests=AWL,BAYES_50,FREEMAIL_FROM,KAM_ASCII_DIVIDERS,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=no version=3.3.2 X-HELO: mail-vn0-f52.google.com Received: from mail-vn0-f52.google.com (HELO mail-vn0-f52.google.com) (209.85.216.52) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Mon, 13 Apr 2015 12:36:58 +0000 Received: by vnbg190 with SMTP id g190so19140092vnb.12 for ; Mon, 13 Apr 2015 05:36:55 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.60.34.193 with SMTP id b1mr11950188oej.19.1428928615739; Mon, 13 Apr 2015 05:36:55 -0700 (PDT) Received: by 10.76.115.167 with HTTP; Mon, 13 Apr 2015 05:36:55 -0700 (PDT) In-Reply-To: References: Date: Mon, 13 Apr 2015 12:36:00 -0000 Message-ID: Subject: Re: [tree-optimization/63387] Recognize isunordered From: Richard Biener To: Marc Glisse Cc: GCC Patches Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2015-04/txt/msg00577.txt.bz2 On Mon, Apr 13, 2015 at 2:23 PM, Marc Glisse wrote: > Hello, > > just a simple pattern for match.pd. I am ignoring the issue of whether isnan > is the same as isunordered, I am only combining isunordered together. Ok. Thanks, Richard. > 2015-04-13 Marc Glisse > > PR tree-optimization/63387 > gcc/ > * match.pd ((x unord x) | (y unord y) -> (x unord y), > (x unord x) | (x unord y) -> (x unord y)): New simplifications. > gcc/testsuite/ > * gcc.dg/pr63387.c: New testcase. > > -- > Marc Glisse > Index: match.pd > =================================================================== > --- match.pd (revision 222041) > +++ match.pd (working copy) > @@ -925,20 +925,27 @@ along with GCC; see the file COPYING3. > (ncmp @0 @1))))) > (simplify > (bit_xor (cmp @0 @1) integer_truep) > (with { enum tree_code ic = invert_tree_comparison > (cmp, HONOR_NANS (@0)); } > (if (ic == icmp) > (icmp @0 @1)) > (if (ic == ncmp) > (ncmp @0 @1))))) > > +/* Unordered tests if either argument is a NaN. */ > +(simplify > + (bit_ior (unordered @0 @0) (unordered @1 @1)) > + (unordered @0 @1)) > +(simplify > + (bit_ior:c (unordered @0 @0) (unordered:c@2 @0 @1)) > + @2) > > /* Simplification of math builtins. */ > > (define_operator_list LOG BUILT_IN_LOGF BUILT_IN_LOG BUILT_IN_LOGL) > (define_operator_list EXP BUILT_IN_EXPF BUILT_IN_EXP BUILT_IN_EXPL) > (define_operator_list LOG2 BUILT_IN_LOG2F BUILT_IN_LOG2 BUILT_IN_LOG2L) > (define_operator_list EXP2 BUILT_IN_EXP2F BUILT_IN_EXP2 BUILT_IN_EXP2L) > (define_operator_list LOG10 BUILT_IN_LOG10F BUILT_IN_LOG10 BUILT_IN_LOG10L) > (define_operator_list EXP10 BUILT_IN_EXP10F BUILT_IN_EXP10 BUILT_IN_EXP10L) > (define_operator_list POW BUILT_IN_POWF BUILT_IN_POW BUILT_IN_POWL) > Index: testsuite/gcc.dg/pr63387.c > =================================================================== > --- testsuite/gcc.dg/pr63387.c (revision 0) > +++ testsuite/gcc.dg/pr63387.c (working copy) > @@ -0,0 +1,19 @@ > +/* { dg-do compile } */ > +/* { dg-options "-O -fdump-tree-optimized" } */ > + > +int f(double aaa, double bbb){ > + int xa = __builtin_isunordered(aaa, aaa); > + int xb = __builtin_isunordered(bbb, bbb); > + return xa | xb; > +} > + > +int g(double aaa, double bbb){ > + int xa = __builtin_isunordered(aaa, bbb); > + int xb = __builtin_isunordered(bbb, bbb); > + return xa | xb; > +} > + > +/* { dg-final { scan-tree-dump-not "aaa\[^\n\r\]* unord aaa" "optimized" } > } */ > +/* { dg-final { scan-tree-dump-not "bbb\[^\n\r\]* unord bbb" "optimized" } > } */ > +/* { dg-final { scan-tree-dump-times "aaa\[^\n\r\]* unord bbb" 2 > "optimized" } } */ > +/* { dg-final { cleanup-tree-dump "optimized" } } */ >