]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
rs6000: Enable block compare expand on P9 with m32 and mpowerpc64
authorHaochen Gui <guihaoc@gcc.gnu.org>
Thu, 25 Jan 2024 06:54:42 +0000 (14:54 +0800)
committerHaochen Gui <guihaoc@gcc.gnu.org>
Thu, 25 Jan 2024 06:57:39 +0000 (14:57 +0800)
gcc/
* config/rs6000/rs6000-string.cc (expand_block_compare): Enable
P9 with m32 and mpowerpc64.

gcc/testsuite/
* gcc.target/powerpc/block-cmp-1.c: Exclude m32 and mpowerpc64.
* gcc.target/powerpc/block-cmp-4.c: Likewise.
* gcc.target/powerpc/block-cmp-8.c: New.

gcc/config/rs6000/rs6000-string.cc
gcc/testsuite/gcc.target/powerpc/block-cmp-1.c
gcc/testsuite/gcc.target/powerpc/block-cmp-4.c
gcc/testsuite/gcc.target/powerpc/block-cmp-8.c [new file with mode: 0644]

index f707bb2727eea5ee8465bf9b815efecd81e905dd..917f5572a6d344bd7a8ce8aa15e5e9ec2ec1709b 100644 (file)
@@ -1950,11 +1950,13 @@ expand_block_compare (rtx operands[])
   /* TARGET_POPCNTD is already guarded at expand cmpmemsi.  */
   gcc_assert (TARGET_POPCNTD);
 
-  /* This case is complicated to handle because the subtract
-     with carry instructions do not generate the 64-bit
-     carry and so we must emit code to calculate it ourselves.
-     We choose not to implement this yet.  */
-  if (TARGET_32BIT && TARGET_POWERPC64)
+  /* For P8, this case is complicated to handle because the subtract
+     with carry instructions do not generate the 64-bit carry and so
+     we must emit code to calculate it ourselves.  We skip it on P8
+     but setb works well on P9.  */
+  if (TARGET_32BIT
+      && TARGET_POWERPC64
+      && !TARGET_P9_MISC)
     return false;
 
   /* Allow this param to shut off all expansion.  */
index bcf0cb2ab4fd33e2cdc2c0a297e78801942d2035..cd076cf1dce4aed073fe12d60895924f001bcff0 100644 (file)
@@ -1,5 +1,6 @@
 /* { dg-do compile } */
 /* { dg-options "-O2 -mdejagnu-cpu=power8 -mno-vsx" } */
+/* { dg-skip-if "" { has_arch_ppc64 && ilp32 } } */
 /* { dg-final { scan-assembler-not {\mb[l]? memcmp\M} } }  */
 
 /* Test that it still can do expand for memcmpsi instead of calling library
index c86febae68a8a20ac8a4f5eb4bbb9b1bda6ae4f9..ee9a015adae3fc5b876626616765eaca63868753 100644 (file)
@@ -1,6 +1,7 @@
 /* { dg-do compile { target be } } */
 /* { dg-options "-O2 -mdejagnu-cpu=power7" } */
-/* { dg-final { scan-assembler-not {\mb[l]? memcmp\M} } }  */
+/* { dg-skip-if "" { has_arch_ppc64 && ilp32 } } */
+/* { dg-final { scan-assembler-not {\mb[l]? memcmp\M} } } */
 
 /* Test that it does expand for memcmpsi instead of calling library on
    P7 BE when length is less than 32 bytes.  */
diff --git a/gcc/testsuite/gcc.target/powerpc/block-cmp-8.c b/gcc/testsuite/gcc.target/powerpc/block-cmp-8.c
new file mode 100644 (file)
index 0000000..22a48c8
--- /dev/null
@@ -0,0 +1,8 @@
+/* { dg-do run { target ilp32 } } */
+/* { dg-options "-O2 -mpowerpc64" } */
+/* { dg-require-effective-target has_arch_ppc64 } */
+/* { dg-timeout-factor 2 } */
+
+/* Verify memcmp on m32 mpowerpc64 */
+
+#include "../../gcc.dg/memcmp-1.c"