The first patch in the series has some fallout in the testsuite,
particularly gcc.target/aarch64/shrn-combine-2.c.
Our previous patterns for SHRN matched both
(truncate (ashiftrt (x) (N))) and (truncate (lshiftrt (x) (N))
as these are equivalent for the shift amounts involved.
In our refactoring, however, we mapped shrn to truncate+lshiftrt.

The fix here is to iterate over ashiftrt,lshiftrt in the pattern for it.
However, we don't want to allow ashiftrt for us_truncate or lshiftrt for
ss_truncate from the ALL_TRUNC iterator.

This patch addds a AARCH64_VALID_SHRN_OP helper to gate the valid
combinations of truncations and shifts.

Bootstrapped and tested on aarch64-none-linux-gnu and
aarch64_be-none-elf.

gcc/ChangeLog:

        * config/aarch64/aarch64.h (AARCH64_VALID_SHRN_OP): Define.
        * config/aarch64/aarch64-simd.md
        (*aarch64_<shrn_op>shrn_n<mode>_insn<vczle><vczbe>): Rename to...
        (*aarch64_<shrn_op><shrn_s>shrn_n<mode>_insn<vczle><vczbe>): ... This.
        Use SHIFTRT iterator and add AARCH64_VALID_SHRN_OP to condition.
        * config/aarch64/iterators.md (shrn_s): New code attribute.

Attachment: s3.patch
Description: s3.patch

Reply via email to