From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9183 invoked by alias); 19 Nov 2017 17:26:18 -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 9173 invoked by uid 89); 19 Nov 2017 17:26:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=BAYES_00,KB_WAM_FROM_NAME_SINGLEWORD,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy=adjacent 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 ESMTP; Sun, 19 Nov 2017 17:26:15 +0000 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6AC41C0587DF; Sun, 19 Nov 2017 17:26:14 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-116-247.ams2.redhat.com [10.36.116.247]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C8990190DF; Sun, 19 Nov 2017 17:26:13 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id vAJHQAhv013880; Sun, 19 Nov 2017 18:26:11 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id vAJHQ8ii013879; Sun, 19 Nov 2017 18:26:08 +0100 Date: Sun, 19 Nov 2017 18:54:00 -0000 From: Jakub Jelinek To: Thomas Preudhomme Cc: Richard Biener , Kyrill Tkachov , gcc-patches@gcc.gnu.org Subject: Re: [PATCH] Use bswap framework in store-merging (PR tree-optimization/78821) Message-ID: <20171119172608.GA14653@tucnak> Reply-To: Jakub Jelinek References: <20171116170606.GW14653@tucnak> <582056e5-2f42-a323-ece9-463f848c3d1d@foss.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <582056e5-2f42-a323-ece9-463f848c3d1d@foss.arm.com> User-Agent: Mutt/1.7.1 (2016-10-04) X-IsSubscribed: yes X-SW-Source: 2017-11/txt/msg01674.txt.bz2 On Fri, Nov 17, 2017 at 09:45:35AM +0000, Thomas Preudhomme wrote: > > Bootstrapped/regtested on {x86_64,i686,powerpc64le,powerpc64}-linux, ok for trunk? > > > > The cases this patch can handle are less common than rhs_code INTEGER_CST > > (stores of constants to adjacent memory) or MEM_REF (adjacent memory > > copying), but are more common than the bitwise ops, during combined > > x86_64+i686 bootstraps/regtests it triggered: > > lrotate_expr 974 2528 > > nop_expr 720 1711 > > (lrotate_expr stands for bswap, nop_expr for identity, the first column is > > the actual count of such new stores, the second is the original number of > > stores that have been optimized this way). > > Are you saying that lrotate_expr is just the title and it also includes 32- > and 64-bit bswap or is it only the count of lrotate_expr nodes? The rhs_code field is magic shorthand, it could be perhaps also some enum, the thing is that I need values for: 1) a constant satisfying rhs_valid_for_store_merging_p predicate (usually INTEGER_CST, but it can be something different). Right now I'm using INTEGER_CST for all those 2) a memory load; right now I'm using MEM_REF for all kinds of memory loads 3) BIT_{AND,IOR,XOR}_EXPR - these are the main reason for not using some specialized enums, but actually a tree_code; the advantage is that then there is no need to translate it in any way 4) bswap (any kind); the patch uses LROTATE_EXPR for that, again, like in 1) and 2) just a placeholder 5) bswap framework determined nop; the patch uses NOP_EXPR for that; a placeholder Another possibility would be specialized enum, perhaps one where SMOP_{CONSTANT,MEMORY,BSWAP,NOP} would be MAX_TREE_CODES + {1,2,3,4} and SMOP_{AND,IOR,XOR} would be equal to BIT_{AND,IOR,XOR}_EXPR for easier translations between. > > @@ -1141,7 +1206,7 @@ pass_optimize_bswap::execute (function * > > inserted smaller bswap replacements as sub-patterns, the wider > > variant wouldn't be detected. */ > > for (gsi = gsi_last_bb (bb); !gsi_end_p (gsi);) > > - { > > + { > > Nit: could this be done when moving the code in the previous patch instead? Sure, can do that there. Jakub