Fix simplify_shift_const_1 handling of vector shifts
authorRichard Sandiford <richard.sandiford@arm.com>
Tue, 15 Nov 2016 17:57:53 +0000 (17:57 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Tue, 15 Nov 2016 17:57:53 +0000 (17:57 +0000)
commitba3c3dc0702eca06bde4841e3bbdf0d428b71968
tree51c0c3fdc5c0927ce9f1865ae0afe38fadb0b018
parent89e64bc0305f36a4abe486ce07cbee7c13a6dc81
Fix simplify_shift_const_1 handling of vector shifts

simplify_shift_const_1 handles both shifts of scalars by scalars
and shifts of vectors by scalars.  For vectors this means that
each element is shifted by the same amount.

However:

(a) the two cases weren't always distinguished, so we'd try
        things for vectors that only made sense for scalars.

(b) a lot of the range and bitcount checks were based on the
        bitsize or precision of the full shifted operand, rather
        than the mode of each element.

Fixing (b) accidentally exposed more optimisation opportunities,
although that wasn't the point of the patch.

gcc/
2016-11-15  Richard Sandiford  <richard.sandiford@arm.com>
    Alan Hayward  <alan.hayward@arm.com>
    David Sherwood  <david.sherwood@arm.com>

* combine.c (simplify_shift_const_1): Use the number of bits
in the inner mode to determine the range of the shift.
When handling shifts of vectors, skip any rules that apply
only to scalars.

Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>
From-SVN: r242442
gcc/ChangeLog
gcc/combine.c