public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/50596] New: Problems in vectorization of condition expression
@ 2011-10-03  8:08 vincenzo.innocente at cern dot ch
  2011-10-03  8:41 ` [Bug tree-optimization/50596] " vincenzo.innocente at cern dot ch
                   ` (18 more replies)
  0 siblings, 19 replies; 20+ messages in thread
From: vincenzo.innocente at cern dot ch @ 2011-10-03  8:08 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 50596
           Summary: Problems in vectorization of condition expression
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: vincenzo.innocente@cern.ch


I've the need to vectorize something like this
const int N=1024;
float a[1024];
float b[1024];
float c[1024];
float d[1024];
bool z[1024];
// not vectorized: control flow in loop
void ori() {
  for (int i=0; i!=N; ++i)
    z[i] = a[i]<b[i] && c[i]<d[i];
}

The only equivalent function that vectorize is
float r[1024];
void bar() {
  for (int i=0; i!=N; ++i)
    r[i] = (a[i]<b[i] ? 1.f : 0.f) *  ( c[i]<d[i] ? 1.f : 0.f);
}
(not exactly a highly optimized version…)

All other variants below do not vectorize for the reason in the comment that
precede each

// not vectorized: no vectype for stmt: z[i_17] = D.2199_10;
// scalar_type: bool
void ori2() {
  for (int i=0; i!=N; ++i)
    z[i] = a[i]<b[i] & c[i]<d[i];
}


// not vectorized: control flow in loop.
int j[1024];
void foo1() {
  for (int i=0; i!=N; ++i)
    j[i] = a[i]<b[i] && c[i]<d[i];
}

// not vectorized: unsupported data-type bool
void foo2() {
  for (int i=0; i!=N; ++i)
    j[i] = int(a[i]<b[i]) & int(c[i]<d[i]);
}

// not vectorized: unsupported data-type bool
void foo3() {
  for (int i=0; i!=N; ++i)
    j[i] = int(a[i]<b[i]);
}

// not vectorized: unsupported data-type bool
void foo4() {
  for (int i=0; i!=N; ++i)
    j[i] = a[i]<b[i] ? 1L : 0L ;
}


any chance to make at least "foo2" or equivalent vectorized?


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

end of thread, other threads:[~2011-10-25  8:24 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-03  8:08 [Bug tree-optimization/50596] New: Problems in vectorization of condition expression vincenzo.innocente at cern dot ch
2011-10-03  8:41 ` [Bug tree-optimization/50596] " vincenzo.innocente at cern dot ch
2011-10-04  7:05 ` jakub at gcc dot gnu.org
2011-10-04  9:12 ` vincenzo.innocente at cern dot ch
2011-10-04 11:10 ` rguenth at gcc dot gnu.org
2011-10-04 11:14 ` jakub at gcc dot gnu.org
2011-10-04 11:28 ` rguenther at suse dot de
2011-10-04 11:29 ` rguenther at suse dot de
2011-10-05  7:11 ` jakub at gcc dot gnu.org
2011-10-06 11:58 ` jakub at gcc dot gnu.org
2011-10-06 12:31 ` irar at il dot ibm.com
2011-10-06 13:34 ` jakub at gcc dot gnu.org
2011-10-06 17:51 ` jakub at gcc dot gnu.org
2011-10-07  7:36 ` vincenzo.innocente at cern dot ch
2011-10-07 10:16 ` vincenzo.innocente at cern dot ch
2011-10-07 10:31 ` jakub at gcc dot gnu.org
2011-10-16 13:11 ` jakub at gcc dot gnu.org
2011-10-16 13:47 ` vincenzo.innocente at cern dot ch
2011-10-25  8:03 ` jakub at gcc dot gnu.org
2011-10-25  8:24 ` jakub 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).