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/49513] New: introducing a product inhibit vectorization
Date: Thu, 23 Jun 2011 06:55:00 -0000	[thread overview]
Message-ID: <bug-49513-4@http.gcc.gnu.org/bugzilla/> (raw)

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

           Summary: introducing a product inhibit vectorization
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: vincenzo.innocente@cern.ch


in the simple example below the first loop vectorize, the second not
I'm using
gcc version 4.7.0 20110528 (experimental) (GCC) 

#include<cmath>
float __attribute__ ((aligned(16))) a[1024];
float __attribute__ ((aligned(16))) s[1024];
float __attribute__ ((aligned(16))) c[1024];


inline float bar(float y, float x ){
  float xx = fabs(x);
  float yy = fabs(y);

  float tmp =0.0f;
  if (yy>xx) {
    tmp = yy;
    yy=xx; xx=tmp;
  }
  float t=yy/xx;
  return t;
}

void foo1() {
  for (int i=0; i!=1024; ++i) {
    float z = i;
    a[i] = bar(s[i],c[i]);  
  }
}
void foo2() {
  for (int i=0; i!=1024; ++i) {
    float z = i;
    a[i] = bar(z*s[i],z*c[i]);  
 }
}



c++   -std=c++0x -Ofast -c vectBug.cc -ftree-vectorizer-verbose=7

vectBug.cc:21: note: vect_model_load_cost: aligned.
vectBug.cc:21: note: vect_get_data_access_cost: inside_cost = 1, outside_cost =
0.
vectBug.cc:21: note: vect_model_load_cost: aligned.
vectBug.cc:21: note: vect_get_data_access_cost: inside_cost = 2, outside_cost =
0.
vectBug.cc:21: note: vect_model_store_cost: aligned.
vectBug.cc:21: note: vect_get_data_access_cost: inside_cost = 3, outside_cost =
0.
vectBug.cc:21: note: vect_model_load_cost: aligned.
vectBug.cc:21: note: vect_model_load_cost: inside_cost = 1, outside_cost = 0 .
vectBug.cc:21: note: vect_model_load_cost: aligned.
vectBug.cc:21: note: vect_model_load_cost: inside_cost = 1, outside_cost = 0 .
vectBug.cc:21: note: vect_model_simple_cost: inside_cost = 1, outside_cost = 0
.
vectBug.cc:21: note: vect_model_simple_cost: inside_cost = 1, outside_cost = 0
.
vectBug.cc:21: note: vect_model_simple_cost: inside_cost = 1, outside_cost = 0
.
vectBug.cc:21: note: vect_model_store_cost: aligned.
vectBug.cc:21: note: vect_model_store_cost: inside_cost = 1, outside_cost = 0 .
vectBug.cc:21: note: Cost model analysis: 
  Vector inside of loop cost: 6
  Vector outside of loop cost: 0
  Scalar iteration cost: 8
  Scalar outside cost: 0
  prologue iterations: 0
  epilogue iterations: 0
  Calculated minimum iters for profitability: 1

vectBug.cc:21: note:   Profitability threshold = 3

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

vectBug.cc:27: note: not vectorized: control flow in loop.
vectBug.cc:26: note: vectorized 0 loops in function.


             reply	other threads:[~2011-06-23  6:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-23  6:55 vincenzo.innocente at cern dot ch [this message]
2011-06-23 11:55 ` [Bug tree-optimization/49513] PRE inhibits if-conversion and vectorization rguenth at gcc dot gnu.org
2011-06-23 12:17 ` vincenzo.innocente at cern dot ch
2011-06-23 12:59 ` [Bug tree-optimization/49513] DOM " rguenth at gcc dot gnu.org
2011-07-08 21:12 ` law at redhat dot com
2023-05-02  0:46 ` pinskia 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-49513-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).