public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [SPARC] Fix another thinko
@ 2011-06-05 23:22 Eric Botcazou
  2011-06-09 20:29 ` Eric Botcazou
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Botcazou @ 2011-06-05 23:22 UTC (permalink / raw)
  To: gcc-patches

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

This time introduced when -fno-delayed-branch was fixed in the back-end.
Modifying %fp before a 'restore' instruction is a no-no because it is the base 
address used to reload spilled registers when the window stack is empty.  It 
only affects __builtin_eh_return and presumably went unnoticed.

Tested on SPARC/Solaris 8, applied on the mainline and 4.6/4.5/4.4 branches.


2011-06-05  Eric Botcazou  <ebotcazou@adacore.com>

	* config/sparc/sparc.c (output_return): Fix thinko in the output of an
	EH return when delayed branches are disabled.


-- 
Eric Botcazou

[-- Attachment #2: p.diff --]
[-- Type: text/x-diff, Size: 1091 bytes --]

Index: config/sparc/sparc.c
===================================================================
--- config/sparc/sparc.c	(revision 174637)
+++ config/sparc/sparc.c	(working copy)
@@ -4752,18 +4752,20 @@ output_return (rtx insn)
 	     machinery occupies the delay slot.  */
 	  gcc_assert (! final_sequence);
 
-	  if (! flag_delayed_branch)
-	    fputs ("\tadd\t%fp, %g1, %fp\n", asm_out_file);
+          if (flag_delayed_branch)
+	    {
+	      if (TARGET_V9)
+		fputs ("\treturn\t%i7+8\n", asm_out_file);
+	      else
+		fputs ("\trestore\n\tjmp\t%o7+8\n", asm_out_file);
 
-	  if (TARGET_V9)
-	    fputs ("\treturn\t%i7+8\n", asm_out_file);
+	      fputs ("\t add\t%sp, %g1, %sp\n", asm_out_file);
+	    }
 	  else
-	    fputs ("\trestore\n\tjmp\t%o7+8\n", asm_out_file);
-
-	  if (flag_delayed_branch)
-	    fputs ("\t add\t%sp, %g1, %sp\n", asm_out_file);
-	  else
-	    fputs ("\t nop\n", asm_out_file);
+	    {
+	      fputs ("\trestore\n\tadd\t%sp, %g1, %sp\n", asm_out_file);
+	      fputs ("\tjmp\t%o7+8\n\t nop\n", asm_out_file);
+	    }
 	}
       else if (final_sequence)
 	{

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

* Re: [SPARC] Fix another thinko
  2011-06-05 23:22 [SPARC] Fix another thinko Eric Botcazou
@ 2011-06-09 20:29 ` Eric Botcazou
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Botcazou @ 2011-06-09 20:29 UTC (permalink / raw)
  To: gcc-patches

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

> 2011-06-05  Eric Botcazou  <ebotcazou@adacore.com>
>
> 	* config/sparc/sparc.c (output_return): Fix thinko in the output of an
> 	EH return when delayed branches are disabled.

Of course the length attribute needs to be adjusted as well.

Tested on SPARC/Solaris 8, applied on the mainline and 4.6/4.5/4.4 branches.


2011-06-09  Eric Botcazou  <ebotcazou@adacore.com>

	* config/sparc/sparc.md (return_internal): Adjust 'length' attribute.


-- 
Eric Botcazou

[-- Attachment #2: p.diff --]
[-- Type: text/x-diff, Size: 579 bytes --]

Index: config/sparc/sparc.md
===================================================================
--- config/sparc/sparc.md	(revision 174014)
+++ config/sparc/sparc.md	(working copy)
@@ -6322,9 +6322,7 @@ (define_insn "*return_internal"
 			       (if_then_else (eq_attr "isa" "v9")
 					     (const_int 2)
 					     (const_int 3))
-			       (if_then_else (eq_attr "isa" "v9")
-					     (const_int 3)
-					     (const_int 4)))
+			       (const_int 4))
 	       (eq_attr "empty_delay_slot" "true")
 		 (if_then_else (eq_attr "delayed_branch" "true")
 			       (const_int 2)

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

end of thread, other threads:[~2011-06-09 19:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-05 23:22 [SPARC] Fix another thinko Eric Botcazou
2011-06-09 20:29 ` Eric Botcazou

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