On Wed, Apr 24, 2013 at 08:25:36AM +0200, Jakub Jelinek wrote: > BTW, the semantics of private/firstprivate/lastprivate desribed in > http://software.intel.com/sites/products/documentation/studio/composer/en-us/2011Update/compiler_c/cref_cls/common/cppref_pragma_simd.htm > doesn't seem to match the semantics of those in #pragma omp simd. > private in OpenMP I understand is private to the whole loop (or SIMD lane?;
SIMD lane apparently. Guess that is going to be quite difficult, because at the point of omp lowering or expansion we are nowhere close to knowing what vectorization factor we are going to choose, all we have is an upper bound on that based on the target ISA and safelen clause. If say private clause is used with C++ classes with non-trivial ctors/dtors that would make a difference. Plus how to represent this in the IL. struct A { A (); ~A (); A (const A &); int i; }; void foo () { A a, b; #pragma omp simd private (a) lastprivate (b) for (int i = 0; i < 10; i++) { a.i++; b.i++; } } Right now what gomp4 branch does is that it will just construct private vars around the whole loop, as in: void foo () { A a, b; { A a', b'; int i; for (i = 0; i < 10; i++) { a'.i++; b'.i++; if (i == 9) b = b'; } } } Jakub