[AArch64] Fix handling of npatterns>1 constants for partial SVE modes
authorRichard Sandiford <richard.sandiford@arm.com>
Thu, 19 Dec 2019 14:52:46 +0000 (14:52 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Thu, 19 Dec 2019 14:52:46 +0000 (14:52 +0000)
commitb23c6a2c604c0dccf14cc3461357a28ffb99ed88
tree71c2e52a118ed2e9102a046cdb791e86560a1250
parent3561caa298e9f37e91e24a80ca7bd4830ef720ed
[AArch64] Fix handling of npatterns>1 constants for partial SVE modes

For partial SVE vectors of element X, we want to treat duplicates
of single X elements in the same way as for full vectors of X.
But if a constant instead contains a repeating pattern of X elements,
the transition from one value to the next must happen at container
boundaries rather than element boundaries.  E.g. a VNx4HI should
in that case contain the same number of constants as a VNx4SI.

Fixing this means that we need a reinterpret from the container-based
mode to the partial mode; e.g. in the above example we need a
reinterpret from VNx4SI to VNx4HI.  We can't use subregs for that
because they're forbidden by aarch64_can_change_class_mode; we should
handle them in the same way as for big-endian instead.

2019-12-19  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* config/aarch64/aarch64.c (aarch64_simd_valid_immediate): When
handling partial SVE vectors, use the container mode rather than
the element mode if the constant isn't a single-element duplicate.
* config/aarch64/aarch64-sve.md (@aarch64_sve_reinterpret<mode>):
Check targetm.can_change_mode_class instead of BYTES_BIG_ENDIAN.

gcc/testsuite/
* gcc.target/aarch64/sve/mixed_size_9.c: New test.

From-SVN: r279580
gcc/ChangeLog
gcc/config/aarch64/aarch64-sve.md
gcc/config/aarch64/aarch64.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/aarch64/sve/mixed_size_9.c [new file with mode: 0644]