]> git.ipfire.org Git - thirdparty/gcc.git/commit
aarch64: Fix mode mismatch when building a predicate [PR121118]
authorRichard Sandiford <richard.sandiford@arm.com>
Mon, 18 Aug 2025 11:15:21 +0000 (12:15 +0100)
committerRichard Sandiford <richard.sandiford@arm.com>
Mon, 18 Aug 2025 11:15:21 +0000 (12:15 +0100)
commit58a9717df098defb7f595fbc56122107e952a46b
tree0534f71add33aaf8dab542d140793e45251aa298
parent47cdd873eddcd4127812fb902961b88da26d333b
aarch64: Fix mode mismatch when building a predicate [PR121118]

This PR is about a case where we used aarch64_expand_sve_const_pred_trn
to combine two predicates, one of which was constructing using
aarch64_sve_move_pred_via_while.  The former requires the inputs
to have mode VNx16BI, but the latter returned VNx8BI for a .H
WHILELO.

The proper fix, used on trunk, is to make the pattern emitted by
aarch64_sve_move_pred_via_while produce an VNx16BI for all element
sizes, since every bit of the result is significant.  However,
that required some target-independent changes that are too invasive
to backport.  This patch goes for the simpler (but less robust) approach
of using the original pattern and casting it to VNx16BI after the fact.

Since the WHILELO pattern is an unspec, the chances of something
optimising it in a way that changes the undefined bits of the output
should be very low, especially on a release branch.  It is still a less
satisfactory fix though.

gcc/
PR target/121118
* config/aarch64/aarch64.cc (aarch64_sve_move_pred_via_while):
Return a VNx16BI predicate.

gcc/testsuite/
PR target/121118
* gcc.target/aarch64/sve/acle/general/pr121118_1.c: New test.
gcc/config/aarch64/aarch64.cc
gcc/testsuite/gcc.target/aarch64/sve/acle/general/pr121118_1.c [new file with mode: 0644]