]> git.ipfire.org Git - thirdparty/gcc.git/commit
Fix folding of BIT_NOT_EXPR for POLY_INT_CST [PR118976]
authorRichard Sandiford <richard.sandiford@arm.com>
Tue, 11 Mar 2025 15:51:55 +0000 (15:51 +0000)
committerRichard Sandiford <richard.sandiford@arm.com>
Tue, 11 Mar 2025 15:51:55 +0000 (15:51 +0000)
commit587b370c8492aadaab14c57e242c66778cc78891
tree08ad238c377148366f9dfa0f4320d46bb8d05fd7
parent4f61ae081d694d3a1e99b45680f3af25ab17e3a8
Fix folding of BIT_NOT_EXPR for POLY_INT_CST [PR118976]

There was an embarrassing typo in the folding of BIT_NOT_EXPR for
POLY_INT_CSTs: it used - rather than ~ on the poly_int.  Not sure
how that happened, but it might have been due to the way that
~x is implemented as -1 - x internally.

gcc/
PR tree-optimization/118976
* fold-const.cc (const_unop): Use ~ rather than - for BIT_NOT_EXPR.
* config/aarch64/aarch64.cc (aarch64_test_sve_folding): New function.
(aarch64_run_selftests): Run it.

(cherry picked from commit 78380fd7f743e23dfdf013d68a2f0347e1511550)
gcc/config/aarch64/aarch64.cc
gcc/fold-const.cc