https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126463
--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Richard Earnshaw <[email protected]>: https://gcc.gnu.org/g:8ab2af4964f41248c3b1330f331a78ba6b5a6cc0 commit r17-3933-g8ab2af4964f41248c3b1330f331a78ba6b5a6cc0 Author: Richard Earnshaw <[email protected]> Date: Wed Sep 2 17:14:16 2026 +0100 aarch64: Fix issues with 'overflow' insns [PR126463] This issue looked like a simple 1-character typo, but when trying to construct a suitable testcase, I found that the patterns were hardly ever being used. In the end there turned out to be three underlying issues: - we were selecting the wrong CCmode for NEG and MINUS overflow checks (more precisely, we weren't detecting these at all and then falling back to CCmode). - The patterns were not in canonical form, preventing combine from finding a match while optimizing. - Finally, when we did eventually get the preferred form, we had the invalid output template, causing the reported ICE. gcc/ChangeLog: PR target/126463 * config/aarch64/aarch64.cc (aarch64_select_cc_mode): Correctly match overflow detection idioms using MINUS and NEG. * config/aarch64/aarch64.md (subv<GPI:mode>4): Re-order the compare into canonical form. (subv<GPI:mode>4_insn): Likewise. (negv<GPI:mode>4): Likewise. (negv<GPI:mode>_insn): Likewise. Fix typo in output template. gcc/testsuite/ChangeLog: PR target/126463 * gcc.target/aarch64/negv.c: New test.
