This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/22184] New: tree vectorizer depends on context


Consider the following short program. If it is compiled MyFunc1 is vectorized 
but MyFunc2 is not. Both fuctions differ only in the empty loop, which is a 
comment in MyMunc2. My compiler is the latest gcc41 snapshot (20050618)

Michael Cieslinski


double MyFunc1 (int size)
{
    int len = size + 1;
    double Data[16] = {0};
//    for (int i=3; i<len; i++) {}  // empty loop

    for (int i=0; i<len; i++)
        Data[i] = Data[i]>=0 ? Data[i] : -Data[i];

    return Data[1];
}

double MyFunc2 (int size)
{
    int len = size + 1;
    double Data[16] = {0};
    for (int i=3; i<len; i++) {}  // empty loop

    for (int i=0; i<len; i++)
        Data[i] = Data[i]>=0 ? Data[i] : -Data[i];

    return Data[1];
}

Output from gcc:
g++41c -O2 -ftree-vectorize -c vec-test.cpp -ftree-vectorizer-verbose=5

vec-test.cpp:7: note: accesses have the same alignment.
vec-test.cpp:7: note: LOOP VECTORIZED.
vec-test.cpp:1: note: vectorized 1 loops in function.

vec-test.cpp:17: note: not vectorized: unsupported data-type
vec-test.cpp:19: note: not vectorized: number of iterations cannot be computed.
vec-test.cpp:13: note: vectorized 0 loops in function.

g++41c -v
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-4.1-20050618/configure --prefix=/usr/local/gcc41c --
program-suffix=41c --with-arch=opteron --enable-languages=c,c++ --enable-
checking
Thread model: posix
gcc version 4.1.0 20050618 (experimental)

-- 
           Summary: tree vectorizer depends on context
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: micis at gmx dot de
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22184


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]