https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90311
--- Comment #13 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-9 branch has been updated by Richard Earnshaw <rearn...@gcc.gnu.org>: https://gcc.gnu.org/g:d37244b40d20a54a12ee207a73518ad0f4edd88f commit r9-8344-gd37244b40d20a54a12ee207a73518ad0f4edd88f Author: Richard Earnshaw <rearn...@arm.com> Date: Thu Jul 18 13:56:52 2019 +0000 arm: Fix incorrect modes with 'borrow' operations [PR90311] Looking through the arm backend I noticed that the modes used to pass comparison types into subtract-with-carry operations were being incorrectly set. The result is that the compiler is not truly self-consistent. To clean this up I've introduced a new predicate, arm_borrow_operation (borrowed from the AArch64 backend) which can match the comparison type with the required mode and then fixed all the patterns to use this. The split patterns that were generating incorrect modes have all obviously been fixed as well. The basic rule for the use of a borrow is: - if the condition code was set by a 'subtract-like' operation (subs, cmp), then use CCmode and LTU. - if the condition code was by unsigned overflow of addition (adds), then use CC_Cmode and GEU. gcc: PR target/90311 Backport from master * config/arm/predicates.md (arm_borrow_operation): New predicate. * config/arm/arm.c (subdi3_compare1): Use CCmode for the split. (arm_subdi3, subdi_di_zesidi, subdi_di_sesidi): Likewise. (subdi_zesidi_zesidi): Likewise. (negdi2_compare, negdi2_insn): Likewise. (negdi_extensidi): Likewise. (negdi_zero_extendsidi): Likewise. (arm_cmpdi_insn): Likewise. (subsi3_carryin): Use arm_borrow_operation. (subsi3_carryin_const): Likewise. (subsi3_carryin_const0): Likewise. (subsi3_carryin_compare): Likewise. (subsi3_carryin_compare_const): Likewise. (subsi3_carryin_compare_const0): Likewise. (subsi3_carryin_shift): Likewise. (rsbsi3_carryin_shift): Likewise. (negsi2_carryin_compare): Likewise. gcc/testsuite: 2020-03-05 Jakub Jelinek <ja...@redhat.com> Backport from master PR target/90311 * gcc.c-torture/execute/pr90311.c: New test.