Hi, Roger! Thanks very much for investigating this issue and developing a patch to leverage this feature of the PowerPC architecture.
2021-12-03 Roger Sayle <ro...@nextmovesoftware.com> gcc/ChangeLog PR target/43892 * config/rs6000/rs6000.md (*add<mode>3_carry_in_0_2): New define_insn to recognize commutative form of add<mode>3_carry_in_0. (*add<mode>3_geu, *add<mode>3_leu, *subf<mode>3_carry_in_xx_subf, *add<mode>3_carry_in_addc): New define_insn_and_split patterns. It might be easier to read if each of the define_insn_and_split ChangeLog entries were on a separate line and the latter ones said "Same" or "Likewise", but up to you. Segher can be more pedantic. gcc/testsuite/ChangeLog PR target/43892 * gcc.target/powerpc/addcmp.c: New test case. * gcc.target/powerpc/pr43892.c: New test case. This patch is okay. Thanks, David