Fix VIEW_CONVERT_EXPRs for VECTOR_BOOLEAN_TYPE_Ps
commit7b86aaf45c00ec038a0da003f41d5334a00e603c
authorRichard Sandiford <richard.sandiford@arm.com>
Wed, 4 Dec 2019 13:14:20 +0000 (4 13:14 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Wed, 4 Dec 2019 13:14:20 +0000 (4 13:14 +0000)
tree835dc708734a21ac420210c3dda56434cbe3b63f
parent0849cdae714ddf056a4944f31eef53a465f1bcd0
Fix VIEW_CONVERT_EXPRs for VECTOR_BOOLEAN_TYPE_Ps

In r278410 I added code to handle VIEW_CONVERT_EXPRs between
variable-length vectors.  This included support for decoding
a VECTOR_BOOLEAN_TYPE_P with subbyte elements.

However, it turns out that we were already mishandling such bool vectors
for fixed-length vectors: we treated each element as a stand-alone byte
instead of putting multiple elements into the same byte.  I think in
principle this could have been an issue for AVX512 as well.

This patch adds encoding support for boolean vectors and reuses
a version of the new decode support for fixed-length vectors.

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

gcc/
* fold-const.c (native_encode_vector_part): Handle
VECTOR_BOOLEAN_TYPE_Ps that have subbyte precision.
(native_decode_vector_tree): Delete, moving the bulk of the code to...
(native_interpret_vector_part): ...this new function.  Use a pointer
and length instead of a vec<> and start index.
(native_interpret_vector): Use native_interpret_vector_part.
(fold_view_convert_vector_encoding): Likewise.

gcc/testsuite/
* gcc.target/aarch64/sve/acle/general/whilelt_5.c: New test.

From-SVN: r278964
gcc/ChangeLog
gcc/fold-const.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/aarch64/sve/acle/general/whilelt_5.c [new file with mode: 0644]