in the following code, first function is vectorized, while the second one is not:
typedef float aligned_float __attribute__((aligned(4 * sizeof(float)))); typedef aligned_float * __restrict__ restricted_float_ptr; void test(int n, restricted_float_ptr in, restricted_float_ptr out) { for (int i = 0; i != n; ++i) out[i] = in[i] + 1.f; } void test2(int n, aligned_float * inarg, aligned_float * outarg) { restricted_float_ptr in = inarg; restricted_float_ptr out = outarg; for (int i = 0; i != n; ++i) out[i] = in[i] + 1.f; } -- Summary: [autovectorize]: missed optimization Product: gcc Version: 4.2.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: tim at klingt dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34378