]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
This patch adds a combine pattern for "CA minus one". The SImode "CA minus one" can...
authorHaochen Gui <guihaoc@gcc.gnu.org>
Wed, 11 May 2022 01:19:52 +0000 (09:19 +0800)
committerHaochen Gui <guihaoc@gcc.gnu.org>
Wed, 18 May 2022 05:21:29 +0000 (13:21 +0800)
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.

gcc/config/rs6000/rs6000.md
gcc/testsuite/gcc.target/powerpc/pr95737.c [new file with mode: 0644]

index bf85baa537024815d308a665e51c6cb617c8f755..3eca448a262208e47039e8d4dcd7469b0c7fe61c 100644 (file)
   "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 "@neg<mode>2"
   [(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 (file)
index 0000000..324694f
--- /dev/null
@@ -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);
+}