aarch64: Make aarch64_add_offset work with -ftrapv [PR99540]
authorRichard Sandiford <richard.sandiford@arm.com>
Tue, 23 Mar 2021 14:02:03 +0000 (14:02 +0000)
committerRichard Sandiford <richard.sandiford@arm.com>
Tue, 23 Mar 2021 14:02:03 +0000 (14:02 +0000)
commitd7cea7ceff9a2be7436108030c598628c51fba0f
treeec6e1ac8bc0bfd796da0a91e3df0c8e9fc780058
parent9c89c9e9c6b59260c7745c8714b69f94784a9c13
aarch64: Make aarch64_add_offset work with -ftrapv [PR99540]

aarch64_add_offset uses expand_mult to multiply the SVE VL by an
out-of-range constant.  expand_mult takes an argument to indicate
whether the multiplication is signed or unsigned, but in this
context the multiplication is effectively signless and so the
choice seemed arbitrary.

However, one of the things that the signedness input does is
indicate whether signed overflow should be trapped for -ftrapv.
We don't want that here, so we must treat the multiplication
as unsigned.

gcc/
2021-03-23  Jakub Jelinek  <jakub@redhat.com>

PR target/99540
* config/aarch64/aarch64.c (aarch64_add_offset): Tell
expand_mult to perform an unsigned rather than a signed
multiplication.

gcc/testsuite/
2021-03-23  Richard Sandiford  <richard.sandiford@arm.com>

PR target/99540
* gcc.dg/vect/pr99540.c: New test.
gcc/config/aarch64/aarch64.c
gcc/testsuite/gcc.dg/vect/pr99540.c [new file with mode: 0644]