The frontend translates this function: void test_loop_c(char a[16], char b[16], char c[16]) { int i;
for(i = 0; i<16; i++) { c[i] = a[i] + b[i]; } } to { int i; int i; i = 0; goto <D2143>; <D2142>:; *(c + (char *) (unsigned int) i) = (char) ((signed char) *(a + (char *) (unsigned int) i) + (signed char) *(b + (char *) (unsigned int) i)); i++ ; <D2143>:; if (i <= 15) goto <D2142>; else goto <D2144>; <D2144>:; } and therefore misses an opportunity for vectorization (e.g. paddb from SSE2) because the table is accessed by pointers and the dependance analysis does not work in the loop. Note that GCC vectorizes the same code, with a, b and c defined as global variables as expected. -- Summary: missed vectorization opportunity Product: gcc Version: 4.1.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: hurbain at cri dot ensmp dot fr CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21212