The diagnostic message is not clear when compiling this code from FFmpeg with gcc-4.5 -c vsad_intra.c -O3 -ffast-math -ftree-vectorizer-verbose=7 -msse2 [...] ac3_downmix.c:10: note: cost model: vector iteration cost = 2060 is divisible by scalar iteration cost = 7 by a factor greater than or equal to the vectorization factor = 4 . ac3_downmix.c:10: note: not vectorized: vectorization not profitable. [...] ac3_downmix.c:20: note: cost model: vector iteration cost = 2056 is divisible by scalar iteration cost = 4 by a factor greater than or equal to the vectorization factor = 4 . ac3_downmix.c:20: note: not vectorized: vectorization not profitable.
What does this message mean? "vector iteration cost = 2056 is divisible by scalar iteration cost = 4 by a factor greater than or equal to the vectorization factor = 4 ." Is the vectorization not profitable? Why? typedef long int intptr_t; void ff_ac3_downmix_c(float (*samples)[256], float (*matrix)[2], int out_ch, int in_ch, int len) { int i, j; float v0, v1; if(out_ch == 2) { for(i=0; i<len; i++) { v0 = v1 = 0.0f; for(j=0; j<in_ch; j++) { v0 += samples[j][i] * matrix[j][0]; v1 += samples[j][i] * matrix[j][1]; } samples[0][i] = v0; samples[1][i] = v1; } } else if(out_ch == 1) { for(i=0; i<len; i++) { v0 = 0.0f; for(j=0; j<in_ch; j++) v0 += samples[j][i] * matrix[j][0]; samples[0][i] = v0; } } } -- Summary: Diagnostic message is not clear for vectorization profitability analysis Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: spop at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43431