This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/47860] is vectorization of "condition in nested loop" supported
- From: "vincenzo.innocente at cern dot ch" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 23 Feb 2011 16:32:40 +0000
- Subject: [Bug tree-optimization/47860] is vectorization of "condition in nested loop" supported
- Auto-submitted: auto-generated
- References: <bug-47860-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47860
--- Comment #1 from vincenzo Innocente <vincenzo.innocente at cern dot ch> 2011-02-23 16:32:36 UTC ---
it seems that there is a problem in the use of "unsigned int":
shall I open a different bug report?
even a simple comparison fails to vectorize
float amin(float * c, unsigned int N) {
float min=c[0];
for (unsigned int i=1; i!=N; ++i)
min = min > c[i] ? c[i] : min;
return min;
}
while it DOES vectorize when I change it in
float amin(float * c, int N) {
float min=c[0];
for (int i=1; i!=N; ++i)
min = min > c[i] ? c[i] : min;
return min;
}
still the nested loop does not vectorize yet
cat nestedCond.cc
void nestedCond( double * __restrict__ x_in, double * __restrict__ x_out,
double * __restrict__ a, double * __restrict__ c, int M, int N) {
for (int j = 0; j < M; j++)
{
double x = x_in[j];
double curr_a = a[0];
for (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;
}
}
gcc -O3 -ffast-math -Wall -c nestedCond.cc -ftree-vectorizer-verbose=7
nestedCond.cc:2: note: not vectorized: control flow in loop.
nestedCond.cc:7: note: not vectorized: unsupported use in stmt.
nestedCond.cc:7: note: not vectorized: unsupported use in stmt.
nestedCond.cc:1: note: vectorized 0 loops in function.