public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug optimization/14886] New: strength reduction on floating point
@ 2004-04-08 3:52 amodra at bigpond dot net dot au
2004-04-08 4:05 ` [Bug optimization/14886] " pinskia at gcc dot gnu dot org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: amodra at bigpond dot net dot au @ 2004-04-08 3:52 UTC (permalink / raw)
To: gcc-bugs
/* 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug optimization/14886] strength reduction on floating point
2004-04-08 3:52 [Bug optimization/14886] New: strength reduction on floating point amodra at bigpond dot net dot au
@ 2004-04-08 4:05 ` pinskia at gcc dot gnu dot org
2004-07-04 6:00 ` [Bug rtl-optimization/14886] " anton at samba dot org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-08 4:05 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-04-08 04:05 -------
Confirmed, the main reason why f1 is faster than f2 is that you no longer have to go through the stack
and store on the stack.
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |pinskia at gcc dot gnu dot
| |org
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Keywords| |pessimizes-code
Last reconfirmed|0000-00-00 00:00:00 |2004-04-08 04:05:24
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14886
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug rtl-optimization/14886] strength reduction on floating point
2004-04-08 3:52 [Bug optimization/14886] New: strength reduction on floating point amodra at bigpond dot net dot au
2004-04-08 4:05 ` [Bug optimization/14886] " pinskia at gcc dot gnu dot org
@ 2004-07-04 6:00 ` anton at samba dot org
2004-07-04 6:21 ` anton at samba dot org
2005-03-16 20:54 ` [Bug tree-optimization/14886] " anton at samba dot org
3 siblings, 0 replies; 5+ messages in thread
From: anton at samba dot org @ 2004-07-04 6:00 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From anton at samba dot org 2004-07-04 06:00 -------
Retested on 3.5 cvs (20040703) and the probelm is still there:
.L2:
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 .L2
vs:
.L8:
#APP
# 0
#NO_APP
fadds 0,0,13
bdnz .L8
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14886
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug rtl-optimization/14886] strength reduction on floating point
2004-04-08 3:52 [Bug optimization/14886] New: strength reduction on floating point amodra at bigpond dot net dot au
2004-04-08 4:05 ` [Bug optimization/14886] " pinskia at gcc dot gnu dot org
2004-07-04 6:00 ` [Bug rtl-optimization/14886] " anton at samba dot org
@ 2004-07-04 6:21 ` anton at samba dot org
2005-03-16 20:54 ` [Bug tree-optimization/14886] " anton at samba dot org
3 siblings, 0 replies; 5+ messages in thread
From: anton at samba dot org @ 2004-07-04 6:21 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From anton at samba dot org 2004-07-04 06:21 -------
f1 when compiled 64bit is worse, no use of count register (bug 16356), redundant
sign extension etc:
.L2:
rldicl. 0,11,0,53
sradi 9,11,53
addi 9,9,1
cmpldi 7,9,2
beq- 0,.L3
xor 0,11,0
blt- 7,.L3
ori 11,0,2048
.L3:
lfs 13,0(10)
std 11,-16(1)
lfd 12,-16(1)
fcfid 12,12
frsp 0,12
fmuls 0,0,13
#APP
# 0
#NO_APP
addi 0,11,1
extsw 11,0
cmpwi 7,11,499
ble+ 7,.L2
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14886
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug tree-optimization/14886] strength reduction on floating point
2004-04-08 3:52 [Bug optimization/14886] New: strength reduction on floating point amodra at bigpond dot net dot au
` (2 preceding siblings ...)
2004-07-04 6:21 ` anton at samba dot org
@ 2005-03-16 20:54 ` anton at samba dot org
3 siblings, 0 replies; 5+ messages in thread
From: anton at samba dot org @ 2005-03-16 20:54 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From anton at samba dot org 2005-03-16 20:54 -------
FYI this is still present in 4.0.0 20050313
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14886
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-03-16 20:54 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-08 3:52 [Bug optimization/14886] New: strength reduction on floating point amodra at bigpond dot net dot au
2004-04-08 4:05 ` [Bug optimization/14886] " pinskia at gcc dot gnu dot org
2004-07-04 6:00 ` [Bug rtl-optimization/14886] " anton at samba dot org
2004-07-04 6:21 ` anton at samba dot org
2005-03-16 20:54 ` [Bug tree-optimization/14886] " anton at samba dot org
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).