From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13484 invoked by alias); 11 May 2015 04:15:42 -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 13472 invoked by uid 89); 11 May 2015 04:15:42 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.3 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; Mon, 11 May 2015 04:15:41 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t4B4FeMY024541 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 11 May 2015 00:15:40 -0400 Received: from localhost.localdomain (ovpn-113-143.phx2.redhat.com [10.3.113.143]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t4B4FdGb000925; Mon, 11 May 2015 00:15:39 -0400 Message-ID: <55502CE6.5010602@redhat.com> Date: Mon, 11 May 2015 04:15:00 -0000 From: Jeff Law User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Segher Boessenkool , gcc-patches@gcc.gnu.org CC: dje.gcc@gmail.com Subject: Re: [PATCH 2/6] combine: If recog fails, try again with zero_ext{ract,end} simplified References: <00854266aef1cbae6d3620f78122e6131c37b73c.1431268135.git.segher@kernel.crashing.org> In-Reply-To: <00854266aef1cbae6d3620f78122e6131c37b73c.1431268135.git.segher@kernel.crashing.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2015-05/txt/msg00879.txt.bz2 On 05/10/2015 10:13 AM, Segher Boessenkool wrote: > Combine has its own ideas of what is "canonical" RTL, forcing all > backends to have special patterns in their machine description for the > "more simplified" patterns combine often creates, even though the > backend already has patterns for a more general form. Backends that > do not implement those patterns get less well optimised code. > > This patch lifts that burden for two cases: combine often converts > an AND (with, say, 0xff) to a ZERO_EXTEND of a SUBREG; and an LSHIFTRT > followed by an AND to a ZERO_EXTRACT. This is perfectly helpful for > e.g. MEMs, but not nice if you have instructions to do more generic > masking (like PowerPC rlwinm, and similar on some other archs). > > With this patch, if recog_for_combine fails, and there are any > ZERO_EXT* in the pattern to be matched, it tries again with those > expressed as AND etc. If that also fails it rolls back the changes, > because it might still match after e.g. splitting, and we want to > try the ZERO_EXT* for that as well. > > Tested on powerpc-linux, before and after removing many patterns > from the machine description, and checked that the only changes in > the bootstrapped compiler are new and removed functions. > > I'll also test on x86_64-linux before committing. > > > Segher > > > 2015-05-10 Segher Boessenkool > > * combine.c (recog_for_combine_1): New function, factored out > from recog_for_combine. > (change_zero_ext): New function. > (recog_for_combine): If recog fails, try again with the pattern > modified by change_zero_ext; if that still fails, restore the > pattern. I like it. Attacking the extensions are the most obvious candidates, but I wonder if there's others (like the whole "ASHIFT vs MULT" stuff that we were recently looking at for ARM). jeff