[Bug optimization/14886] New: strength reduction on floating point
amodra at bigpond dot net dot au
gcc-bugzilla@gcc.gnu.org
Thu Apr 8 03:52:00 GMT 2004
/* I found an interesting xlc strength reduction optimization recently,
that had xlc producing fp code that ran over twice as fast as gcc
code on a powerpc benchmark. Some improvement on the benchmark code
was due to xlc using floating multiply-add more aggressively, but the
main improvement was converting code as in f1 to as in f2. */
float bar;
void f1 (void)
{
int i;
for (i = 0; i < 500; i++)
__asm__ __volatile__ ("# %0" : : "f" (i * bar));
}
void f2 (void)
{
register long i;
register float f, bar2 = bar;
for (i = 500, f = 0.0; --i >= 0;)
{
__asm__ __volatile__ ("# %0" : : "f" (f));
f += bar2;
}
}
/* On ppc32, the f1 loop generates
.L9:
xoris 0,9,0x8000
stw 11,8(1)
stw 0,12(1)
lfd 0,8(1)
fsub 0,0,13
frsp 0,0
fmuls 0,0,12
#APP
# 0
#NO_APP
addi 9,9,1
bdnz .L9
the f2 loop is
.L19:
#APP
# 0
#NO_APP
fadds 0,0,13
bdnz .L19
*/
--
Summary: strength reduction on floating point
Product: gcc
Version: 3.5.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P2
Component: optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: amodra at bigpond dot net dot au
CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: powerpc-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14886
More information about the Gcc-bugs
mailing list