public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch] move altivec register saving
@ 2007-05-07 21:28 Eric Christopher
  2007-05-07 21:44 ` David Edelsohn
  2007-05-14 18:33 ` Eric Christopher
  0 siblings, 2 replies; 9+ messages in thread
From: Eric Christopher @ 2007-05-07 21:28 UTC (permalink / raw)
  To: GCC Patches; +Cc: Andrew Pinski, Geoff Keating, dje

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

This patch moves the altivec register save/restores after/before the  
stack push/pop because the red zone doesn't take into account the  
altivec registers. This would cause issues with signal handling, etc.

The patch was tested on ppc-darwin, ppc64-darwin and ppc-linux.  
Andrew made some mention of a ppc64-linux failure, but I've been  
unable to get the preprocessed testcase so I'd like to commit now and  
I'll commit to fixing the failure if it happens or turns up in  
testing as soon as someone can get me a testcase.

OK for mainline?

-eric

* config/rs6000/rs6000.c (rs6000_emit_prologue): Move altivec  
register saving after stack push.
(rs6000_emit_epilogue): Move altivec register restore before stack push.


[-- Attachment #2: altivec.diff.txt --]
[-- Type: text/plain, Size: 7946 bytes --]

Index: rs6000.c
===================================================================
--- rs6000.c	(revision 124450)
+++ rs6000.c	(working copy)
@@ -14812,77 +14812,6 @@ rs6000_emit_prologue (void)
       sp_offset = info->total_size;
     }
 
-  /* Save AltiVec registers if needed.  */
-  if (!WORLD_SAVE_P (info) && TARGET_ALTIVEC_ABI && info->altivec_size != 0)
-    {
-      int i;
-
-      /* There should be a non inline version of this, for when we
-	 are saving lots of vector registers.  */
-      for (i = info->first_altivec_reg_save; i <= LAST_ALTIVEC_REGNO; ++i)
-	if (info->vrsave_mask & ALTIVEC_REG_BIT (i))
-	  {
-	    rtx areg, savereg, mem;
-	    int offset;
-
-	    offset = info->altivec_save_offset + sp_offset
-	      + 16 * (i - info->first_altivec_reg_save);
-
-	    savereg = gen_rtx_REG (V4SImode, i);
-
-	    areg = gen_rtx_REG (Pmode, 0);
-	    emit_move_insn (areg, GEN_INT (offset));
-
-	    /* AltiVec addressing mode is [reg+reg].  */
-	    mem = gen_frame_mem (V4SImode,
-				 gen_rtx_PLUS (Pmode, frame_reg_rtx, areg));
-
-	    insn = emit_move_insn (mem, savereg);
-
-	    rs6000_frame_related (insn, frame_ptr_rtx, info->total_size,
-				  areg, GEN_INT (offset));
-	  }
-    }
-
-  /* VRSAVE is a bit vector representing which AltiVec registers
-     are used.  The OS uses this to determine which vector
-     registers to save on a context switch.  We need to save
-     VRSAVE on the stack frame, add whatever AltiVec registers we
-     used in this function, and do the corresponding magic in the
-     epilogue.  */
-
-  if (TARGET_ALTIVEC && TARGET_ALTIVEC_VRSAVE
-      && info->vrsave_mask != 0)
-    {
-      rtx reg, mem, vrsave;
-      int offset;
-
-      /* Get VRSAVE onto a GPR.  Note that ABI_V4 might be using r12
-	 as frame_reg_rtx and r11 as the static chain pointer for
-	 nested functions.  */
-      reg = gen_rtx_REG (SImode, 0);
-      vrsave = gen_rtx_REG (SImode, VRSAVE_REGNO);
-      if (TARGET_MACHO)
-	emit_insn (gen_get_vrsave_internal (reg));
-      else
-	emit_insn (gen_rtx_SET (VOIDmode, reg, vrsave));
-
-      if (!WORLD_SAVE_P (info))
-	{
-          /* Save VRSAVE.  */
-          offset = info->vrsave_save_offset + sp_offset;
-          mem = gen_frame_mem (SImode,
-			       gen_rtx_PLUS (Pmode, frame_reg_rtx,
-					     GEN_INT (offset)));
-          insn = emit_move_insn (mem, reg);
-	}
-
-      /* Include the registers in the mask.  */
-      emit_insn (gen_iorsi3 (reg, reg, GEN_INT ((int) info->vrsave_mask)));
-
-      insn = emit_insn (generate_set_vrsave (reg, info, 0));
-    }
-
   /* If we use the link register, get it into r0.  */
   if (!WORLD_SAVE_P (info) && info->lr_save_p)
     {
@@ -15130,6 +15059,78 @@ rs6000_emit_prologue (void)
       RTX_FRAME_RELATED_P (insn) = 1;
     }
 
+  /* Save AltiVec registers if needed.  Save here because the red zone does
+     not include AltiVec registers.  */
+  if (!WORLD_SAVE_P (info) && TARGET_ALTIVEC_ABI && info->altivec_size != 0)
+    {
+      int i;
+
+      /* There should be a non inline version of this, for when we
+         are saving lots of vector registers.  */
+      for (i = info->first_altivec_reg_save; i <= LAST_ALTIVEC_REGNO; ++i)
+        if (info->vrsave_mask & ALTIVEC_REG_BIT (i))
+          {
+            rtx areg, savereg, mem;
+            int offset;
+
+            offset = info->altivec_save_offset + sp_offset
+              + 16 * (i - info->first_altivec_reg_save);
+
+            savereg = gen_rtx_REG (V4SImode, i);
+
+            areg = gen_rtx_REG (Pmode, 0);
+            emit_move_insn (areg, GEN_INT (offset));
+
+            /* AltiVec addressing mode is [reg+reg].  */
+            mem = gen_frame_mem (V4SImode,
+                                 gen_rtx_PLUS (Pmode, frame_reg_rtx, areg));
+
+            insn = emit_move_insn (mem, savereg);
+
+            rs6000_frame_related (insn, frame_ptr_rtx, info->total_size,
+                                  areg, GEN_INT (offset));
+          }
+    }
+
+  /* VRSAVE is a bit vector representing which AltiVec registers
+     are used.  The OS uses this to determine which vector
+     registers to save on a context switch.  We need to save
+     VRSAVE on the stack frame, add whatever AltiVec registers we
+     used in this function, and do the corresponding magic in the
+     epilogue.  */
+
+  if (TARGET_ALTIVEC && TARGET_ALTIVEC_VRSAVE
+      && info->vrsave_mask != 0)
+    {
+      rtx reg, mem, vrsave;
+      int offset;
+
+      /* Get VRSAVE onto a GPR.  Note that ABI_V4 might be using r12
+         as frame_reg_rtx and r11 as the static chain pointer for
+         nested functions.  */
+      reg = gen_rtx_REG (SImode, 0);
+      vrsave = gen_rtx_REG (SImode, VRSAVE_REGNO);
+      if (TARGET_MACHO)
+        emit_insn (gen_get_vrsave_internal (reg));
+      else
+        emit_insn (gen_rtx_SET (VOIDmode, reg, vrsave));
+
+      if (!WORLD_SAVE_P (info))
+        {
+          /* Save VRSAVE.  */
+          offset = info->vrsave_save_offset + sp_offset;
+          mem = gen_frame_mem (SImode,
+                               gen_rtx_PLUS (Pmode, frame_reg_rtx,
+                                             GEN_INT (offset)));
+          insn = emit_move_insn (mem, reg);
+        }
+
+      /* Include the registers in the mask.  */
+      emit_insn (gen_iorsi3 (reg, reg, GEN_INT ((int) info->vrsave_mask)));
+
+      insn = emit_insn (generate_set_vrsave (reg, info, 0));
+    }
+
   /* If we are using RS6000_PIC_OFFSET_TABLE_REGNUM, we need to set it up.  */
   if ((TARGET_TOC && TARGET_MINIMAL_TOC && get_pool_size () != 0)
       || (DEFAULT_ABI == ABI_V4
@@ -15387,33 +15388,10 @@ rs6000_emit_epilogue (int sibcall)
       return;
     }
 
-  /* If we have a frame pointer, a call to alloca,  or a large stack
-     frame, restore the old stack pointer using the backchain.  Otherwise,
-     we know what size to update it with.  */
-  if (use_backchain_to_restore_sp)
-    {
-      /* Under V.4, don't reset the stack pointer until after we're done
-	 loading the saved registers.  */
-      if (DEFAULT_ABI == ABI_V4)
-	frame_reg_rtx = gen_rtx_REG (Pmode, 11);
-
-      emit_move_insn (frame_reg_rtx,
-		      gen_rtx_MEM (Pmode, sp_reg_rtx));
-    }
-  else if (info->push_p)
-    {
-      if (DEFAULT_ABI == ABI_V4
-	  || current_function_calls_eh_return)
+  /* Set sp_offset based on the stack push from the prologue.  */
+  if ((DEFAULT_ABI == ABI_V4 || current_function_calls_eh_return)
+      && info->total_size < 32767)
 	sp_offset = info->total_size;
-      else
-	{
-	  emit_insn (TARGET_32BIT
-		     ? gen_addsi3 (sp_reg_rtx, sp_reg_rtx,
-				   GEN_INT (info->total_size))
-		     : gen_adddi3 (sp_reg_rtx, sp_reg_rtx,
-				   GEN_INT (info->total_size)));
-	}
-    }
 
   /* Restore AltiVec registers if needed.  */
   if (TARGET_ALTIVEC_ABI && info->altivec_size != 0)
@@ -15454,6 +15432,36 @@ rs6000_emit_epilogue (int sibcall)
       emit_insn (generate_set_vrsave (reg, info, 1));
     }
 
+  sp_offset = 0;
+
+  /* If we have a frame pointer, a call to alloca,  or a large stack
+     frame, restore the old stack pointer using the backchain.  Otherwise,
+     we know what size to update it with.  */
+  if (use_backchain_to_restore_sp)
+    {
+      /* Under V.4, don't reset the stack pointer until after we're done
+	 loading the saved registers.  */
+      if (DEFAULT_ABI == ABI_V4)
+	frame_reg_rtx = gen_rtx_REG (Pmode, 11);
+
+      emit_move_insn (frame_reg_rtx,
+		      gen_rtx_MEM (Pmode, sp_reg_rtx));
+    }
+  else if (info->push_p)
+    {
+      if (DEFAULT_ABI == ABI_V4
+	  || current_function_calls_eh_return)
+	sp_offset = info->total_size;
+      else
+	{
+	  emit_insn (TARGET_32BIT
+		     ? gen_addsi3 (sp_reg_rtx, sp_reg_rtx,
+				   GEN_INT (info->total_size))
+		     : gen_adddi3 (sp_reg_rtx, sp_reg_rtx,
+				   GEN_INT (info->total_size)));
+	}
+    }
+
   /* Get the old lr if we saved it.  */
   if (info->lr_save_p)
     {

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

* Re: [patch] move altivec register saving
  2007-05-07 21:28 [patch] move altivec register saving Eric Christopher
@ 2007-05-07 21:44 ` David Edelsohn
  2007-05-14 18:33 ` Eric Christopher
  1 sibling, 0 replies; 9+ messages in thread
From: David Edelsohn @ 2007-05-07 21:44 UTC (permalink / raw)
  To: Eric Christopher; +Cc: GCC Patches, Andrew Pinski, Geoff Keating

>>>>> Eric Christopher writes:

Eric> I've been  
Eric> unable to get the preprocessed testcase so I'd like to commit now and  
Eric> I'll commit to fixing the failure if it happens or turns up in  
Eric> testing as soon as someone can get me a testcase.

	No.  I sent you the pre-processed testcase over the weekend.

David

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

* Re: [patch] move altivec register saving
  2007-05-07 21:28 [patch] move altivec register saving Eric Christopher
  2007-05-07 21:44 ` David Edelsohn
@ 2007-05-14 18:33 ` Eric Christopher
  2007-05-16  8:30   ` Eric Christopher
  1 sibling, 1 reply; 9+ messages in thread
From: Eric Christopher @ 2007-05-14 18:33 UTC (permalink / raw)
  To: GCC Patches; +Cc: Andrew Pinski, Geoff Keating, dje

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

>
> The patch was tested on ppc-darwin, ppc64-darwin and ppc-linux.  
> Andrew made some mention of a ppc64-linux failure, but I've been  
> unable to get the preprocessed testcase so I'd like to commit now  
> and I'll commit to fixing the failure if it happens or turns up in  
> testing as soon as someone can get me a testcase.
>

And Geoff found the problem, so that's fixed here. He also OK'd the  
patch, but I'm going to give people a chance to test and give me  
feedback before I commit.

Tested on ppc-darwin and -m64.

-eric

  * config/rs6000/rs6000.c (rs6000_emit_prologue): Move altivec  
register saving after stack push.
  Set sp_offset whenever we push.
  (rs6000_emit_epilogue): Move altivec register restore before stack  
push.



[-- Attachment #2: altivec.diff.txt --]
[-- Type: text/plain, Size: 8382 bytes --]

Index: config/rs6000/rs6000.c
===================================================================
--- config/rs6000/rs6000.c	(revision 124559)
+++ config/rs6000/rs6000.c	(working copy)
@@ -14812,77 +14812,6 @@ rs6000_emit_prologue (void)
       sp_offset = info->total_size;
     }
 
-  /* Save AltiVec registers if needed.  */
-  if (!WORLD_SAVE_P (info) && TARGET_ALTIVEC_ABI && info->altivec_size != 0)
-    {
-      int i;
-
-      /* There should be a non inline version of this, for when we
-	 are saving lots of vector registers.  */
-      for (i = info->first_altivec_reg_save; i <= LAST_ALTIVEC_REGNO; ++i)
-	if (info->vrsave_mask & ALTIVEC_REG_BIT (i))
-	  {
-	    rtx areg, savereg, mem;
-	    int offset;
-
-	    offset = info->altivec_save_offset + sp_offset
-	      + 16 * (i - info->first_altivec_reg_save);
-
-	    savereg = gen_rtx_REG (V4SImode, i);
-
-	    areg = gen_rtx_REG (Pmode, 0);
-	    emit_move_insn (areg, GEN_INT (offset));
-
-	    /* AltiVec addressing mode is [reg+reg].  */
-	    mem = gen_frame_mem (V4SImode,
-				 gen_rtx_PLUS (Pmode, frame_reg_rtx, areg));
-
-	    insn = emit_move_insn (mem, savereg);
-
-	    rs6000_frame_related (insn, frame_ptr_rtx, info->total_size,
-				  areg, GEN_INT (offset));
-	  }
-    }
-
-  /* VRSAVE is a bit vector representing which AltiVec registers
-     are used.  The OS uses this to determine which vector
-     registers to save on a context switch.  We need to save
-     VRSAVE on the stack frame, add whatever AltiVec registers we
-     used in this function, and do the corresponding magic in the
-     epilogue.  */
-
-  if (TARGET_ALTIVEC && TARGET_ALTIVEC_VRSAVE
-      && info->vrsave_mask != 0)
-    {
-      rtx reg, mem, vrsave;
-      int offset;
-
-      /* Get VRSAVE onto a GPR.  Note that ABI_V4 might be using r12
-	 as frame_reg_rtx and r11 as the static chain pointer for
-	 nested functions.  */
-      reg = gen_rtx_REG (SImode, 0);
-      vrsave = gen_rtx_REG (SImode, VRSAVE_REGNO);
-      if (TARGET_MACHO)
-	emit_insn (gen_get_vrsave_internal (reg));
-      else
-	emit_insn (gen_rtx_SET (VOIDmode, reg, vrsave));
-
-      if (!WORLD_SAVE_P (info))
-	{
-          /* Save VRSAVE.  */
-          offset = info->vrsave_save_offset + sp_offset;
-          mem = gen_frame_mem (SImode,
-			       gen_rtx_PLUS (Pmode, frame_reg_rtx,
-					     GEN_INT (offset)));
-          insn = emit_move_insn (mem, reg);
-	}
-
-      /* Include the registers in the mask.  */
-      emit_insn (gen_iorsi3 (reg, reg, GEN_INT ((int) info->vrsave_mask)));
-
-      insn = emit_insn (generate_set_vrsave (reg, info, 0));
-    }
-
   /* If we use the link register, get it into r0.  */
   if (!WORLD_SAVE_P (info) && info->lr_save_p)
     {
@@ -15120,7 +15049,10 @@ rs6000_emit_prologue (void)
      for which it was done previously.  */
   if (!WORLD_SAVE_P (info) && info->push_p
       && !(DEFAULT_ABI == ABI_V4 || current_function_calls_eh_return))
+    {
     rs6000_emit_allocate_stack (info->total_size, FALSE);
+      sp_offset = info->total_size;
+    }
 
   /* Set frame pointer, if needed.  */
   if (frame_pointer_needed)
@@ -15130,6 +15062,78 @@ rs6000_emit_prologue (void)
       RTX_FRAME_RELATED_P (insn) = 1;
     }
 
+  /* Save AltiVec registers if needed.  Save here because the red zone does
+     not include AltiVec registers.  */
+  if (!WORLD_SAVE_P (info) && TARGET_ALTIVEC_ABI && info->altivec_size != 0)
+    {
+      int i;
+
+      /* There should be a non inline version of this, for when we
+         are saving lots of vector registers.  */
+      for (i = info->first_altivec_reg_save; i <= LAST_ALTIVEC_REGNO; ++i)
+        if (info->vrsave_mask & ALTIVEC_REG_BIT (i))
+          {
+            rtx areg, savereg, mem;
+            int offset;
+
+            offset = info->altivec_save_offset + sp_offset
+              + 16 * (i - info->first_altivec_reg_save);
+
+            savereg = gen_rtx_REG (V4SImode, i);
+
+            areg = gen_rtx_REG (Pmode, 0);
+            emit_move_insn (areg, GEN_INT (offset));
+
+            /* AltiVec addressing mode is [reg+reg].  */
+            mem = gen_frame_mem (V4SImode,
+                                 gen_rtx_PLUS (Pmode, frame_reg_rtx, areg));
+
+            insn = emit_move_insn (mem, savereg);
+
+            rs6000_frame_related (insn, frame_ptr_rtx, info->total_size,
+                                  areg, GEN_INT (offset));
+          }
+    }
+
+  /* VRSAVE is a bit vector representing which AltiVec registers
+     are used.  The OS uses this to determine which vector
+     registers to save on a context switch.  We need to save
+     VRSAVE on the stack frame, add whatever AltiVec registers we
+     used in this function, and do the corresponding magic in the
+     epilogue.  */
+
+  if (TARGET_ALTIVEC && TARGET_ALTIVEC_VRSAVE
+      && info->vrsave_mask != 0)
+    {
+      rtx reg, mem, vrsave;
+      int offset;
+
+      /* Get VRSAVE onto a GPR.  Note that ABI_V4 might be using r12
+         as frame_reg_rtx and r11 as the static chain pointer for
+         nested functions.  */
+      reg = gen_rtx_REG (SImode, 0);
+      vrsave = gen_rtx_REG (SImode, VRSAVE_REGNO);
+      if (TARGET_MACHO)
+        emit_insn (gen_get_vrsave_internal (reg));
+      else
+        emit_insn (gen_rtx_SET (VOIDmode, reg, vrsave));
+
+      if (!WORLD_SAVE_P (info))
+        {
+          /* Save VRSAVE.  */
+          offset = info->vrsave_save_offset + sp_offset;
+          mem = gen_frame_mem (SImode,
+                               gen_rtx_PLUS (Pmode, frame_reg_rtx,
+                                             GEN_INT (offset)));
+          insn = emit_move_insn (mem, reg);
+        }
+
+      /* Include the registers in the mask.  */
+      emit_insn (gen_iorsi3 (reg, reg, GEN_INT ((int) info->vrsave_mask)));
+
+      insn = emit_insn (generate_set_vrsave (reg, info, 0));
+    }
+
   /* If we are using RS6000_PIC_OFFSET_TABLE_REGNUM, we need to set it up.  */
   if ((TARGET_TOC && TARGET_MINIMAL_TOC && get_pool_size () != 0)
       || (DEFAULT_ABI == ABI_V4
@@ -15387,33 +15391,10 @@ rs6000_emit_epilogue (int sibcall)
       return;
     }
 
-  /* If we have a frame pointer, a call to alloca,  or a large stack
-     frame, restore the old stack pointer using the backchain.  Otherwise,
-     we know what size to update it with.  */
-  if (use_backchain_to_restore_sp)
-    {
-      /* Under V.4, don't reset the stack pointer until after we're done
-	 loading the saved registers.  */
-      if (DEFAULT_ABI == ABI_V4)
-	frame_reg_rtx = gen_rtx_REG (Pmode, 11);
-
-      emit_move_insn (frame_reg_rtx,
-		      gen_rtx_MEM (Pmode, sp_reg_rtx));
-    }
-  else if (info->push_p)
-    {
-      if (DEFAULT_ABI == ABI_V4
-	  || current_function_calls_eh_return)
+  /* Set sp_offset based on the stack push from the prologue.  */
+  if ((DEFAULT_ABI == ABI_V4 || current_function_calls_eh_return)
+      && info->total_size < 32767)
 	sp_offset = info->total_size;
-      else
-	{
-	  emit_insn (TARGET_32BIT
-		     ? gen_addsi3 (sp_reg_rtx, sp_reg_rtx,
-				   GEN_INT (info->total_size))
-		     : gen_adddi3 (sp_reg_rtx, sp_reg_rtx,
-				   GEN_INT (info->total_size)));
-	}
-    }
 
   /* Restore AltiVec registers if needed.  */
   if (TARGET_ALTIVEC_ABI && info->altivec_size != 0)
@@ -15454,6 +15435,36 @@ rs6000_emit_epilogue (int sibcall)
       emit_insn (generate_set_vrsave (reg, info, 1));
     }
 
+  sp_offset = 0;
+
+  /* If we have a frame pointer, a call to alloca,  or a large stack
+     frame, restore the old stack pointer using the backchain.  Otherwise,
+     we know what size to update it with.  */
+  if (use_backchain_to_restore_sp)
+    {
+      /* Under V.4, don't reset the stack pointer until after we're done
+	 loading the saved registers.  */
+      if (DEFAULT_ABI == ABI_V4)
+	frame_reg_rtx = gen_rtx_REG (Pmode, 11);
+
+      emit_move_insn (frame_reg_rtx,
+		      gen_rtx_MEM (Pmode, sp_reg_rtx));
+    }
+  else if (info->push_p)
+    {
+      if (DEFAULT_ABI == ABI_V4
+	  || current_function_calls_eh_return)
+	sp_offset = info->total_size;
+      else
+	{
+	  emit_insn (TARGET_32BIT
+		     ? gen_addsi3 (sp_reg_rtx, sp_reg_rtx,
+				   GEN_INT (info->total_size))
+		     : gen_adddi3 (sp_reg_rtx, sp_reg_rtx,
+				   GEN_INT (info->total_size)));
+	}
+    }
+
   /* Get the old lr if we saved it.  */
   if (info->lr_save_p)
     {

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

* Re: [patch] move altivec register saving
  2007-05-14 18:33 ` Eric Christopher
@ 2007-05-16  8:30   ` Eric Christopher
  2007-05-18 18:31     ` Andrew Pinski
  0 siblings, 1 reply; 9+ messages in thread
From: Eric Christopher @ 2007-05-16  8:30 UTC (permalink / raw)
  To: GCC Patches; +Cc: Andrew Pinski, Geoff Keating, dje


On May 14, 2007, at 11:33 AM, Eric Christopher wrote:

>>
>> The patch was tested on ppc-darwin, ppc64-darwin and ppc-linux.  
>> Andrew made some mention of a ppc64-linux failure, but I've been  
>> unable to get the preprocessed testcase so I'd like to commit now  
>> and I'll commit to fixing the failure if it happens or turns up in  
>> testing as soon as someone can get me a testcase.
>>
>
> And Geoff found the problem, so that's fixed here. He also OK'd the  
> patch, but I'm going to give people a chance to test and give me  
> feedback before I commit.
>
> Tested on ppc-darwin and -m64.
>
> -eric
>
>  * config/rs6000/rs6000.c (rs6000_emit_prologue): Move altivec  
> register saving after stack push.
>  Set sp_offset whenever we push.
>  (rs6000_emit_epilogue): Move altivec register restore before stack  
> push.

And I've committed this now. :)

Let me know if I break anything, I tested as much as I could.

-eric

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

* Re: [patch] move altivec register saving
  2007-05-16  8:30   ` Eric Christopher
@ 2007-05-18 18:31     ` Andrew Pinski
  2007-05-18 18:38       ` Eric Christopher
  2007-05-25  1:43       ` Eric Christopher
  0 siblings, 2 replies; 9+ messages in thread
From: Andrew Pinski @ 2007-05-18 18:31 UTC (permalink / raw)
  To: Eric Christopher; +Cc: GCC Patches, Geoff Keating, dje

On 5/16/07, Eric Christopher <echristo@apple.com> wrote:
>
> And I've committed this now. :)
>
> Let me know if I break anything, I tested as much as I could.

One more failure, again varargs-4.c but on the 64bit side of
powerpc64-linux-gnu.

Thanks,
Andrew Pinski

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

* Re: [patch] move altivec register saving
  2007-05-18 18:31     ` Andrew Pinski
@ 2007-05-18 18:38       ` Eric Christopher
  2007-05-25  1:43       ` Eric Christopher
  1 sibling, 0 replies; 9+ messages in thread
From: Eric Christopher @ 2007-05-18 18:38 UTC (permalink / raw)
  To: Andrew Pinski; +Cc: GCC Patches


On May 18, 2007, at 11:31 AM, Andrew Pinski wrote:

> On 5/16/07, Eric Christopher <echristo@apple.com> wrote:
>>
>> And I've committed this now. :)
>>
>> Let me know if I break anything, I tested as much as I could.
>
> One more failure, again varargs-4.c but on the 64bit side of
> powerpc64-linux-gnu.

Gar. I also found another one yesterday so I've got a patch for that  
which
I'll be submitting today.

Preprocessed varargs-4.i for powerpc64-linux-gnu would be good though :)

-eric

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

* Re: [patch] move altivec register saving
  2007-05-18 18:31     ` Andrew Pinski
  2007-05-18 18:38       ` Eric Christopher
@ 2007-05-25  1:43       ` Eric Christopher
  2007-05-25 19:33         ` [patch] fix altivec register saving regressions Eric Christopher
  1 sibling, 1 reply; 9+ messages in thread
From: Eric Christopher @ 2007-05-25  1:43 UTC (permalink / raw)
  To: Andrew Pinski; +Cc: GCC Patches

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


On May 18, 2007, at 11:31 AM, Andrew Pinski wrote:

> On 5/16/07, Eric Christopher <echristo@apple.com> wrote:
>>
>> And I've committed this now. :)
>>
>> Let me know if I break anything, I tested as much as I could.
>
> One more failure, again varargs-4.c but on the 64bit side of
> powerpc64-linux-gnu.

This patch should fix the failures, tested on ppc-darwin and ppc64- 
darwin it fixes the ppc vect.exp failures and the varargs-4.c failure  
for ppc64.

Want to give it a run?

-eric



[-- Attachment #2: rs6000.c.diff.txt --]
[-- Type: text/plain, Size: 1155 bytes --]

Index: rs6000.c
===================================================================
--- rs6000.c	(revision 124948)
+++ rs6000.c	(working copy)
@@ -15050,8 +15050,17 @@ rs6000_emit_prologue (void)
   if (!WORLD_SAVE_P (info) && info->push_p
       && !(DEFAULT_ABI == ABI_V4 || current_function_calls_eh_return))
     {
-      rs6000_emit_allocate_stack (info->total_size, FALSE);
+      if (info->total_size < 32767)
       sp_offset = info->total_size;
+      else
+	frame_reg_rtx = frame_ptr_rtx;
+      rs6000_emit_allocate_stack (info->total_size,
+				  (frame_reg_rtx != sp_reg_rtx
+				   && ((info->altivec_size != 0)
+				       || (info->vrsave_mask != 0)
+				       )));
+      if (frame_reg_rtx != sp_reg_rtx)
+	rs6000_emit_stack_tie ();
     }
 
   /* Set frame pointer, if needed.  */
@@ -15392,8 +15401,7 @@ rs6000_emit_epilogue (int sibcall)
     }
 
   /* Set sp_offset based on the stack push from the prologue.  */
-  if ((DEFAULT_ABI == ABI_V4 || current_function_calls_eh_return)
-      && info->total_size < 32767)
+  if (info->total_size < 32767)
     sp_offset = info->total_size;
 
   /* Restore AltiVec registers if needed.  */

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

* [patch] fix altivec register saving regressions
  2007-05-25  1:43       ` Eric Christopher
@ 2007-05-25 19:33         ` Eric Christopher
  2007-05-26 17:20           ` David Edelsohn
  0 siblings, 1 reply; 9+ messages in thread
From: Eric Christopher @ 2007-05-25 19:33 UTC (permalink / raw)
  To: Geoff Keating; +Cc: GCC Patches

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

> This patch should fix the failures, tested on ppc-darwin and ppc64- 
> darwin it fixes the ppc vect.exp failures and the varargs-4.c  
> failure for ppc64.
>
> Want to give it a run?

Andrew has confirmed this fixes all of the problems he saw, it fixed  
all of mine as well. Tested on ppc-darwin, ppc64-darwin, and ppc64- 
linux.

OK?

-eric

2007-05-25  Eric Christopher  <echristo@apple.com>

	* config/rs6000/rs6000.c (rs6000_emit_prologue): Update
	sp_offset depending on stack size. Save r12 depending
	on registers we're saving later.
	(rs6000_emit_epilogue): Update sp_offset depending only
	on stack size.


[-- Attachment #2: rs6000.c.diff.txt --]
[-- Type: text/plain, Size: 1155 bytes --]

Index: rs6000.c
===================================================================
--- rs6000.c	(revision 124948)
+++ rs6000.c	(working copy)
@@ -15050,8 +15050,17 @@ rs6000_emit_prologue (void)
   if (!WORLD_SAVE_P (info) && info->push_p
       && !(DEFAULT_ABI == ABI_V4 || current_function_calls_eh_return))
     {
-      rs6000_emit_allocate_stack (info->total_size, FALSE);
+      if (info->total_size < 32767)
       sp_offset = info->total_size;
+      else
+	frame_reg_rtx = frame_ptr_rtx;
+      rs6000_emit_allocate_stack (info->total_size,
+				  (frame_reg_rtx != sp_reg_rtx
+				   && ((info->altivec_size != 0)
+				       || (info->vrsave_mask != 0)
+				       )));
+      if (frame_reg_rtx != sp_reg_rtx)
+	rs6000_emit_stack_tie ();
     }
 
   /* Set frame pointer, if needed.  */
@@ -15392,8 +15401,7 @@ rs6000_emit_epilogue (int sibcall)
     }
 
   /* Set sp_offset based on the stack push from the prologue.  */
-  if ((DEFAULT_ABI == ABI_V4 || current_function_calls_eh_return)
-      && info->total_size < 32767)
+  if (info->total_size < 32767)
     sp_offset = info->total_size;
 
   /* Restore AltiVec registers if needed.  */

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

* Re: [patch] fix altivec register saving regressions
  2007-05-25 19:33         ` [patch] fix altivec register saving regressions Eric Christopher
@ 2007-05-26 17:20           ` David Edelsohn
  0 siblings, 0 replies; 9+ messages in thread
From: David Edelsohn @ 2007-05-26 17:20 UTC (permalink / raw)
  To: Eric Christopher; +Cc: Geoff Keating, gcc-patches

	* config/rs6000/rs6000.c (rs6000_emit_prologue): Update
	sp_offset depending on stack size. Save r12 depending
	on registers we're saving later.
	(rs6000_emit_epilogue): Update sp_offset depending only
	on stack size.

Okay.

David

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

end of thread, other threads:[~2007-05-26 16:27 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-07 21:28 [patch] move altivec register saving Eric Christopher
2007-05-07 21:44 ` David Edelsohn
2007-05-14 18:33 ` Eric Christopher
2007-05-16  8:30   ` Eric Christopher
2007-05-18 18:31     ` Andrew Pinski
2007-05-18 18:38       ` Eric Christopher
2007-05-25  1:43       ` Eric Christopher
2007-05-25 19:33         ` [patch] fix altivec register saving regressions Eric Christopher
2007-05-26 17:20           ` 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).