Richard Guenther <[EMAIL PROTECTED]> wrote on 05/02/2007 17:59:00: > On Mon, 5 Feb 2007, Paolo Bonzini wrote: > > > > > > As we also only vectorize innermost loops I believe doing a > > > complete unrolling pass early will help in general (I pushed > > > for this some time ago). > > > > > > Thoughts? > > > > It might also hurt, though, since we don't have a basic block vectorizer. > > IIUC the vectorizer is able to turn > > > > for (i = 0; i < 4; i++) > > v[i] = 0.0; > > > > into > > > > *(vector double *)v = (vector double){0.0, 0.0, 0.0, 0.0}; > > That's true.
That's going to change once this project goes in: "(3.2) Straight-line code vectorization" from http://gcc.gnu.org/wiki/AutovectBranchOptimizations. In fact, I think in autovect-branch, if you unroll the above loop it should get vectorized already. Ira - is that really the case? > But we can not do constant propagation out of this > (and the vectorizer leaves us with a lot of cruft which is only > removed much later). > this calls for improving/extending constant propagation, and also improving the vectorizer to convey information that it has on constants and ranges that are otherwise hard to figure out. For example, when the VF is 4 and we peel before the loop to align memory-accesses, and after the loop to align the number of iterations, we know that the maximum number of iterations of the peeled loops is 3, but I don't think we let the rest of the compiler know about that. > The above case would also ask for an early vectorization pass if the > loop was wrapped into another. > not sure I understand what you mean? > Finding a good heuristic for which loops to completely unroll early > is not easy, though for odd small numbers of iterations it is > probably always profitable. > In general I prefer to leave such decisions to the vectorizer - the vectorizer (with a proper cost model, that is now being built) should be able to decide not to vectorize too small loops, leaving them to the subsequent complete-loop-unrolling pass dorit > Richard. > > -- > Richard Guenther <[EMAIL PROTECTED]> > Novell / SUSE Labs