diff options
author | Richard Sandiford <richard.sandiford@arm.com> | 2024-10-14 09:52:44 +0100 |
---|---|---|
committer | Richard Sandiford <richard.sandiford@arm.com> | 2024-10-14 09:52:44 +0100 |
commit | 50e7c51b0a0e9dc1d93f829016ae743b4f2e5070 (patch) | |
tree | fabed8b60c05a9ec05d2b54c410038afcc72de13 /gcc/tree-vectorizer.h | |
parent | 9f549d216c9716e787aaa38593bc9f83195b60ae (diff) | |
download | gcc-50e7c51b0a0e9dc1d93f829016ae743b4f2e5070.zip gcc-50e7c51b0a0e9dc1d93f829016ae743b4f2e5070.tar.gz gcc-50e7c51b0a0e9dc1d93f829016ae743b4f2e5070.tar.bz2 |
aarch64: Fix folding of degenerate svwhilele case [PR117045]
The svwhilele folder mishandled the degenerate case in which
the second argument is the maximum integer. In that case,
the result is all-true regardless of the first parameter:
If the second scalar operand is equal to the maximum signed integer
value then a condition which includes an equality test can never fail
and the result will be an all-true predicate.
This is because the conceptual "increment the first operand
by 1 after each element" is done modulo the range of the operand.
The GCC code was instead treating it as infinite precision.
whilele_5.c even had a test for the incorrect behaviour.
The easiest fix seemed to be to handle that case specially before
doing constant folding. This also copes with variable first operands.
gcc/
PR target/116999
PR target/117045
* config/aarch64/aarch64-sve-builtins-base.cc
(svwhilelx_impl::fold): Check for WHILELTs of the minimum value
and WHILELEs of the maximum value. Fold them to all-false and
all-true respectively.
gcc/testsuite/
PR target/116999
PR target/117045
* gcc.target/aarch64/sve/acle/general/whilele_5.c: Fix bogus
expected result.
* gcc.target/aarch64/sve/acle/general/whilele_11.c: New test.
* gcc.target/aarch64/sve/acle/general/whilele_12.c: Likewise.
Diffstat (limited to 'gcc/tree-vectorizer.h')
0 files changed, 0 insertions, 0 deletions