Problem in SH code generation-mainline/BIB (probably other targe ts too)
Naveen Sharma, Noida
naveens@noida.hcltech.com
Tue Dec 3 22:17:00 GMT 2002
Hi,
There seems to be a problem in GCC code generation for SH4 and
probably other targets.
As an example consider the test program
gcc.c-torture/execute/931004-13.c in gcc testsuite.
I am seeing the the following code.
Options : "-O2 -ml -m4 -fno-schedule-insns2"
gcc version 3.4-bi 20021104 (experimental)
main ()
{
.... Snip .....
struct tiny x[3];
x[0].c = 10;
c8: 0a e1 mov #10,r1
ca: 10 2e mov.b r1,@r14
x[1].c = 11;
cc: 0b e2 mov #11,r2
ce: e3 61 mov r14,r1
d0: 04 71 add #4,r1
d2: 20 21 mov.b r2,@r1
x[2].c = 12;
d4: 0c e2 mov #12,r2
d6: e3 61 mov r14,r1 <--- This can be eliminated.
d8: 08 71 add #8,r1
da: 20 21 mov.b r2,@r1
............
Whereas with a previous snapshot (gcc version 3.2 20020503),
I get
main ()
{
................
struct tiny x[3];
x[0].c = 10;
c8: 0a e1 mov #10,r1
ca: 10 2e mov.b r1,@r14
x[1].c = 11;
cc: 0b e2 mov #11,r2
ce: e3 61 mov r14,r1
d0: 04 71 add #4,r1
d2: 20 21 mov.b r2,@r1
x[2].c = 12;
d4: 0c e2 mov #12,r2
d6: 04 71 add #4,r1 <---- Note this
d8: 20 21 mov.b r2,@r1
.......................
So, it seems that the following transformation
is not happening.
pX <- pA + N
...
pX <- pA + M
into
pX <- pA + N
...
pX <- pX + (M - N)
This has led to significant increase in code size. As per my understanding
either regmove pass or reload_cse_regs () would be doing this
transfromation.
I am investigating which patch is responsible. But if someone already knows
it, it would be helpful.
Best Regards,
Naveen Sharma.
More information about the Gcc
mailing list