From: Haochen Gui Date: Wed, 11 May 2022 01:19:52 +0000 (+0800) Subject: This patch adds a combine pattern for "CA minus one". The SImode "CA minus one" can... X-Git-Tag: basepoints/gcc-14~6625 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a174dc1a7f2bf0a71475ff633b130a60c0c3ff4a;p=thirdparty%2Fgcc.git This patch adds a combine pattern for "CA minus one". The SImode "CA minus one" can be converted to DImode as CA only has two values (0 or 1). gcc/ PR target/95737 * config/rs6000/rs6000.md (*subfsi3_carry_in_xx_64): New. gcc/testsuite/ PR target/95737 * gcc.target/powerpc/pr95737.c: New. --- diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index bf85baa5370..3eca448a262 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -2344,6 +2344,19 @@ "subfe %0,%0,%0" [(set_attr "type" "add")]) +(define_insn_and_split "*subfsi3_carry_in_xx_64" + [(set (match_operand:DI 0 "gpc_reg_operand" "=r") + (sign_extend:DI (plus:SI (reg:SI CA_REGNO) + (const_int -1))))] + "TARGET_POWERPC64" + "#" + "&&1" + [(parallel [(set (match_dup 0) + (plus:DI (reg:DI CA_REGNO) + (const_int -1))) + (clobber (reg:DI CA_REGNO))])] + "" +) (define_insn "@neg2" [(set (match_operand:GPR 0 "gpc_reg_operand" "=r") diff --git a/gcc/testsuite/gcc.target/powerpc/pr95737.c b/gcc/testsuite/gcc.target/powerpc/pr95737.c new file mode 100644 index 00000000000..324694fa9a1 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr95737.c @@ -0,0 +1,11 @@ +/* PR target/95737 */ +/* { dg-do compile } */ +/* Disable isel for P9 and later. */ +/* { dg-options "-O2 -mno-isel" } */ +/* { dg-final { scan-assembler-not {\mextsw\M} } } */ + + +unsigned long negativeLessThan (unsigned long a, unsigned long b) +{ + return -(a < b); +}