[Bug tree-optimization/93734] [8/9/10 Regression] Invalid code generated with -O2 -march=haswell -ftree-vectorize

2020-02-13 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93734

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #4 from Jakub Jelinek  ---
#c2 isn't miscompiled since r10-4543-g599bd99078439b9f11cb271aa919844318381ec5
and the miscompilation started with
r8-6708-g85c5e2f576fd41e1ab5620cde3c63b3ca6673bea

[Bug tree-optimization/93734] [8/9/10 Regression] Invalid code generated with -O2 -march=haswell -ftree-vectorize

2020-02-13 Thread amonakov at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93734

Alexander Monakov  changed:

   What|Removed |Added

 CC||amonakov at gcc dot gnu.org

--- Comment #3 from Alexander Monakov  ---
I tried to make an equivalent C testcase, but complex ops don't map 1:1 from
Fortran, so it's a bit difficult. Nevertheless, here's a somewhat similar
testcase that aborts on 8/9, works on trunk, but IR and resulting assembly look
quite different:

( needs -O2 -ftree-vectorize -mfma -fcx-limited-range )

__attribute__((noipa))
static
_Complex double
test(_Complex double * __restrict a,
 _Complex double * __restrict x,
 _Complex double t, long jx)
{
long i, j;

for (j = 6, i = 3; i>=0; i--, j-=jx)
x[j] -= t*a[i];

return x[4];
}

int main()
{
_Complex double a[5] = {1, 1, 1, 1, 10};
_Complex double x[9] = {1,1,1,1,1,1,1,1,1};
if (test(a, x, 1, 2))
__builtin_abort();
}

[Bug tree-optimization/93734] [8/9/10 Regression] Invalid code generated with -O2 -march=haswell -ftree-vectorize

2020-02-13 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93734

Richard Biener  changed:

   What|Removed |Added

   Keywords||needs-bisection
  Known to work||10.0
  Known to fail|10.0|

--- Comment #2 from Richard Biener  ---
Hmm, it seems to be fixed on trunk.

Testcase that aborts on failure, we probably have a duplicate.

subroutine test(incx)
  implicit none
  integer i,incx,jx
  double complex a(5),x(9),temp

  a(1:4)=1
  a(5)=10
  x(1:9)=1

  jx = 9
  temp = x(9)
  do i = 4,1,-1
 jx = jx - incx
 x(jx) = x(jx) - temp*a(i)
  enddo

  if (x(5).ne.0) call abort
end subroutine test

program bug
  call test(2)
end program bug

[Bug tree-optimization/93734] [8/9/10 Regression] Invalid code generated with -O2 -march=haswell -ftree-vectorize

2020-02-13 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93734

Richard Biener  changed:

   What|Removed |Added

 Target||x86_64-*-*
   Priority|P3  |P2
 Status|UNCONFIRMED |NEW
  Known to work||7.5.0
   Keywords||wrong-code
   Last reconfirmed||2020-02-13
  Component|fortran |tree-optimization
 Blocks||53947
 Ever confirmed|0   |1
Summary|Invalid code generated with |[8/9/10 Regression] Invalid
   |-O2 -march=haswell  |code generated with -O2
   |-ftree-vectorize|-march=haswell
   ||-ftree-vectorize
   Target Milestone|--- |8.4
  Known to fail||10.0, 8.1.0, 8.3.1, 9.1.0,
   ||9.2.1

--- Comment #1 from Richard Biener  ---
It works fine with GCC 7.5.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53947
[Bug 53947] [meta-bug] vectorizer missed-optimizations