public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Pat Haugen <pthaugen@linux.ibm.com>
To: GCC Patches <gcc-patches@gcc.gnu.org>
Cc: Segher Boessenkool <segher@kernel.crashing.org>,
	Bill Schmidt <wschmidt@linux.vnet.ibm.com>,
	David Edelsohn <dje.gcc@gmail.com>
Subject: [PATCH] rs6000: Disable -fcaller-saves by default
Date: Thu, 23 Jul 2020 14:25:30 -0500	[thread overview]
Message-ID: <8cc18935-a9aa-513f-eef2-154130b70a3b@linux.ibm.com> (raw)

Disable -fcaller-saves by default.

This patch turns off -fcaller-saves by default so that IRA doesn't try
to use volatile regs for pseudos that are live across a call, which
would then require LRA to save/restore the reg around the call.

Bootstrap/regtest on powerpc64le with no new regressions. Also ran a
CPU2017 benchmark comparison with no major differences (a few minor
improvements and one minor degradation). Ok for trunk?

-Pat


2020-07-23  Pat Haugen  <pthaugen@linux.ibm.com>

gcc/
	* common/config/rs6000/rs6000-common.c
	(rs6000_option_optimization_table): Turn off -fcaller-saves.

gcc/testsuite/
	* gcc.target/powerpc/caller-saves.c: New.



diff --git a/gcc/common/config/rs6000/rs6000-common.c
b/gcc/common/config/rs6000/rs6000-common.c
index ee37b9dc90b..6d68834aed2 100644
--- a/gcc/common/config/rs6000/rs6000-common.c
+++ b/gcc/common/config/rs6000/rs6000-common.c
@@ -43,8 +43,13 @@ static const struct default_options
rs6000_option_optimization_table[] =
        on rs6000, turn it off by default.  */
     { OPT_LEVELS_ALL, OPT_frename_registers, NULL, 0 },

+    /* Don't allow IRA to use volatile regs across function calls.  */
+    { OPT_LEVELS_ALL, OPT_fcaller_saves, NULL, 0 },
+
     /* Double growth factor to counter reduced min jump length.  */
     { OPT_LEVELS_ALL, OPT__param_max_grow_copy_bb_insns_, NULL, 16 },
+
+    /* Following marks the end of the list and needs to remain last.  */
     { OPT_LEVELS_NONE, 0, NULL, 0 }
   };

diff --git a/gcc/testsuite/gcc.target/powerpc/caller-saves.c
b/gcc/testsuite/gcc.target/powerpc/caller-saves.c
new file mode 100644
index 00000000000..846356f16f7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/caller-saves.c
@@ -0,0 +1,9 @@
+/* { dg-do compile */
+/* { dg-options "-O2 -fverbose-asm" } */
+
+void
+foo ()
+{
+}
+
+/* { dg-final { scan-assembler-not "fcaller-saves" } } */

             reply	other threads:[~2020-07-23 19:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-23 19:25 Pat Haugen [this message]
2020-07-23 19:42 ` Jeff Law
2020-07-23 20:19   ` Segher Boessenkool
2020-07-23 20:29     ` Jeff Law
2020-07-23 20:43       ` Segher Boessenkool
2020-08-10 16:11       ` Peter Bergner
2020-08-25 20:35         ` Jeff Law
2020-08-26 20:58           ` Segher Boessenkool
2020-08-26 21:10             ` Jeff Law

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=8cc18935-a9aa-513f-eef2-154130b70a3b@linux.ibm.com \
    --to=pthaugen@linux.ibm.com \
    --cc=dje.gcc@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=segher@kernel.crashing.org \
    --cc=wschmidt@linux.vnet.ibm.com \
    /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).