http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47860
Summary: is vectorization of "condition in nested loop" supported Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassig...@gcc.gnu.org ReportedBy: vincenzo.innoce...@cern.ch In http://gcc.gnu.org/projects/tree-ssa/vectorization.html#nested I read that "condition in nested loop" was committed in the main line in 2009-12-03 for 4.6.0 I still get it non vectorize. what is the real situation of the feature described ion the page above? for instance nestedCond.cc:2: note: not vectorized: control flow in loop. nestedCond.cc:7: note: not vectorized: data ref analysis failed next_a_22 = *D.2335_21; full details below cat nestedCond.cc void nestedCond( double * __restrict__ x_in, double * __restrict__ x_out, double * __restrict__ a, double * __restrict__ c, unsigned int M, unsigned int N) { for (unsigned int j = 0; j < M; j++) { double x = x_in[j]; double curr_a = a[0]; for (unsigned int i = 0; i < N; i++) { double next_a = a[i+1]; curr_a = x > c[i] ? curr_a : next_a; } x_out[j] = curr_a; } } g++ $CXXFLAGS $OPTFLAGS -v -c nestedCond.cc Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-unknown-linux-gnu/4.6.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: ./configure --enable-gold=yes --enable-lto --with-fpmath=avx Thread model: posix gcc version 4.6.0 20110205 (experimental) (GCC) COLLECT_GCC_OPTIONS='-O2' '-std=gnu++0x' '-mavx' '-mtune=corei7-avx' '-ftree-vectorize' '-ftree-vectorizer-verbose=7' '-pthread' '-fPIC' '-fassociative-math' '-freciprocal-math' '-fno-math-errno' '-fno-signed-zeros' '-fno-trapping-math' '-ffinite-math-only' '-v' '-c' '-shared-libgcc' '-march=x86-64' /usr/local/libexec/gcc/x86_64-unknown-linux-gnu/4.6.0/cc1plus -quiet -v -D_GNU_SOURCE -D_REENTRANT nestedCond.cc -quiet -dumpbase nestedCond.cc -mavx -mtune=corei7-avx -march=x86-64 -auxbase nestedCond -O2 -std=gnu++0x -version -ftree-vectorize -ftree-vectorizer-verbose=7 -fPIC -fassociative-math -freciprocal-math -fno-math-errno -fno-signed-zeros -fno-trapping-math -ffinite-math-only -o /tmp/innocent/ccmT7uly.s GNU C++ (GCC) version 4.6.0 20110205 (experimental) (x86_64-unknown-linux-gnu) compiled by GNU C version 4.6.0 20110205 (experimental), GMP version 4.3.2, MPFR version 2.4.2, MPC version 0.8.1 GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 ignoring nonexistent directory "/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../../x86_64-unknown-linux-gnu/include" #include "..." search starts here: #include <...> search starts here: /usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../../include/c++/4.6.0 /usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../../include/c++/4.6.0/x86_64-unknown-linux-gnu /usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../../include/c++/4.6.0/backward /usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/include /usr/local/include /usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/include-fixed /usr/include End of search list. GNU C++ (GCC) version 4.6.0 20110205 (experimental) (x86_64-unknown-linux-gnu) compiled by GNU C version 4.6.0 20110205 (experimental), GMP version 4.3.2, MPFR version 2.4.2, MPC version 0.8.1 GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 Compiler executable checksum: 0d52c927b640361d99f7371685058a2b nestedCond.cc:2: note: not vectorized: control flow in loop. nestedCond.cc:7: note: not vectorized: data ref analysis failed next_a_22 = *D.2335_21; nestedCond.cc:1: note: vectorized 0 loops in function. COLLECT_GCC_OPTIONS='-O2' '-std=gnu++0x' '-mavx' '-mtune=corei7-avx' '-ftree-vectorize' '-ftree-vectorizer-verbose=7' '-pthread' '-fPIC' '-fassociative-math' '-freciprocal-math' '-fno-math-errno' '-fno-signed-zeros' '-fno-trapping-math' '-ffinite-math-only' '-v' '-c' '-shared-libgcc' '-march=x86-64' as --64 -msse2avx -o nestedCond.o /tmp/innocent/ccmT7uly.s COMPILER_PATH=/usr/local/libexec/gcc/x86_64-unknown-linux-gnu/4.6.0/:/usr/local/libexec/gcc/x86_64-unknown-linux-gnu/4.6.0/:/usr/local/libexec/gcc/x86_64-unknown-linux-gnu/:/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/:/usr/local/lib/gcc/x86_64-unknown-linux-gnu/ LIBRARY_PATH=/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/:/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../:/lib/:/usr/lib/ COLLECT_GCC_OPTIONS='-O2' '-std=gnu++0x' '-mavx' '-mtune=corei7-avx' '-ftree-vectorize' '-ftree-vectorizer-verbose=7' '-pthread' '-fPIC' '-fassociative-math' '-freciprocal-math' '-fno-math-errno' '-fno-signed-zeros' '-fno-trapping-math' '-ffinite-math-only' '-v' '-c' '-shared-libgcc' '-march=x86-64'