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 r12-1202] rs6000: Disable mode promotion for pseudos
Date: Fri,  4 Jun 2021 06:55:41 +0000 (GMT)	[thread overview]
Message-ID: <20210604065541.7F63F3857033@sourceware.org> (raw)

https://gcc.gnu.org/g:9080a3bf23297885fdc47221da37a71d6dec93c5

commit r12-1202-g9080a3bf23297885fdc47221da37a71d6dec93c5
Author: Haochen Gui <guihaoc@gcc.gnu.org>
Date:   Fri Jun 4 14:38:53 2021 +0800

    rs6000: Disable mode promotion for pseudos
    
    rs6000 has instructions that can do almost everything 32 bit
    at least as efficiently as corresponding 64 bit things. The
    mode promotion can be defered to when a wide mode is necessary.
    So it helps a lot not promote mode for pseudos. SPECint test
    shows that the overall performance improvement (by geomean) is
    more than 2% with this patch.
    
    testsuite/gcc.target/powerpc/not-promote-mode.c illustrates how
    the patch eliminates the redundant extensions and do further
    optimization by disabling mode promotion for pseduos.
    
    gcc/ChangeLog
    
            * config/rs6000/rs6000.h (PROMOTE_MODE): Remove.
    
    gcc/testsuite/ChangeLog:
    
            * gcc.target/powerpc/not-promote-mode.c: New.

Diff:
---
 gcc/config/rs6000/rs6000.h                          | 11 -----------
 gcc/testsuite/gcc.target/powerpc/not-promote-mode.c | 13 +++++++++++++
 2 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h
index 164d359b724..a5f7b1d78c2 100644
--- a/gcc/config/rs6000/rs6000.h
+++ b/gcc/config/rs6000/rs6000.h
@@ -667,17 +667,6 @@ extern unsigned char rs6000_recip_bits[];
 \f
 /* Target machine storage layout.  */
 
-/* Define this macro if it is advisable to hold scalars in registers
-   in a wider mode than that declared by the program.  In such cases,
-   the value is constrained to be within the bounds of the declared
-   type, but kept valid in the wider mode.  The signedness of the
-   extension may differ from that of the type.  */
-
-#define PROMOTE_MODE(MODE,UNSIGNEDP,TYPE)	\
-  if (GET_MODE_CLASS (MODE) == MODE_INT		\
-      && GET_MODE_SIZE (MODE) < (TARGET_32BIT ? 4 : 8)) \
-    (MODE) = TARGET_32BIT ? SImode : DImode;
-
 /* Define this if most significant bit is lowest numbered
    in instructions that operate on numbered bit-fields.  */
 /* That is true on RS/6000.  */
diff --git a/gcc/testsuite/gcc.target/powerpc/not-promote-mode.c b/gcc/testsuite/gcc.target/powerpc/not-promote-mode.c
new file mode 100644
index 00000000000..29af1f8323e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/not-promote-mode.c
@@ -0,0 +1,13 @@
+/* { dg-do compile { target { lp64 } } } */
+/* { dg-options "-O2" } */
+
+extern void bar ();
+
+void foo ()
+{
+  int i;
+  for (i = 0; i < 10000; i++)
+    bar ();
+}
+
+/* { dg-final { scan-assembler-not   {\mrldicl\M} } } */


                 reply	other threads:[~2021-06-04  6:55 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=20210604065541.7F63F3857033@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).