From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25803 invoked by alias); 12 Jun 2009 07:56:15 -0000 Received: (qmail 25791 invoked by uid 22791); 12 Jun 2009 07:56:14 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from fg-out-1718.google.com (HELO fg-out-1718.google.com) (72.14.220.157) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 12 Jun 2009 07:56:07 +0000 Received: by fg-out-1718.google.com with SMTP id l27so108243fgb.5 for ; Fri, 12 Jun 2009 00:56:04 -0700 (PDT) Received: by 10.86.71.8 with SMTP id t8mr3403241fga.60.1244793364844; Fri, 12 Jun 2009 00:56:04 -0700 (PDT) Received: from yakj.usersys.redhat.com (nat-pool-brq.redhat.com [62.40.79.66]) by mx.google.com with ESMTPS id d4sm2797525fga.1.2009.06.12.00.56.03 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 12 Jun 2009 00:56:03 -0700 (PDT) Message-ID: <4A320A07.3020804@gmail.com> Date: Fri, 12 Jun 2009 07:56:00 -0000 From: Paolo Bonzini User-Agent: Thunderbird 2.0.0.17 (X11/20081009) MIME-Version: 1.0 To: Jean Christophe Beyler CC: "gcc@gcc.gnu.org" Subject: Re: Code optimization only in loops References: <4A03F8EA.5070705@gnu.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2009-06/txt/msg00272.txt.bz2 Jean Christophe Beyler wrote: > I've gone back to this problem (since I've solved another one ;-)). > And I've moved forward a bit: > > It seems that if I consider an array of characters, there are no > longer any shifts and therefore I do get my two loads with the use of > an offset: The reason there are shifts instead of multiplies is that multiplications are canonicalized to shifts whenever possible outside addresses, because a shift instruction should be more efficient. The interesting dump should be fwprop which is where the address generation happens. From your dumps, however, the problem seems to be that you do not have a shift-by-immediate instruction. You may consider adding it even though it does not apply to your assembly, either with define_insn_and_split or by loosening the predicate and keeping a "r" constraint (or whatever you're using now). Paolo