From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22157 invoked by alias); 11 Jun 2015 11:09:12 -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 22148 invoked by uid 89); 11 Jun 2015 11:09:12 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 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, 11 Jun 2015 11:09:11 +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 1D8FFBDD81; Thu, 11 Jun 2015 11:09:10 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-116-89.ams2.redhat.com [10.36.116.89]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t5BB98Ue015941 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 11 Jun 2015 07:09:09 -0400 Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.14.9/8.14.9) with ESMTP id t5BB97OZ004274; Thu, 11 Jun 2015 13:09:07 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.14.9/8.14.9/Submit) id t5BB95UJ004081; Thu, 11 Jun 2015 13:09:05 +0200 Date: Thu, 11 Jun 2015 11:18:00 -0000 From: Jakub Jelinek To: Marek Polacek Cc: GCC Patches , Richard Biener Subject: Re: match.pd: Optimize (x & y) ^ (x | y) Message-ID: <20150611110905.GW10247@tucnak.redhat.com> Reply-To: Jakub Jelinek References: <20150611110432.GY2756@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150611110432.GY2756@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes X-SW-Source: 2015-06/txt/msg00829.txt.bz2 On Thu, Jun 11, 2015 at 01:04:32PM +0200, Marek Polacek wrote: > This patch introduces a new pattern for the match-and-simplify > machinery. > > I have verified this transformation on a toy testcase (tried x and y > in the range [-1000,1000]) and it does a correct thing for all integers. > > The asm diff for fn1 is > - andl %esi, %eax > - orl %edi, %esi > so clearly a win. > > Bootstrapped/regtested on x86_64-linux, ok for trunk? What about some nop type conversions in between? int fn1 (unsigned int x, unsigned int y) { int a = x; int b = y; unsigned int c = x & y; int d = a | b; return (int) (c ^ d); } ? Also wonder, if some testcases for match.pd shouldn't be in separate statements so that they don't test the GENERIC folding, but GIMPLE folding. Jakub