public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] S/390: Allow to use r1 to r4 as literal pool base.
@ 2015-12-11 16:50 Dominik Vogt
  2015-12-14 15:09 ` Ulrich Weigand
  0 siblings, 1 reply; 9+ messages in thread
From: Dominik Vogt @ 2015-12-11 16:50 UTC (permalink / raw)
  To: gcc-patches; +Cc: Andreas Krebbel, Ulrich Weigand

[-- Attachment #1: Type: text/plain, Size: 221 bytes --]

The attached patch enables using r1 to r4 as the literal pool base pointer if
one of them is unused in a leaf function.  The unpatched code supports only r5
and r13.

Ciao

Dominik ^_^  ^_^

-- 

Dominik Vogt
IBM Germany

[-- Attachment #2: 0001-ChangeLog --]
[-- Type: text/plain, Size: 132 bytes --]

gcc/ChangeLog

	* config/s390/s390.c (s390_init_frame_layout): Allow to use r1, ..., r4
	as base register for the literal pool too.

[-- Attachment #3: 0001-S-390-Allow-to-use-r1-to-r4-as-literal-pool-base-poi.patch --]
[-- Type: text/x-diff, Size: 1203 bytes --]

From f2838924c4c02eeabfdf7d8b79bd7a7ce8228e06 Mon Sep 17 00:00:00 2001
From: Dominik Vogt <vogt@linux.vnet.ibm.com>
Date: Fri, 11 Dec 2015 11:33:23 +0100
Subject: [PATCH] S/390: Allow to use r1 to r4 as literal pool base
 pointer.

The old code only considered r5 and r13.
---
 gcc/config/s390/s390.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index bc6f05b..b195ad3d 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -9543,10 +9543,17 @@ s390_init_frame_layout (void)
 	 as base register to avoid save/restore overhead.  */
       if (!base_used)
 	cfun->machine->base_reg = NULL_RTX;
-      else if (crtl->is_leaf && !df_regs_ever_live_p (5))
-	cfun->machine->base_reg = gen_rtx_REG (Pmode, 5);
       else
-	cfun->machine->base_reg = gen_rtx_REG (Pmode, BASE_REGNUM);
+	{
+	  int br = 0;
+
+	  if (crtl->is_leaf)
+	    /* Prefer r5 (most likely to be free).  */
+	    for (br = 5; br >= 1 && df_regs_ever_live_p (br); br--)
+	      ;
+	  cfun->machine->base_reg =
+	    gen_rtx_REG (Pmode, (br > 0) ? br : BASE_REGNUM);
+	}
 
       s390_register_info ();
       s390_frame_info ();
-- 
2.3.0


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-12-21 12:08 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-11 16:50 [PATCH] S/390: Allow to use r1 to r4 as literal pool base Dominik Vogt
2015-12-14 15:09 ` Ulrich Weigand
2015-12-16  6:50   ` Dominik Vogt
2015-12-16 12:51     ` Ulrich Weigand
2015-12-16 13:51       ` Dominik Vogt
2015-12-16 14:18         ` Ulrich Weigand
2015-12-18 10:21           ` [PATCH] S/390: Allow to use r2 " Dominik Vogt
2015-12-18 10:37             ` Andreas Krebbel
2015-12-21 12:08             ` Jakub Jelinek

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).