public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/61194] New: vectorization failed with "bit-precision arithmetic not supported" even if conversion to int is requested
@ 2014-05-15 12:09 vincenzo.innocente at cern dot ch
  2014-05-15 14:20 ` [Bug tree-optimization/61194] " vincenzo.innocente at cern dot ch
                   ` (19 more replies)
  0 siblings, 20 replies; 21+ messages in thread
From: vincenzo.innocente at cern dot ch @ 2014-05-15 12:09 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 61194
           Summary: vectorization failed with "bit-precision arithmetic
                    not supported" even if conversion to int is requested
           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

z[i] = ( (x[i]>0) & (w[i]<0)) ? z[i] : y[i];
produces

bit-precision arithmetic not supported.
note: not vectorized: relevant stmt not supported: _6 = _5 > 0.0;

while integer bitwise operators are vectorized at will
 z[i] = ( k[i] & j[i] ) ? z[i] : y[i];

I tried to force conversion to int in many ways (see below) such as 
z[i] = ( int(x[i]>0) & int(w[i]<0)) ? z[i] : y[i];
succeeding only with the quite expensive
z[i] = (2==(int(x[i]>0) + int(w[i]<0))) ? z[i] : y[i];

is there a way to force gcc to use integer w/o using arithmetic operators?

c++ -Ofast -Wall -fno-tree-slp-vectorize -ftree-loop-if-convert-stores -S
cond.cc -msse4.2 -fopt-info-vec -fno-tree-slp-vectorize  -fopenmp
cat cond.cc
float x[1024];
float y[1024];
float z[1024];
float w[1024];

int k[1024];
int j[1024];


void bar() {
  for (int i=0; i<1024; ++i)
    z[i] = ( (x[i]>0) & (w[i]<0)) ? z[i] : y[i];
}


void barMP() {
#pragma omp simd
  for (int i=0; i<1024; ++i)
    z[i] = ( int(x[i]>0) & int(w[i]<0)) ? z[i] : y[i];
}


void barInt() {
  for (int i=0; i<1024; ++i)
    z[i] = ( int(x[i]>0) & int(w[i]<0)) ? z[i] : y[i];
}

void barInt0() {
  for (int i=0; i<1024; ++i)
    z[i] = ( (0+int(x[i]>0)) & (0+int(w[i]<0)) ) ? z[i] : y[i];
}


void barPlus() {
  for (int i=0; i<1024; ++i)
    z[i] = (2==(int(x[i]>0) + int(w[i]<0))) ? z[i] : y[i];
}


void foo() {
  for (int i=0; i<1024; ++i)
    z[i] = ( k[i] & j[i] ) ? z[i] : y[i];
}


void foo2() {
  for (int i=0; i<1024; ++i) {
    k[i] = x[i]>0; j[i] = w[i]<0;
  }
}

void bar2() {
  for (int i=0; i<1024; ++i) {
    k[i] = x[i]>0; j[i] = w[i]<0;
    z[i] = ( k[i] & j[i]) ? z[i] : y[i];
 }
}


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

end of thread, other threads:[~2015-06-26 20:33 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-15 12:09 [Bug tree-optimization/61194] New: vectorization failed with "bit-precision arithmetic not supported" even if conversion to int is requested vincenzo.innocente at cern dot ch
2014-05-15 14:20 ` [Bug tree-optimization/61194] " vincenzo.innocente at cern dot ch
2014-05-15 14:29 ` vincenzo.innocente at cern dot ch
2014-05-15 14:43 ` [Bug tree-optimization/61194] [4.9 Regression] " rguenth at gcc dot gnu.org
2014-05-15 14:58 ` [Bug tree-optimization/61194] [4.9/4.10 " rguenth at gcc dot gnu.org
2014-05-15 15:06 ` rguenth at gcc dot gnu.org
2014-05-15 15:35 ` vincenzo.innocente at cern dot ch
2014-05-16  9:18 ` rguenth at gcc dot gnu.org
2014-05-16  9:51 ` vincenzo.innocente at cern dot ch
2014-05-16 10:31 ` rguenther at suse dot de
2014-05-16 11:21 ` rguenth at gcc dot gnu.org
2014-05-16 11:45 ` rguenth at gcc dot gnu.org
2014-05-16 12:10 ` rguenth at gcc dot gnu.org
2014-05-16 12:16 ` rguenth at gcc dot gnu.org
2014-05-16 12:20 ` vincenzo.innocente at cern dot ch
2014-05-16 12:25 ` vincenzo.innocente at cern dot ch
2014-07-16 13:27 ` jakub at gcc dot gnu.org
2014-10-30 10:38 ` [Bug tree-optimization/61194] [4.9/5 " jakub at gcc dot gnu.org
2014-12-01 12:04 ` rguenth at gcc dot gnu.org
2015-06-26 20:03 ` [Bug tree-optimization/61194] [4.9/5/6 " jakub at gcc dot gnu.org
2015-06-26 20:33 ` 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).