[Bug target/98302] [11 Regression] Wrong code on aarch64
rsandifo at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Dec 30 18:23:33 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98302
rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |rsandifo at gcc dot gnu.org
--- Comment #12 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> ---
This is caused by the overwidening pattern recognisers.
They correctly realise that in:
unsigned long long x = ...;
char y = x << 37;
only the low 8 bits of x << 37 are needed. But they then
take it too far and try to do an 8-bit shift by 37, which is
undefined in gimple.
The optimal fix would be to get the vectoriser to replace the
shift result with zero instead, but that's a bit awkward to do
and should really happen before vectorisation. The simplest fix
is to make sure that we don't narrow further than the shift amount
allows.
Testing a patch.
More information about the Gcc-bugs
mailing list