http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50596
Bug #: 50596 Summary: Problems in vectorization of condition expression Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassig...@gcc.gnu.org ReportedBy: vincenzo.innoce...@cern.ch I've the need to vectorize something like this const int N=1024; float a[1024]; float b[1024]; float c[1024]; float d[1024]; bool z[1024]; // not vectorized: control flow in loop void ori() { for (int i=0; i!=N; ++i) z[i] = a[i]<b[i] && c[i]<d[i]; } The only equivalent function that vectorize is float r[1024]; void bar() { for (int i=0; i!=N; ++i) r[i] = (a[i]<b[i] ? 1.f : 0.f) * ( c[i]<d[i] ? 1.f : 0.f); } (not exactly a highly optimized version…) All other variants below do not vectorize for the reason in the comment that precede each // not vectorized: no vectype for stmt: z[i_17] = D.2199_10; // scalar_type: bool void ori2() { for (int i=0; i!=N; ++i) z[i] = a[i]<b[i] & c[i]<d[i]; } // not vectorized: control flow in loop. int j[1024]; void foo1() { for (int i=0; i!=N; ++i) j[i] = a[i]<b[i] && c[i]<d[i]; } // not vectorized: unsupported data-type bool void foo2() { for (int i=0; i!=N; ++i) j[i] = int(a[i]<b[i]) & int(c[i]<d[i]); } // not vectorized: unsupported data-type bool void foo3() { for (int i=0; i!=N; ++i) j[i] = int(a[i]<b[i]); } // not vectorized: unsupported data-type bool void foo4() { for (int i=0; i!=N; ++i) j[i] = a[i]<b[i] ? 1L : 0L ; } any chance to make at least "foo2" or equivalent vectorized?