From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31476 invoked by alias); 3 Mar 2010 05:16:16 -0000 Received: (qmail 31457 invoked by uid 22791); 3 Mar 2010 05:16:15 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from kuber.nabble.com (HELO kuber.nabble.com) (216.139.236.158) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 03 Mar 2010 05:16:10 +0000 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1NmgwK-0007Lo-9a for gcc-help@gcc.gnu.org; Tue, 02 Mar 2010 21:16:08 -0800 Message-ID: <27764440.post@talk.nabble.com> Date: Wed, 03 Mar 2010 05:16:00 -0000 From: Prashant Purohit To: gcc-help@gcc.gnu.org Subject: Re: How "arm_gen_constant" Function In arm.c works? In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit References: <27753882.post@talk.nabble.com> X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2010-03/txt/msg00032.txt.bz2 Hi Ian, Thanks for the reply. >I'm not sure I understand the question. When you say "how we decide >these constants in that function," to which constants are you >referring? Sorry for not mentioning my question clearly. I mean to say, as we can not generate all the constants from 8 bit rotation scheme supported in ARM architecture, I just wanted to know the logic behind that function which generates one Mov and one Add/Sub instruction if that constant is not being generated by rotation scheme alone. e:g : suppose, the immediate constant is 1234 then that function will do it as mov r3, #1232 add r3, r3, #2 (In case of ARM) Please tell me, how it splits that constant in to 1232 and 2. >Some ARM instructions let you shift and rotate operands before >applying them. The arm_gen_constant function is so complicated >because it is looking for different ways to exploit that fact in order >to generate the constants in the fewest instructions. The function is >also considering the context in which the constant is used--this is >the code parameter--since that permits some further optimizations. >To understand what this code is doing, first get a clear understanding >of the ARM architecture. Then consider how to most efficiently >implement various operations using constants. Yes, I am well aware about ARM architecture and so only asked the logic of "arm_gen_constant" function. Please, let me know if any one know it. Thanks & Regards, Prashant. -- View this message in context: http://old.nabble.com/How-%22arm_gen_constant%22-Function-In-arm.c-works--tp27753882p27764440.html Sent from the gcc - Help mailing list archive at Nabble.com.