[Bug target/107131] [11/12/13 Regression] wrong code with -Os -fno-ipa-vrp -fno-tree-bit-ccp

2023-01-13 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107131

--- Comment #9 from CVS Commits  ---
The master branch has been updated by Jakub Jelinek :

https://gcc.gnu.org/g:254cf9552ffb1693f0bc74f6d25601dafafbc144

commit r13-5150-g254cf9552ffb1693f0bc74f6d25601dafafbc144
Author: Jakub Jelinek 
Date:   Fri Jan 13 17:37:52 2023 +0100

testsuite: Add another testcase from PR107131

This one is hand reduced to problematic code from optimized dump
that used to be miscompiled during combine starting with
r12-303 and fixed with r13-3530 aka PR107172 fix.

2023-01-13  Jakub Jelinek  

PR target/107131
* gcc.c-torture/execute/pr107131.c: New test.

[Bug target/107131] [11/12/13 Regression] wrong code with -Os -fno-ipa-vrp -fno-tree-bit-ccp

2023-01-13 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107131

Jakub Jelinek  changed:

   What|Removed |Added

 CC||hjl.tools at gmail dot com,
   ||uros at gcc dot gnu.org

--- Comment #8 from Jakub Jelinek  ---
I think the problem happens during combine.  Parts of the vector code related
to:
  V b = (V) { } >= o;
  V c = b <= (V)(b >= (V) { 0, 0, 0, 0, 0, 0x90DF0BE3990AC871ULL });
- in particular the scalar c[5] computation, i.e.
unsigned long long b = 0 >= o ? -1ULL : 0ULL;
unsigned long long c = b <= (b >= 0x90DF0BE3990AC871ULL ? -1ULL : 0ULL) ? -1ULL
: 0ULL;
evaluates to 0 rather than -1 that it should when o is 0.

This boils down to:
__attribute__((noipa)) unsigned long long
foo (unsigned char o)
{
  unsigned long long t1 = -(long long) (o == 0);
  unsigned long long t2 = -(long long) (t1 > 10439075533421201520ULL);
  unsigned long long t3 = -(long long) (t1 <= t2);
  return t3;
}

int
main ()
{
  if (foo (0) != -1ULL)
__builtin_abort ();
  return 0;
}
at -O2 or -Os, which was miscompiled starting with r12-303-g86403f4e6e5f7216
and got fixed with r13-3530-g0e36a9c6915c713d30.
No idea why this is marked as 11 regression though...

So, do we need to backport PR107172 change to 12 branch?

[Bug target/107131] [11/12/13 Regression] wrong code with -Os -fno-ipa-vrp -fno-tree-bit-ccp

2023-01-13 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107131

--- Comment #7 from Jakub Jelinek  ---
If I change the testcase to:
/* PR target/107131 */
/* { dg-do run } */
/* { dg-options "-Os -fno-ipa-vrp -fno-tree-bit-ccp -Wno-psabi" } */

typedef unsigned char C;
typedef unsigned long long __attribute__((__vector_size__ (32))) U;
typedef unsigned long long __attribute__((__vector_size__ (64))) V;

static __attribute__((__noclone__)) C
foo (C o, U x, U y, U z)
{
  V w = { x[0], x[1], x[2], x[3], 0, 0, 0, 0 };
  V a = __builtin_shuffle (w, w, (V) {3, 1, 3, 0, 0, 1, 1, 3});
  V b = (V) { } >= o;
  V c = b <= (V)(b >= (V) { 0, 0, 0, 0, 0, 0x90DF0BE3990AC871ULL });
  U d = __builtin_shuffle (y, z, (U) {3, 1, 4, 5});
  V e = a + c;
  U f = ((union { V v; U u[2]; }) e).u[1] + d;
  return ((union { U u; C c[32]; }) f).c[9];
}

int
main ()
{
  if (__SIZEOF_LONG_LONG__ != 8 || __CHAR_BIT__ != 8)
return 0;
  C x = foo (0, (U) { }, (U) { }, (U) { });
  if (x != 0xff)
__builtin_abort();  
  return 0;
}
then it started with r12-1055-gb6bdd7a4cb41ee057f2d064fffcb00f23ce6b497
already,
but similarly to the other testcase got fixed or made latent with
r13-3217.

[Bug target/107131] [11/12/13 Regression] wrong code with -Os -fno-ipa-vrp -fno-tree-bit-ccp

2023-01-13 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107131

--- Comment #6 from CVS Commits  ---
The master branch has been updated by Jakub Jelinek :

https://gcc.gnu.org/g:add71b95dd27d73d64eee0a9c8f748672b7050f5

commit r13-5139-gadd71b95dd27d73d64eee0a9c8f748672b7050f5
Author: Jakub Jelinek 
Date:   Fri Jan 13 11:13:22 2023 +0100

testsuite: Add testcase for PR that went latent in GCC 13 [PR107131]

The following testcase is probably latent since r13-3217-gc4d15dddf6b9e.
Adding testcase so that it doesn't silently reappear.

2023-01-13  Jakub Jelinek  

PR target/107131
* gcc.dg/pr107131.c: New test.

[Bug target/107131] [11/12/13 Regression] wrong code with -Os -fno-ipa-vrp -fno-tree-bit-ccp

2022-11-18 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107131

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #5 from Jakub Jelinek  ---
This doesn't fail on the trunk anymore since
r13-3217-gc4d15dddf6b9eacb36f535807ad2ee364af46e04

[Bug target/107131] [11/12/13 Regression] wrong code with -Os -fno-ipa-vrp -fno-tree-bit-ccp

2022-10-18 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107131

Richard Biener  changed:

   What|Removed |Added

   Priority|P3  |P2

[Bug target/107131] [11/12/13 Regression] wrong code with -Os -fno-ipa-vrp -fno-tree-bit-ccp

2022-10-06 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107131

Richard Biener  changed:

   What|Removed |Added

Summary|[11/12 Regression] wrong|[11/12/13 Regression] wrong
   |code with -Os -fno-ipa-vrp  |code with -Os -fno-ipa-vrp
   |-fno-tree-bit-ccp   |-fno-tree-bit-ccp
   Target Milestone|--- |11.4

--- Comment #4 from Richard Biener  ---
Note __builtin_shufflevector might just be the point we were able to produce
the
input GIMPLE required to trigger the previously latent issue.

The difference between -O (working) and -Os (failing) starts at RTL expansion
only.