From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 70859 invoked by alias); 2 May 2016 08:37:58 -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 70846 invoked by uid 89); 2 May 2016 08:37:57 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.5 required=5.0 tests=AWL,BAYES_50,FREEMAIL_FROM,KAM_ASCII_DIVIDERS,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=no version=3.3.2 spammy=transformations, marcglisseinriafr, marc.glisse@inria.fr, D*3 X-HELO: mail-wm0-f53.google.com Received: from mail-wm0-f53.google.com (HELO mail-wm0-f53.google.com) (74.125.82.53) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Mon, 02 May 2016 08:37:47 +0000 Received: by mail-wm0-f53.google.com with SMTP id e201so98080144wme.0 for ; Mon, 02 May 2016 01:37:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=9tiL1cyDTzb2bzBfup+vrYJjkbwP0Bt6mj8l22harjM=; b=KG/5uBi9VJ3eqZCa484W+jBewip4eydna4hYVVbn2h5TlznZxdpjmlTPIkVGPZGwDt h1WzeLp0r4ACZbrPZEjOVsF3coy1AkS/sAWqWtP63SnSJ5jd0DrZdMMvINxYdOG7q7jU qo4UVYwKh7h5cWBzumEG0AnIRQtObnVDdZIonHRNbWO2ookQdhRgB/4/yEwqzXzVi1Br iP9P2B8TaMkkPvmYGXYZT+G18kJ/NdVb1LgN/F53ofyrhk1kH47ipMrfzwTMnvJyl6t+ fkJLKS8XvfrYyma/SPJ6HVORySl2M5bQotCe0vkXkn461RJE0brxceDh0p5U8KWTN3el IZDQ== X-Gm-Message-State: AOPr4FVxkwNgRaj87WziSrxYaNx5OypjXpsmzROC9vT9QBqdBRWiYzGEEU3VbroZUlv9pd8iaW3grvMvrwyVug== MIME-Version: 1.0 X-Received: by 10.194.10.162 with SMTP id j2mr34658673wjb.72.1462178264528; Mon, 02 May 2016 01:37:44 -0700 (PDT) Received: by 10.194.113.102 with HTTP; Mon, 2 May 2016 01:37:44 -0700 (PDT) In-Reply-To: References: Date: Mon, 02 May 2016 08:37:00 -0000 Message-ID: Subject: Re: Canonicalize X u< X to UNORDERED_EXPR From: Richard Biener To: Marc Glisse Cc: GCC Patches Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2016-05/txt/msg00034.txt.bz2 On Sat, Apr 30, 2016 at 8:44 PM, Marc Glisse wrote: > Hello, > > this case seemed to be missing in the various X cmp X transformations. It > does not change the generated code in the testcase. > > The missing :c is rather trivial. I can commit it separately if you prefer. I think it's not missing. Commutating the first one is enough to eventually make the @1s match up. I think you should get a diagnostic on a duplicate pattern when adding another :c (hmm, no, it's indeed "different" patterns but still redundant). > Bootstrap+regtest on powerpc64le-unknown-linux-gnu. Ok for the new pattern. Thanks, Richard. > 2016-05-02 Marc Glisse > > gcc/ > * match.pd ((A & B) OP (C & B)): Mark '&' as commutative. > (X u< X, X u> X): New transformations > > gcc/testsuite/ > * gcc.dg/tree-ssa/unord.c: New testcase. > > -- > Marc Glisse > Index: trunk/gcc/match.pd > =================================================================== > --- trunk/gcc/match.pd (revision 235654) > +++ trunk/gcc/match.pd (working copy) > @@ -783,21 +783,21 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) > @0) > /* (~x | y) & x -> x & y */ > /* (~x & y) | x -> x | y */ > (simplify > (bitop:c (rbitop:c (bit_not @0) @1) @0) > (bitop @0 @1))) > > /* Simplify (A & B) OP0 (C & B) to (A OP0 C) & B. */ > (for bitop (bit_and bit_ior bit_xor) > (simplify > - (bitop (bit_and:c @0 @1) (bit_and @2 @1)) > + (bitop (bit_and:c @0 @1) (bit_and:c @2 @1)) > (bit_and (bitop @0 @2) @1))) > > /* (x | CST1) & CST2 -> (x & CST2) | (CST1 & CST2) */ > (simplify > (bit_and (bit_ior @0 CONSTANT_CLASS_P@1) CONSTANT_CLASS_P@2) > (bit_ior (bit_and @0 @2) (bit_and @1 @2))) > > /* Combine successive equal operations with constants. */ > (for bitop (bit_and bit_ior bit_xor) > (simplify > @@ -1914,20 +1914,24 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) > (simplify > (cmp @0 @0) > (if (cmp != NE_EXPR > || ! FLOAT_TYPE_P (TREE_TYPE (@0)) > || ! HONOR_NANS (@0)) > { constant_boolean_node (false, type); }))) > (for cmp (unle unge uneq) > (simplify > (cmp @0 @0) > { constant_boolean_node (true, type); })) > +(for cmp (unlt ungt) > + (simplify > + (cmp @0 @0) > + (unordered @0 @0))) > (simplify > (ltgt @0 @0) > (if (!flag_trapping_math) > { constant_boolean_node (false, type); })) > > /* Fold ~X op ~Y as Y op X. */ > (for cmp (simple_comparison) > (simplify > (cmp (bit_not@2 @0) (bit_not@3 @1)) > (if (single_use (@2) && single_use (@3)) > Index: trunk/gcc/testsuite/gcc.dg/tree-ssa/unord.c > =================================================================== > --- trunk/gcc/testsuite/gcc.dg/tree-ssa/unord.c (revision 0) > +++ trunk/gcc/testsuite/gcc.dg/tree-ssa/unord.c (working copy) > @@ -0,0 +1,7 @@ > +/* { dg-do compile } */ > +/* { dg-options "-O -fdump-tree-optimized" } */ > + > +int f(double a){double b=a;return !__builtin_islessequal(a,b);} > +int g(double a){double b=a;return !__builtin_isgreaterequal(a,b);} > + > +/* { dg-final { scan-tree-dump-times " unord " 2 "optimized" } } */ >