Hi! On Mon, Nov 04, 2013 at 11:37:19AM +0100, Richard Biener wrote: > Just a quick question, queueing the thread for later review (aww, queue > back at >100 threads again - I can't get any work done anymore :(). > > What does #pragma omp declare simd guarantee about memory > side-effects and memory use in the function? That is, unless the > function can be safely annotated with the 'const' attribute the > whole thing is useless for the vectorizer.
The main restriction is: "The execution of the function or subroutine cannot have any side effects that would alter its execution for concurrent iterations of a SIMD chunk." There are other restrictions, omp declare simd functions can't call setjmp/longjmp or throw, etc. The functions certainly can't be in the general case annotated with the const attribute, they can read and write memory, but the user is responsible for making sure that the effects or running the function sequentially as part of non-vectorized loop are the same as running the simd clone of that as part of a vectorized loop with the given simdlen vectorization factor. So it is certainly meant to be used by the vectorizer, after all, that is it's sole purpose. Jakub