public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Prashant Purohit <prashantpurohit025@gmail.com>
To: gcc-help@gcc.gnu.org
Subject: Error in Supporting Char and Int Addition.
Date: Tue, 02 Mar 2010 13:19:00 -0000	[thread overview]
Message-ID: <27755780.post@talk.nabble.com> (raw)


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.

             reply	other threads:[~2010-03-02 13:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-02 13:19 Prashant Purohit [this message]
2010-03-02 14:09 ` John (Eljay) Love-Jensen
2010-03-03  5:00   ` Prashant Purohit
2010-03-03  5:06     ` John (Eljay) Love-Jensen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=27755780.post@talk.nabble.com \
    --to=prashantpurohit025@gmail.com \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).