public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-8411] rs6000: Enable block compare expand on P9 with m32 and mpowerpc64
@ 2024-01-25  6:58 HaoChen Gui
  0 siblings, 0 replies; only message in thread
From: HaoChen Gui @ 2024-01-25  6:58 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:464de9c283f7f4717280c515a192e479d7a840a3

commit r14-8411-g464de9c283f7f4717280c515a192e479d7a840a3
Author: Haochen Gui <guihaoc@gcc.gnu.org>
Date:   Thu Jan 25 14:54:42 2024 +0800

    rs6000: Enable block compare expand on P9 with m32 and mpowerpc64
    
    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.

Diff:
---
 gcc/config/rs6000/rs6000-string.cc             | 12 +++++++-----
 gcc/testsuite/gcc.target/powerpc/block-cmp-1.c |  1 +
 gcc/testsuite/gcc.target/powerpc/block-cmp-4.c |  3 ++-
 gcc/testsuite/gcc.target/powerpc/block-cmp-8.c |  8 ++++++++
 4 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/gcc/config/rs6000/rs6000-string.cc b/gcc/config/rs6000/rs6000-string.cc
index f707bb2727e..917f5572a6d 100644
--- a/gcc/config/rs6000/rs6000-string.cc
+++ b/gcc/config/rs6000/rs6000-string.cc
@@ -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.  */
diff --git a/gcc/testsuite/gcc.target/powerpc/block-cmp-1.c b/gcc/testsuite/gcc.target/powerpc/block-cmp-1.c
index bcf0cb2ab4f..cd076cf1dce 100644
--- a/gcc/testsuite/gcc.target/powerpc/block-cmp-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/block-cmp-1.c
@@ -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
diff --git a/gcc/testsuite/gcc.target/powerpc/block-cmp-4.c b/gcc/testsuite/gcc.target/powerpc/block-cmp-4.c
index c86febae68a..ee9a015adae 100644
--- a/gcc/testsuite/gcc.target/powerpc/block-cmp-4.c
+++ b/gcc/testsuite/gcc.target/powerpc/block-cmp-4.c
@@ -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
index 00000000000..22a48c8fadf
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/block-cmp-8.c
@@ -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"

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-01-25  6:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-25  6:58 [gcc r14-8411] rs6000: Enable block compare expand on P9 with m32 and mpowerpc64 HaoChen Gui

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).