Error in Supporting Char and Int Addition.
Prashant Purohit
prashantpurohit025@gmail.com
Tue Mar 2 13:19:00 GMT 2010
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.
More information about the Gcc-help
mailing list