From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8363 invoked by alias); 9 Nov 2009 12:49:57 -0000 Received: (qmail 8096 invoked by uid 22791); 9 Nov 2009 12:49:57 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail-pz0-f181.google.com (HELO mail-pz0-f181.google.com) (209.85.222.181) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 09 Nov 2009 12:49:50 +0000 Received: by pzk11 with SMTP id 11so1981554pzk.14 for ; Mon, 09 Nov 2009 04:49:48 -0800 (PST) MIME-Version: 1.0 Received: by 10.142.151.22 with SMTP id y22mr752893wfd.100.1257770988549; Mon, 09 Nov 2009 04:49:48 -0800 (PST) In-Reply-To: <4AF44C0D.5090902@redhat.com> References: <4A97E98C.8040009@redhat.com> <4AF44C0D.5090902@redhat.com> From: Mohamed Shafi Date: Mon, 09 Nov 2009 12:49:00 -0000 Message-ID: Subject: Re: How to write shift and add pattern? To: Richard Henderson Cc: GCC Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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-11/txt/msg00242.txt.bz2 2009/11/6 Richard Henderson : > On 11/06/2009 05:29 AM, Mohamed Shafi wrote: >> >> =A0 =A0 The target that i am working on has 1& =A02 bit shift-add patter= ns. >> GCC is not generating shift-add patterns when the shift count is 1. It >> is currently generating add operations. What should be done to >> generate shift-add pattern instead of add-add pattern? > > I'm not sure. =A0You may have to resort to matching > > =A0(set (match_operand 0 "register_operand" "") > =A0 =A0 =A0 (plus (plus (match_operand 1 "register_operand" "") > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (match_dup 1)) > =A0 =A0 =A0 =A0 =A0 =A0 (match_operand 2 "register_operand" "")))) > > But you should debug make_compound_operation first to > figure out what's going on for your port, because it's > working for x86_64: > > =A0 =A0 =A0 =A0long foo(long a, long b) { return a*2 + b; } > > =A0 =A0 =A0 =A0leaq =A0 =A0(%rsi,%rdi,2), %rax =A0 =A0 # 8 =A0 =A0 *lea_2= _rex64 > =A0 =A0 =A0 =A0ret =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 # 26 =A0 =A0return_internal > > > r~ > I have fixed this. The culprit was the cost factor. I added the case in targetm.rtx_costs and now it works properly. But i am having issues with the reload. Regards, Shafi