public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 1/2] rs6000: Another PIC LRA fix
@ 2015-10-31 17:40 Segher Boessenkool
  2015-10-31 17:49 ` [PATCH 2/2] rs6000: Rewrite rs6000_reg_live_or_pic_offset_p Segher Boessenkool
  2015-10-31 17:50 ` [PATCH 1/2] rs6000: Another PIC LRA fix David Edelsohn
  0 siblings, 2 replies; 4+ messages in thread
From: Segher Boessenkool @ 2015-10-31 17:40 UTC (permalink / raw)
  To: gcc-patches; +Cc: dje.gcc, Segher Boessenkool

This one for TARGET_TOC && TARGET_MINIMAL_TOC.  Without it, r30 is not
saved in the prologue for functions that do not use r30, but the register
is set later in the prologue anyhow.  This made all java tests fail.

Tested on powerpc64-linux, --enable-languages=all,ada,go,obj-c++ and test
variants {-m32/-mno-lra,-m32/-mlra,-m32/-mpowerpc64,-m64/-mno-lra,-m64/-mlra};
and on powerpc64le-linux, everything default.  Both also with bootstrapping
with LRA defaulted on.

Okay for trunk?


Segher


2015-10-31  Segher Boessenkool  <segher@kernel.crashing.org>

	* config/rs6000/rs6000.c (rs6000_reg_live_or_pic_offset_p): Use the
	same condition for testing whether RS6000_PIC_OFFSET_TABLE_REGNUM is
	live as for using it elsewhere, for TARGET_MINIMAL_TOC.

---
 gcc/config/rs6000/rs6000.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 9610625..1c55244 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -21793,7 +21793,9 @@ rs6000_reg_live_or_pic_offset_p (int reg)
           || (reg == RS6000_PIC_OFFSET_TABLE_REGNUM
 	      && !TARGET_SINGLE_PIC_BASE
               && ((DEFAULT_ABI == ABI_V4 && flag_pic != 0)
-                  || (DEFAULT_ABI == ABI_DARWIN && flag_pic))));
+                  || (DEFAULT_ABI == ABI_DARWIN && flag_pic)
+		  || (TARGET_TOC && TARGET_MINIMAL_TOC
+		      && get_pool_size () != 0))));
 }
 
 /* Return the first fixed-point register that is required to be
-- 
1.9.3

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

* [PATCH 2/2] rs6000: Rewrite rs6000_reg_live_or_pic_offset_p
  2015-10-31 17:40 [PATCH 1/2] rs6000: Another PIC LRA fix Segher Boessenkool
@ 2015-10-31 17:49 ` Segher Boessenkool
  2015-10-31 17:56   ` David Edelsohn
  2015-10-31 17:50 ` [PATCH 1/2] rs6000: Another PIC LRA fix David Edelsohn
  1 sibling, 1 reply; 4+ messages in thread
From: Segher Boessenkool @ 2015-10-31 17:49 UTC (permalink / raw)
  To: gcc-patches; +Cc: dje.gcc, Segher Boessenkool

This function is quite a puzzle; untangle it.  No functional change.

Tested etc.; okay for trunk?


Segher


2015-10-31  Segher Boessenkool  <segher@kernel.crashing.org>

	* config/rs6000/rs6000.c (rs6000_reg_live_or_pic_offset_p): Rewrite.

---
 gcc/config/rs6000/rs6000.c | 35 ++++++++++++++++++++---------------
 1 file changed, 20 insertions(+), 15 deletions(-)

diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 1c55244..37abf88 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -21780,22 +21780,27 @@ save_reg_p (int r)
 static bool
 rs6000_reg_live_or_pic_offset_p (int reg)
 {
-  /* If the function calls eh_return, claim used all the registers that would
-     be checked for liveness otherwise.  This is required for the PIC offset
-     register with -mminimal-toc on AIX, as it is advertised as "fixed" for
-     register allocation purposes in this case.  */
+  /* We need to mark the PIC offset register live for the same conditions
+     as it is set up, or otherwise it won't be saved before we clobber it.  */
 
-  return (((crtl->calls_eh_return || df_regs_ever_live_p (reg))
-           && (!call_used_regs[reg]
-               || (reg == RS6000_PIC_OFFSET_TABLE_REGNUM
-		   && !TARGET_SINGLE_PIC_BASE
-                   && TARGET_TOC && TARGET_MINIMAL_TOC)))
-          || (reg == RS6000_PIC_OFFSET_TABLE_REGNUM
-	      && !TARGET_SINGLE_PIC_BASE
-              && ((DEFAULT_ABI == ABI_V4 && flag_pic != 0)
-                  || (DEFAULT_ABI == ABI_DARWIN && flag_pic)
-		  || (TARGET_TOC && TARGET_MINIMAL_TOC
-		      && get_pool_size () != 0))));
+  if (reg == RS6000_PIC_OFFSET_TABLE_REGNUM && !TARGET_SINGLE_PIC_BASE)
+    {
+      if (TARGET_TOC && TARGET_MINIMAL_TOC
+	  && (crtl->calls_eh_return
+	      || df_regs_ever_live_p (reg)
+	      || get_pool_size ()))
+	return true;
+
+      if ((DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_DARWIN)
+	  && flag_pic)
+	return true;
+    }
+
+  /* If the function calls eh_return, claim used all the registers that would
+     be checked for liveness otherwise.  */
+
+  return ((crtl->calls_eh_return || df_regs_ever_live_p (reg))
+	  && !call_used_regs[reg]);
 }
 
 /* Return the first fixed-point register that is required to be
-- 
1.9.3

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

* Re: [PATCH 1/2] rs6000: Another PIC LRA fix
  2015-10-31 17:40 [PATCH 1/2] rs6000: Another PIC LRA fix Segher Boessenkool
  2015-10-31 17:49 ` [PATCH 2/2] rs6000: Rewrite rs6000_reg_live_or_pic_offset_p Segher Boessenkool
@ 2015-10-31 17:50 ` David Edelsohn
  1 sibling, 0 replies; 4+ messages in thread
From: David Edelsohn @ 2015-10-31 17:50 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: GCC Patches

On Sat, Oct 31, 2015 at 1:39 PM, Segher Boessenkool
<segher@kernel.crashing.org> wrote:
> This one for TARGET_TOC && TARGET_MINIMAL_TOC.  Without it, r30 is not
> saved in the prologue for functions that do not use r30, but the register
> is set later in the prologue anyhow.  This made all java tests fail.
>
> Tested on powerpc64-linux, --enable-languages=all,ada,go,obj-c++ and test
> variants {-m32/-mno-lra,-m32/-mlra,-m32/-mpowerpc64,-m64/-mno-lra,-m64/-mlra};
> and on powerpc64le-linux, everything default.  Both also with bootstrapping
> with LRA defaulted on.
>
> Okay for trunk?
>
>
> Segher
>
>
> 2015-10-31  Segher Boessenkool  <segher@kernel.crashing.org>
>
>         * config/rs6000/rs6000.c (rs6000_reg_live_or_pic_offset_p): Use the
>         same condition for testing whether RS6000_PIC_OFFSET_TABLE_REGNUM is
>         live as for using it elsewhere, for TARGET_MINIMAL_TOC.

Okay.

Thanks, David

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

* Re: [PATCH 2/2] rs6000: Rewrite rs6000_reg_live_or_pic_offset_p
  2015-10-31 17:49 ` [PATCH 2/2] rs6000: Rewrite rs6000_reg_live_or_pic_offset_p Segher Boessenkool
@ 2015-10-31 17:56   ` David Edelsohn
  0 siblings, 0 replies; 4+ messages in thread
From: David Edelsohn @ 2015-10-31 17:56 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: GCC Patches

On Sat, Oct 31, 2015 at 1:39 PM, Segher Boessenkool
<segher@kernel.crashing.org> wrote:
> This function is quite a puzzle; untangle it.  No functional change.
>
> Tested etc.; okay for trunk?
>
>
> Segher
>
>
> 2015-10-31  Segher Boessenkool  <segher@kernel.crashing.org>
>
>         * config/rs6000/rs6000.c (rs6000_reg_live_or_pic_offset_p): Rewrite.

Okay.

Thanks, David

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

end of thread, other threads:[~2015-10-31 17:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-31 17:40 [PATCH 1/2] rs6000: Another PIC LRA fix Segher Boessenkool
2015-10-31 17:49 ` [PATCH 2/2] rs6000: Rewrite rs6000_reg_live_or_pic_offset_p Segher Boessenkool
2015-10-31 17:56   ` David Edelsohn
2015-10-31 17:50 ` [PATCH 1/2] rs6000: Another PIC LRA fix David Edelsohn

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