On Tue, Apr 23, 2013 at 09:32:29PM +0000, Iyer, Balaji V wrote: > My apologies if the documentation did not explain this correctly. It > was written by compiler developers and not language developers. #pragma > simd is the guarantee the user gives the compiler that the inter-iteration > dependencies do not matter. So, if the user omits the vectorlength the > clause then the compiler can, in effect, choose N, where N is the number > of loop iterations.
The documentation doesn't suggest that. Anyway, so #pragma simd should be equivalent to #pragma omp simd wrt. inter-iteration dependencies, and #pragma simd vectorlength(a, b, c) to #pragma omp simd safelen(max (a, b, c)) ? If so, then the FE could emit OMP_SIMD for #pragma simd, and if vectorlength is present, add OMP_CLAUSE_SAFELEN with the maximum of the values in all vectorlength clauses, and keep the vectorlength clauses around too as CILK_CLAUSE_VECTORLENGTH as hints to the vectorizer? Also, Aldy said that #pragma simd loops allow != condition, how do you compute number of iterations in that case if the increment isn't constant? As conditional depending on whether increment is positive or negative? != condition isn't allowed in OpenMP, so there it is always obvious which direction it should iterate, and the expansion code will assume if it sees NE_EXPR that it is just folded border test (comparison with maximum or minimum value). Jakub