Opening bug report per Zdeneck's request, snippets of email exchange follows:
========= void f1 (void * coefPtr, double * dd) { int i,j; /* Cast of "coefPtr" results in poor code for this loop (missed strength reduction). */ for (i = 0; i < 16; i++) { *(((double *) coefPtr) + i) = +0.0; } for (j = 0; j < 16; j++) { *(dd + j) = +0.0; } } ========= > this seems to be a problem with the cost function: > > Cost of strength reduction of the access = > Cost for incrementing the new induction variable: 8 > Cost for increased register pressure: 4 > Cost for the memory reference: 1 > > Cost for expressing the access using i = > Cost for multiplication by 8: 12 > Cost for the memory reference: 1 (addition of the result of > multiplications takes place in the address). > > The result is that it is not worthwhile to perform strength reduction. > I will try to do something with the code that estimates cost of memory > references, since it is quite wrong here. could you please create a bugreport for this? The things are a bit more complicated than what I expected; there is actually no way how the target could let ivopts know that DFmode address for (reg + reg) is more expensive than just reg, in the current state. -- Summary: Missed ivopts opportunity Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: pthaugen at us dot ibm dot com CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: powerpc64-linux GCC host triplet: powerpc64-linux GCC target triplet: powerpc64-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18768