From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 100259 invoked by alias); 4 Jun 2015 04:51:14 -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 100237 invoked by uid 89); 4 Jun 2015 04:51:13 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.2 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 04 Jun 2015 04:51:12 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 590FC345AB8; Thu, 4 Jun 2015 04:51:11 +0000 (UTC) Received: from localhost.localdomain (ovpn-113-154.phx2.redhat.com [10.3.113.154]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t544pA9Y007732; Thu, 4 Jun 2015 00:51:11 -0400 Message-ID: <556FD93E.1050805@redhat.com> Date: Thu, 04 Jun 2015 04:53:00 -0000 From: Jeff Law User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Richard Biener CC: gcc-patches Subject: Re: [RFA] Reimplement canonicalization of comparison arguments in match.pd References: <55693F80.9070805@redhat.com> In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2015-06/txt/msg00374.txt.bz2 On 06/01/2015 05:15 AM, Richard Biener wrote: > > In addition to what Marc said we'd simplify 1 != 0 immediately anyway (to 1), > so I don't think the special-cases should make a difference (and if they > do I'd like to see a testcase!). FWIW, I agree -- and across my testfiles I don't see any difference in the dumps with the special casing of 0 removed. > > Note that you should use a double-for here, > > (for op (lt gt le ge) > iop (gt lt ge le) > (simplify ... > (if ... > (iop @1 @0) > > and drop the inner ifs. You get op and iop iterated in lock-step. > IMHO you should > simply iterate over all comparison codes, thus > > (for op (tcc_comparison) > iop (inverted_tcc_comparison) > nop (inverted_tcc_comparison_with_nans) > (... > > see the existing patterns using invert_tree_comparison. Or not care > about handling > NANs correctly and guard with > > && invert_tree_comparison (op, HONOR_NANS (..)) == iop We actually want swapped_tcc_comparison. We're swapping the operands, not inverting the comparison. Swapping the operands also happens to be safe for FP, so no need to do anything special there. Using Marc's suggestion for integrating canonicalization into the existing pattern seems the cleanest to me and that's what I'm testing now. jeff