[Bug target/98302] [9 Regression] Wrong code on aarch64

2021-04-25 Thread rsandifo at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98302

rsandifo at gcc dot gnu.org  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #19 from rsandifo at gcc dot gnu.org  
---
Fixed.

[Bug target/98302] [9 Regression] Wrong code on aarch64

2021-04-25 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98302

--- Comment #18 from CVS Commits  ---
The releases/gcc-9 branch has been updated by Richard Sandiford
:

https://gcc.gnu.org/g:3fa4752e29a5b44219837ebad5bb09ec98af156e

commit r9-9462-g3fa4752e29a5b44219837ebad5bb09ec98af156e
Author: Richard Sandiford 
Date:   Sun Apr 25 14:51:14 2021 +0100

vect: Avoid generating out-of-range shifts [PR98302]

In this testcase we end up with:

  unsigned long long x = ...;
  char y = (char) (x << 37);

The overwidening pattern realised that only the low 8 bits
of x << 37 are needed, but then tried to turn that into:

  unsigned long long x = ...;
  char y = (char) x << 37;

which gives an out-of-range shift.  In this case y can simply
be replaced by zero, but as the comment in the patch says,
it's kind-of awkward to do that in the middle of vectorisation.

Most of the overwidening stuff is about keeping operations
as narrow as possible, which is important for vectorisation
but could be counter-productive for scalars (especially on
RISC targets).  In contrast, optimising y to zero in the above
feels like an independent optimisation that would benefit scalar
code and that should happen before vectorisation.

gcc/
PR tree-optimization/98302
* tree-vect-patterns.c (vect_determine_precisions_from_users): Make
sure that the precision remains greater than the shift count.

gcc/testsuite/
PR tree-optimization/98302
* gcc.dg/vect/pr98302.c: New test.

(cherry picked from commit 58a12b0eadac62e691fcf7325ab2bc2c93d46b61)

[Bug target/98302] [9 Regression] Wrong code on aarch64

2021-01-12 Thread rsandifo at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98302

rsandifo at gcc dot gnu.org  changed:

   What|Removed |Added

Summary|[9/10 Regression] Wrong |[9 Regression] Wrong code
   |code on aarch64 |on aarch64

--- Comment #17 from rsandifo at gcc dot gnu.org  
---
Fixed for GCC 10 by r10-9257.