public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, rs6000] Fix PR78458, LRA ICE building libgcc for powerpc-linux-gnuspe e500v2
@ 2016-11-23 18:13 Peter Bergner
  2016-11-23 18:33 ` Segher Boessenkool
  2016-11-23 18:44 ` Joseph Myers
  0 siblings, 2 replies; 4+ messages in thread
From: Peter Bergner @ 2016-11-23 18:13 UTC (permalink / raw)
  To: GCC Patches; +Cc: Segher Boessenkool, David Edelsohn, Joseph Myers

PR78458 shows a problem in LRA spilling caused by HARD_REGNO_CALLER_SAVE_MODE()
returning a bogus mode (IFmode).  This patch solves the problem by just
returning MODE if MODE is wide enough to save and restore NREGS itself.

This patch passed bootstrap and regtesting on powerpc64le-linux as well
as on powerpc64-linux (testsuite run in both 32-bit and 64-bit modes).
Joseph has confirmed it fixes his ICE and gets him further in his toolchain
build (now ICEs in glibc), which he has separate patches for.

Joseph, I copied the testsuite preamble from another SPE test case.
Does it look correct to you to catch the bug?

Assuming the test case is correct, is this ok for trunk?

Peter


gcc/
	PR target/78458
	* config/rs6000/rs6000.h (HARD_REGNO_CALLER_SAVE_MODE): Return MODE
	if it is at least NREGS wide.

gcc/testsuite/
	PR target/78458
	* gcc.target/powerpc/pr78458.c: New.

Index: gcc/config/rs6000/rs6000.h
===================================================================
--- gcc/config/rs6000/rs6000.h	(revision 241976)
+++ gcc/config/rs6000/rs6000.h	(working copy)
@@ -1279,9 +1279,11 @@ enum data_align { align_abi, align_opt,
    enough space to account for vectors in FP regs.  However, TFmode/TDmode
    should not use VSX instructions to do a caller save. */
 #define HARD_REGNO_CALLER_SAVE_MODE(REGNO, NREGS, MODE)			\
-  (TARGET_VSX								\
-   && ((MODE) == VOIDmode || ALTIVEC_OR_VSX_VECTOR_MODE (MODE))		\
-   && FP_REGNO_P (REGNO)						\
+  (NREGS <= rs6000_hard_regno_nregs[MODE][REGNO]			\
+   ? MODE								\
+   : TARGET_VSX								\
+     && ((MODE) == VOIDmode || ALTIVEC_OR_VSX_VECTOR_MODE (MODE))	\
+     && FP_REGNO_P (REGNO)						\
    ? V2DFmode								\
    : TARGET_E500_DOUBLE && (MODE) == SImode				\
    ? SImode								\
Index: gcc/testsuite/gcc.target/powerpc/pr78458.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/pr78458.c	(revision 0)
+++ gcc/testsuite/gcc.target/powerpc/pr78458.c	(working copy)
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-mcpu=8548 -mspe -mabi=spe -mlra" } */
+/* { dg-skip-if "not an SPE target" { ! powerpc_spe_nocache } { "*" } { "" } } */
+
+extern void bar (void);
+long double
+pr78458 (long double p1)
+{
+  bar ();
+  asm volatile ("# clobbers" :::
+		"r14", "r15", "r16", "r17", "r18", "r19",
+		"r20", "r21", "r22", "r23", "r24", "r25",
+		"r26", "r27", "r28", "r29", "r30", "r31");
+  return p1;
+}

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

* Re: [PATCH, rs6000] Fix PR78458, LRA ICE building libgcc for powerpc-linux-gnuspe e500v2
  2016-11-23 18:13 [PATCH, rs6000] Fix PR78458, LRA ICE building libgcc for powerpc-linux-gnuspe e500v2 Peter Bergner
@ 2016-11-23 18:33 ` Segher Boessenkool
  2016-11-24  2:22   ` Peter Bergner
  2016-11-23 18:44 ` Joseph Myers
  1 sibling, 1 reply; 4+ messages in thread
From: Segher Boessenkool @ 2016-11-23 18:33 UTC (permalink / raw)
  To: Peter Bergner; +Cc: GCC Patches, David Edelsohn, Joseph Myers

On Wed, Nov 23, 2016 at 12:13:23PM -0600, Peter Bergner wrote:
> --- gcc/config/rs6000/rs6000.h	(revision 241976)
> +++ gcc/config/rs6000/rs6000.h	(working copy)
> @@ -1279,9 +1279,11 @@ enum data_align { align_abi, align_opt,
>     enough space to account for vectors in FP regs.  However, TFmode/TDmode
>     should not use VSX instructions to do a caller save. */
>  #define HARD_REGNO_CALLER_SAVE_MODE(REGNO, NREGS, MODE)			\
> -  (TARGET_VSX								\
> -   && ((MODE) == VOIDmode || ALTIVEC_OR_VSX_VECTOR_MODE (MODE))		\
> -   && FP_REGNO_P (REGNO)						\
> +  (NREGS <= rs6000_hard_regno_nregs[MODE][REGNO]			\
> +   ? MODE								\

Please put parens around NREGS and that last MODE.

> --- gcc/testsuite/gcc.target/powerpc/pr78458.c	(revision 0)
> +++ gcc/testsuite/gcc.target/powerpc/pr78458.c	(working copy)
> @@ -0,0 +1,15 @@
> +/* { dg-do compile } */
> +/* { dg-options "-mcpu=8548 -mspe -mabi=spe -mlra" } */
> +/* { dg-skip-if "not an SPE target" { ! powerpc_spe_nocache } { "*" } { "" } } */

You don't need the default arguments, FWIW.

Okay for trunk.  Thanks!


Segher

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

* Re: [PATCH, rs6000] Fix PR78458, LRA ICE building libgcc for powerpc-linux-gnuspe e500v2
  2016-11-23 18:13 [PATCH, rs6000] Fix PR78458, LRA ICE building libgcc for powerpc-linux-gnuspe e500v2 Peter Bergner
  2016-11-23 18:33 ` Segher Boessenkool
@ 2016-11-23 18:44 ` Joseph Myers
  1 sibling, 0 replies; 4+ messages in thread
From: Joseph Myers @ 2016-11-23 18:44 UTC (permalink / raw)
  To: Peter Bergner; +Cc: GCC Patches, Segher Boessenkool, David Edelsohn

On Wed, 23 Nov 2016, Peter Bergner wrote:

> Joseph, I copied the testsuite preamble from another SPE test case.
> Does it look correct to you to catch the bug?

I think the preamble is fine.

I'm running execution testing with my two SPE patches and will submit them 
if results seem reasonable (since the previous state was the build 
failing, I don't have baseline results for unmodified GCC to compare 
with).

-- 
Joseph S. Myers
joseph@codesourcery.com

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

* Re: [PATCH, rs6000] Fix PR78458, LRA ICE building libgcc for powerpc-linux-gnuspe e500v2
  2016-11-23 18:33 ` Segher Boessenkool
@ 2016-11-24  2:22   ` Peter Bergner
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Bergner @ 2016-11-24  2:22 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: GCC Patches, David Edelsohn, Joseph Myers

On 11/23/16 12:33 PM, Segher Boessenkool wrote:
> On Wed, Nov 23, 2016 at 12:13:23PM -0600, Peter Bergner wrote:
> Please put parens around NREGS and that last MODE.
[snip]
> You don't need the default arguments, FWIW.
>
> Okay for trunk.  Thanks!

Ok, commited as revision 242818 with your suggestions.  Thanks.

Peter



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

end of thread, other threads:[~2016-11-24  2:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-23 18:13 [PATCH, rs6000] Fix PR78458, LRA ICE building libgcc for powerpc-linux-gnuspe e500v2 Peter Bergner
2016-11-23 18:33 ` Segher Boessenkool
2016-11-24  2:22   ` Peter Bergner
2016-11-23 18:44 ` Joseph Myers

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