public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* optimization/9895: GCC unable to retain array values in registers
@ 2003-03-01 2:26 tm_gccmail
0 siblings, 0 replies; only message in thread
From: tm_gccmail @ 2003-03-01 2:26 UTC (permalink / raw)
To: gcc-gnats
>Number: 9895
>Category: optimization
>Synopsis: GCC unable to retain array values in registers
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: pessimizes-code
>Submitter-Id: net
>Arrival-Date: Sat Mar 01 02:26:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: Toshi Morita
>Release: unknown-1.0
>Organization:
>Environment:
host i386-linux, target sh-elf
>Description:
For this test case:
int
integer_calc_one(int i)
{
int j;
int a[8];
a[0] = rand();
a[1] = (i % 256) + 2;
a[2] = a[0] + a[1];
a[3] = a[2] / a[1];
a[4] = a[3] - a[1];
a[5] = a[4] * a[1];
for (j = 0; j < 7; j ++)
a[7] += a[j];
return a[7];
}
The MS .net compiler is able to unroll the loop and retain
a[0]...a[7] in registers.
GCC is unable to retain the values in registers even when
-O2 -funroll-loops is specified:
add #4,r1
add #56,r2
float fpul,dr4
fmov.s fr5,@r1
fmov.s fr4,@-r1
mov r14,r1
fadd dr4,dr2
add #16,r1
add #4,r1
fmov.s fr3,@r1
fmov.s fr2,@-r1
mov r14,r1
fdiv dr4,dr2
add #24,r1
add #4,r1
fmov.s fr3,@r1
fmov.s fr2,@-r1
mov r14,r1
fsub dr4,dr2
add #32,r1
add #4,r1
fmov.s fr3,@r1
fmov.s fr2,@-r1
mov r14,r1
fmul dr4,dr2
add #40,r1
add #4,r1
fmov.s fr3,@r1
fmov.s fr2,@-r1
mov #7,r1
.L6:
fmov.s @r2+,fr0
dt r1
fmov.s @r3+,fr2
fmov.s @r2,fr1
add #-4,r2
fmov.s @r3+,fr3
add #4,r2
fadd dr2,dr0
fmov.s fr1,@r2
bf/s .L6
fmov.s fr0,@-r2
add #64,r14
mov r14,r15
lds.l @r15+,pr
mov.l @r15+,r14
rts
mov.l @r15+,r8
The same problem seems to happen on x86 and other targets as well.
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-03-01 2:26 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-01 2:26 optimization/9895: GCC unable to retain array values in registers tm_gccmail
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).