This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug other/17108] New: Missed opportunity for strength reduction
- From: "gcc-bugzilla at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 19 Aug 2004 14:59:23 -0000
- Subject: [Bug other/17108] New: Missed opportunity for strength reduction
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Description:
A non-optimal code sequence is illustraded. Duplicate using gcc 3.5 and
command line:
gcc -O3 -m64 -c test.c
Testcase:
void foo(float *data, float d) {
long i;
for (i = 0; i < 8; i++)
data[i] = d;
}
Assembly:
Code generated by gcc 3.5:
.foo:
li 0,8
li 9,0
mtctr 0
.L2:
sldi 0,9,2
addi 9,9,1
stfsx 1,3,0
bdnz .L2
blr
We can eliminate the multiply(shift) as well as the increment of "i" and
use
a store with update form to simplify the loop to this:
.foo:
ai 3,3,-4
li 0,8
mtctr 0
.L2:
stfsu 1,3,4
bdnz .L2
blr
--
Summary: Missed opportunity for strength reduction
Product: gcc
Version: 3.5.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P1
Component: other
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: steinmtz at us dot ibm dot com
CC: gcc-bugs at gcc dot gnu dot org,steinmtz at us dot ibm
dot com
GCC build triplet: powerpc64-linux
GCC host triplet: powerpc64-linux
GCC target triplet: powerpc64-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17108