public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/61171] New: vectorization fails for a reduction in presence of subtraction
@ 2014-05-13 12:55 vincenzo.innocente at cern dot ch
  2015-04-29 12:10 ` [Bug tree-optimization/61171] " rguenth at gcc dot gnu.org
  2015-06-17 11:48 ` alalaw01 at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: vincenzo.innocente at cern dot ch @ 2014-05-13 12:55 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61171

            Bug ID: 61171
           Summary: vectorization fails for a reduction in presence of
                    subtraction
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vincenzo.innocente at cern dot ch

give this code
cat bug.cc
float px[1024];
float xx, vv;
unsigned int N=1024;

void ok() {
  for (auto j=0U; j<N; ++j) {
    auto ax = px[j]-xx;
    vv-=ax;
  }
}

void noOk() {
  for (auto j=0U; j<N; ++j) {
    auto ax = xx-px[j];
    vv+=ax;
  }
}
 c++ -std=c++11 -Ofast  -S bug.cc -march=haswell -fopt-info-vec-missed; cat
bug.s
ok vectorize, noOk does not because
bug.cc:13:3: note: reduction: not commutative/associative: vv.6_9 = _2 - _6;

even if the code is clearly identical (at least with Ofast)


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug tree-optimization/61171] vectorization fails for a reduction in presence of subtraction
  2014-05-13 12:55 [Bug tree-optimization/61171] New: vectorization fails for a reduction in presence of subtraction vincenzo.innocente at cern dot ch
@ 2015-04-29 12:10 ` rguenth at gcc dot gnu.org
  2015-06-17 11:48 ` alalaw01 at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-04-29 12:10 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61171

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-04-29
     Ever confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug tree-optimization/61171] vectorization fails for a reduction in presence of subtraction
  2014-05-13 12:55 [Bug tree-optimization/61171] New: vectorization fails for a reduction in presence of subtraction vincenzo.innocente at cern dot ch
  2015-04-29 12:10 ` [Bug tree-optimization/61171] " rguenth at gcc dot gnu.org
@ 2015-06-17 11:48 ` alalaw01 at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: alalaw01 at gcc dot gnu.org @ 2015-06-17 11:48 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61171

alalaw01 at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |alalaw01 at gcc dot gnu.org

--- Comment #2 from alalaw01 at gcc dot gnu.org ---
This vectorizes fine, if vv is made a local variable:

float isOk() {
  float vv = 0;
  for (int j=0U; j<N; ++j) {
    float ax = xx-px[j];
    vv+=ax;
  }
  return vv;
}


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-06-17 11:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-13 12:55 [Bug tree-optimization/61171] New: vectorization fails for a reduction in presence of subtraction vincenzo.innocente at cern dot ch
2015-04-29 12:10 ` [Bug tree-optimization/61171] " rguenth at gcc dot gnu.org
2015-06-17 11:48 ` alalaw01 at gcc dot gnu.org

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).