public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: HaoChen Gui <guihaoc@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r13-1020] This patch replaces shift and ior insns with one rotate and mask insn for the split patterns which a
Date: Thu,  9 Jun 2022 05:32:16 +0000 (GMT)	[thread overview]
Message-ID: <20220609053216.DBC07385AE47@sourceware.org> (raw)

https://gcc.gnu.org/g:2fc6e3d55f6080da3a43243f595bd1266595127d

commit r13-1020-g2fc6e3d55f6080da3a43243f595bd1266595127d
Author: Haochen Gui <guihaoc@gcc.gnu.org>
Date:   Thu Jun 9 13:24:15 2022 +0800

    This patch replaces shift and ior insns with one rotate and mask insn for the split patterns which are for DI byte swap on Power6.
    
    gcc/
            * config/rs6000/rs6000.md (define_split for bswapdi load): Merge shift
            and ior insns to one rotate and mask insn.
            (define_split for bswapdi register): Likewise.
    
    gcc/testsuite/
            * gcc.target/powerpc/pr93453-1.c: New.

Diff:
---
 gcc/config/rs6000/rs6000.md                  | 12 ++++++------
 gcc/testsuite/gcc.target/powerpc/pr93453-1.c | 14 ++++++++++++++
 2 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index 3eca448a262..1c125f07e89 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -2841,8 +2841,8 @@
       emit_insn (gen_bswapsi2 (dest_32, word2));
     }
 
-  emit_insn (gen_ashldi3 (op3, op3, GEN_INT (32)));
-  emit_insn (gen_iordi3 (dest, dest, op3));
+  emit_insn (gen_rotldi3_insert_3 (dest, op3, GEN_INT (32), dest,
+				   GEN_INT (0xffffffff)));
   DONE;
 })
 
@@ -2927,10 +2927,10 @@
   rtx op3_si  = simplify_gen_subreg (SImode, op3, DImode, lo_off);
 
   emit_insn (gen_lshrdi3 (op2, src, GEN_INT (32)));
-  emit_insn (gen_bswapsi2 (dest_si, src_si));
-  emit_insn (gen_bswapsi2 (op3_si, op2_si));
-  emit_insn (gen_ashldi3 (dest, dest, GEN_INT (32)));
-  emit_insn (gen_iordi3 (dest, dest, op3));
+  emit_insn (gen_bswapsi2 (op3_si, src_si));
+  emit_insn (gen_bswapsi2 (dest_si, op2_si));
+  emit_insn (gen_rotldi3_insert_3 (dest, op3, GEN_INT (32), dest,
+				   GEN_INT (0xffffffff)));
   DONE;
 })
 
diff --git a/gcc/testsuite/gcc.target/powerpc/pr93453-1.c b/gcc/testsuite/gcc.target/powerpc/pr93453-1.c
new file mode 100644
index 00000000000..b396458ba12
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr93453-1.c
@@ -0,0 +1,14 @@
+/* { dg-do compile { target has_arch_ppc64 } } */
+/* { dg-options "-mdejagnu-cpu=power6 -O2" } */
+
+unsigned long load_byte_reverse (unsigned long *in)
+{
+   return __builtin_bswap64 (*in);
+}
+
+unsigned long byte_reverse (unsigned long in)
+{
+   return __builtin_bswap64 (in);
+}
+
+/* { dg-final { scan-assembler-times {\mrldimi\M} 2 } } */


                 reply	other threads:[~2022-06-09  5:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220609053216.DBC07385AE47@sourceware.org \
    --to=guihaoc@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).