public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "vincenzo.innocente at cern dot ch" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/48052] New: loop not vectorized if index is "unsigned int"
Date: Wed, 09 Mar 2011 18:49:00 -0000	[thread overview]
Message-ID: <bug-48052-4@http.gcc.gnu.org/bugzilla/> (raw)

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

           Summary: loop not vectorized if index is "unsigned int"
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: vincenzo.innocente@cern.ch


is there any reason why "unsigned int" is not suited to index loop for
auto-vectorization?
example

cat simpleLoop.cc
#include<cstddef>

void loop1( double const * __restrict__ x_in,  double * __restrict__ x_out,
double const * __restrict__ c, int N) { 
   for(int i=0; i!=N; ++i)
       x_out[i] = c[i]*x_in[i];
}



void loop2( double const * __restrict__ x_in,  double * __restrict__ x_out,
double const * __restrict__ c, unsigned int N) {
   for(unsigned int i=0; i!=N; ++i)
       x_out[i] = c[i]*x_in[i];
}

void loop21( double const * __restrict__ x_in,  double * __restrict__ x_out,
double const * __restrict__ c, size_t N) {
   for(size_t i=0; i!=N; ++i)
       x_out[i] = c[i]*x_in[i];
}

void loop21( double const * __restrict__ x_in,  double * __restrict__ x_out,
double const * __restrict__ c, unsigned long long N) {
   for(unsigned long long  i=0; i!=N; ++i)
       x_out[i] = c[i]*x_in[i];
}


void loop3( double const * __restrict__ x_in,  double * __restrict__ x_out,
double const * __restrict__ c, size_t N) {
   double const * end = x_in+N;
   for(; x_in!=end; ++x_in, ++x_out, ++c)
       (*x_out) = (*c) * (*x_in);
}

result:

g++ -v -O2 -ftree-vectorize -ftree-vectorizer-verbose=2 -c simpleLoop.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='-v' '-O2' '-ftree-vectorize' '-ftree-vectorizer-verbose=2'
'-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
 /usr/local/libexec/gcc/x86_64-unknown-linux-gnu/4.6.0/cc1plus -quiet -v
-D_GNU_SOURCE simpleLoop.cc -quiet -dumpbase simpleLoop.cc -mtune=generic
-march=x86-64 -auxbase simpleLoop -O2 -version -ftree-vectorize
-ftree-vectorizer-verbose=2 -o /tmp/innocent/ccUB9xBg.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

simpleLoop.cc:4: note: LOOP VECTORIZED.
simpleLoop.cc:3: note: vectorized 1 loops in function.

simpleLoop.cc:11: note: not vectorized: data ref analysis failed D.2386_13 =
*D.2385_12;

simpleLoop.cc:10: note: vectorized 0 loops in function.

simpleLoop.cc:16: note: LOOP VECTORIZED.
simpleLoop.cc:15: note: vectorized 1 loops in function.

simpleLoop.cc:21: note: LOOP VECTORIZED.
simpleLoop.cc:20: note: vectorized 1 loops in function.

simpleLoop.cc:28: note: LOOP VECTORIZED.
simpleLoop.cc:26: note: vectorized 1 loops in function.


             reply	other threads:[~2011-03-09 18:49 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-09 18:49 vincenzo.innocente at cern dot ch [this message]
2011-03-10  0:21 ` [Bug tree-optimization/48052] " paolo.carlini at oracle dot com
2011-03-10  9:46 ` rguenth at gcc dot gnu.org
2011-03-10 10:22 ` paolo.carlini at oracle dot com
2011-03-10 10:54 ` vincenzo.innocente at cern dot ch
2011-03-10 11:22 ` paolo.carlini at oracle dot com
2011-03-10 11:31 ` paolo.carlini at oracle dot com
2011-03-11 10:16 ` vincenzo.innocente at cern dot ch
2011-03-11 10:26 ` rguenther at suse dot de
2011-03-14 10:08 ` vincenzo.innocente at cern dot ch
2015-05-04 19:33 ` az.zaafrani at gmail dot com
2015-05-06  6:57 ` rguenth at gcc dot gnu.org
2015-05-07 20:43 ` az.zaafrani at gmail dot com
2015-05-22 16:19 ` hiraditya at msn dot com
2015-06-02 10:19 ` amker at gcc dot gnu.org
2015-06-09  8:22 ` rguenth at gcc dot gnu.org
2015-06-23 13:23 ` evstupac at gmail dot com
2015-06-23 13:52 ` amker at gcc dot gnu.org
2015-06-24  2:34 ` amker at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-48052-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).