* Error in Supporting Char and Int Addition.
@ 2010-03-02 13:19 Prashant Purohit
2010-03-02 14:09 ` John (Eljay) Love-Jensen
0 siblings, 1 reply; 4+ messages in thread
From: Prashant Purohit @ 2010-03-02 13:19 UTC (permalink / raw)
To: gcc-help
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.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Error in Supporting Char and Int Addition.
2010-03-02 13:19 Error in Supporting Char and Int Addition Prashant Purohit
@ 2010-03-02 14:09 ` John (Eljay) Love-Jensen
2010-03-03 5:00 ` Prashant Purohit
0 siblings, 1 reply; 4+ messages in thread
From: John (Eljay) Love-Jensen @ 2010-03-02 14:09 UTC (permalink / raw)
To: Prashant Purohit, GCC-help
Hi Prashant,
I was unable to reproduce.
What was your compile command line?
What version of GCC are you using?
Sincerely,
--Eljay
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Error in Supporting Char and Int Addition.
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
0 siblings, 1 reply; 4+ messages in thread
From: Prashant Purohit @ 2010-03-03 5:00 UTC (permalink / raw)
To: gcc-help
Hi Eljay,
Thanks for reply.
GCC version I am using is 4.3.0
And to compile the C code I am using -S option to see the assembly file
for both ARM & my target architecture i.e.
# /Install_Path/arm-elf-gcc -S test.c
And my problem is I am getting extra load and store instruction for my
target which is not there in case of ARM supported by GCC -4.3.0 which I
have mentioned in detail in first post.
Thanks & Regards,
Prashant.
John (Eljay) Love-Jensen wrote:
>
> Hi Prashant,
>
> I was unable to reproduce.
>
> What was your compile command line?
>
> What version of GCC are you using?
>
> Sincerely,
> --Eljay
>
>
>
--
View this message in context: http://old.nabble.com/Error-in-Supporting-Char-and-Int-Addition.-tp27755780p27764366.html
Sent from the gcc - Help mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: Error in Supporting Char and Int Addition.
2010-03-03 5:00 ` Prashant Purohit
@ 2010-03-03 5:06 ` John (Eljay) Love-Jensen
0 siblings, 0 replies; 4+ messages in thread
From: John (Eljay) Love-Jensen @ 2010-03-03 5:06 UTC (permalink / raw)
To: Prashant Purohit, gcc-help
Hi Prashant,
Do you get the same results if you enable optimization?
Sincerely,
--Eljay
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-03-03 5:06 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-02 13:19 Error in Supporting Char and Int Addition Prashant Purohit
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
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).