From dev-return-34737-apmail-harmony-dev-archive=harmony.apache.org@harmony.apache.org Thu Aug 07 10:33:59 2008 Return-Path: Delivered-To: apmail-harmony-dev-archive@www.apache.org Received: (qmail 45033 invoked from network); 7 Aug 2008 10:33:59 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 7 Aug 2008 10:33:59 -0000 Received: (qmail 9914 invoked by uid 500); 7 Aug 2008 10:33:55 -0000 Delivered-To: apmail-harmony-dev-archive@harmony.apache.org Received: (qmail 9867 invoked by uid 500); 7 Aug 2008 10:33:54 -0000 Mailing-List: contact dev-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list dev@harmony.apache.org Received: (qmail 9854 invoked by uid 99); 7 Aug 2008 10:33:54 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Aug 2008 03:33:54 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of xiaofeng.li@gmail.com designates 64.233.166.178 as permitted sender) Received: from [64.233.166.178] (HELO py-out-1112.google.com) (64.233.166.178) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Aug 2008 10:33:00 +0000 Received: by py-out-1112.google.com with SMTP id u52so200086pyb.13 for ; Thu, 07 Aug 2008 03:33:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=UvSQzfjaHG8NQhR7yC3V0j1gJ5V14rAnn+9C2xSA8ck=; b=ZuIZqpm+HdwisQ6MS8AH+ojnR2pd2EnnPojRs51EfKl0319ksT6mP0NfwZYUtY3IWt v8Ley7T6bwgms85GB7ROzdlDv0y7oB2FTvmCt1pL2wWTAIpXaBrOzfioHlJPnd8H3DeS 4Q5VgjTOyn0gq3U6JTEpLT9Kq/lL3jlIAgufE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=Cvgm+0WuyQQQh04qd0j4riGOsJ2vOfwvTUwxatwI8r7VMJa0ZegNIkCb2nDTo672BL FDdCWnbz9dWZZPdLO0N1qfDEbc77rEUy1iAmVP/WUUYifXvmW08WdfZqzSPDDJBgXmQP bJJzUGsaHyXs9OQgQwI+Q1Zm6IR7gJ9cVNSVs= Received: by 10.64.250.7 with SMTP id x7mr2872357qbh.3.1218105207005; Thu, 07 Aug 2008 03:33:27 -0700 (PDT) Received: by 10.64.21.18 with HTTP; Thu, 7 Aug 2008 03:33:26 -0700 (PDT) Message-ID: <9623c9a50808070333u2f131ee6ua1ea72871a3403fb@mail.gmail.com> Date: Thu, 7 Aug 2008 18:33:26 +0800 From: "Xiao-Feng Li" To: dev@harmony.apache.org Subject: Re: generalized multiplication replacement In-Reply-To: <4899B7F3.4060303@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <255079590808060706p78804931u2be518e5b559b73d@mail.gmail.com> <4899B7F3.4060303@gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org Ian, thanks for the pointers, which are useful. Thanks, xiaofeng On Wed, Aug 6, 2008 at 10:40 PM, Ian Rogers wrote: > xiaoming gu wrote: >> >> Hi, all. Previously, Harmony Jira 5901 brought some benefits. Now I'm >> working on generalized multiplication replacement with shift and addition. >> >> Today I checked with gcc and found whether a multiplication is replaced or >> not in gcc mainly (not strictly) depends on the number of the replaced >> operations. There are some exceptions in gcc and I couldn't summarize the >> rule without reading the source code. So I'm planning to round it to a >> simple decision as following: if it needs >=4 shift/add operations, don't >> do >> replacement; Otherwise, replace it with a combination of shift/add. >> >> For example x*20 (20=00010100) is replaced by (x<<2+x)<<2 and x*56 >> (56=00111000) is replaced by (x<<3-x)<<3 but x*29 (29=00011101) is not >> optimized by ((x<<3)-x)<<2+x. >> >> Any comments? >> >> Another question - may I read the source code of gcc since it is >> opensource >> in GPL? Thanks. >> >> Xiaoming >> > > Hi Xiaoming, > > IANAL but I guess it's not allowed to base your implementation on GCC. I > wrote the same code for Jikes RVM [1] and I'd be happy for this CPL code > also to be available under the ASF. This code doesn't handle the use of > subtraction and partially computed results from earlier stages, I would very > much like to improve it to do this. There is a tracker for Jikes RVM for > this [2], there are also papers/programs explaining how to do the better > approach [3][4] and some other considerations are mentioned in [5]. > > Regards, > Ian Rogers > > [1] > http://jikesrvm.svn.sourceforge.net/viewvc/jikesrvm/rvmroot/trunk/rvm/src/org/jikesrvm/compilers/opt/Simplifier.java?revision=14704&view=markup#l_1385 > [2] http://jira.codehaus.org/browse/RVM-256 > [3] http://portal.acm.org/citation.cfm?id=178249 > [4] > http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/25112.PDF > pages 160 and 186 > [5] http://www.intel.com/design/processor/manuals/248966.pdf > -- > http://www.cs.man.ac.uk/~irogers > -- http://xiao-feng.blogspot.com