From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1260 invoked by alias); 2 Mar 2010 13:19:15 -0000 Received: (qmail 1233 invoked by uid 22791); 2 Mar 2010 13:19:13 -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; Tue, 02 Mar 2010 13:19:09 +0000 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1NmS0B-0006qu-Rt for gcc-help@gcc.gnu.org; Tue, 02 Mar 2010 05:19:07 -0800 Message-ID: <27755780.post@talk.nabble.com> Date: Tue, 02 Mar 2010 13:19:00 -0000 From: Prashant Purohit To: gcc-help@gcc.gnu.org Subject: Error in Supporting Char and Int Addition. MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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/msg00021.txt.bz2 Hi all, I have defined patterns for "movqi", "movsi", "addsi3" to support character data type. I am getting the expected output when it comes to simple char assignment operation. But when I try to add one char data type with another char or one char data type with another int data type, I am getting extra load and store which are not expected. For example, ************ test.c ************ char a, b; a = 'a'; b = a + 10; *********************************** In normal case, considering ARM architecture as reference, the assembly will be : ************ Arm Assembly ************* mov r3, #97 strb r3, [fp, #-14] ldrb r3, [fp, #-14] add r3, r3, #10 strb r3, [fp, #-13] ********************************************** But in case of my target I am getting extra load and store for the addition line, i.e. before addition, it is storing char variable data type in some other memory location with Store QI and then loading with Load SI and then doing addition. Also, after addition it is doing extra store and load. i.e storing the addition result with Store SI and loading the addition result again with Load QI. which can be seen in following assembly ( My Target assembly is converted in to ARM assembly for reference) : ********** My Target Assembly ************* mov r3,#97 strb r3, [fp, #-14] ldrb r3, [fp, #-14] strb r3, [fp, #-20] /* Extra Store QI */ ldr r3, [fp, #-20] /* Extra Load SI */ add r3, r3, #10 str r3, [fp, #-24] /* Extra Store SI */ ldrb r3, [fp, #-24] /* Extra Load QI */ strb r3, [fp, #-13] ******************************************** Any help in this regard is appreciated. Thanks in advance, Regards, Prashant -- View this message in context: http://old.nabble.com/Error-in-Supporting-Char-and-Int-Addition.-tp27755780p27755780.html Sent from the gcc - Help mailing list archive at Nabble.com.