rs6000.c (compute_save_world_info): Set lr_save_p if we are going to "save the world".
authorAndrew Pinski <pinskia@gmail.com>
Sun, 13 Apr 2008 03:17:01 +0000 (20:17 -0700)
committerAndrew Pinski <pinskia@gcc.gnu.org>
Sun, 13 Apr 2008 03:17:01 +0000 (20:17 -0700)
2008-04-12  Andrew Pinski  <pinskia@gmail.com>

        * config/rs6000/rs6000.c (compute_save_world_info): Set lr_save_p if
        we are going to "save the world".

2008-04-12  Andrew Pinski  <pinskia@gmail.com>

        * gcc.target/powerpc/darwin-save-world-1.c: New test.

From-SVN: r134237

gcc/ChangeLog
gcc/config/rs6000/rs6000.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/powerpc/darwin-save-world-1.c [new file with mode: 0644]

index 69cb7f2316db3b2f23cff2a02b669921616870c4..9aa7f7dcac654b6b8d547a30a6cc0fa1a1eba2d4 100644 (file)
@@ -1,3 +1,8 @@
+2008-04-12  Andrew Pinski  <pinskia@gmail.com>
+
+       * config/rs6000/rs6000.c (compute_save_world_info): Set lr_save_p if
+       we are going to "save the world".
+
 2008-04-13  Hans-Peter Nilsson  <hp@axis.com>
 
        * config/cris/cris.md ("*andhi_lowpart_non_v32", "*andhi_lowpart_v32")
index be069ccb7a54d2971f2aeea5b227ca18ec078531..0d868944218d6ba31c4f91a537ac1c2ed26862f1 100644 (file)
@@ -14258,6 +14258,9 @@ compute_save_world_info (rs6000_stack_t *info_ptr)
         will attempt to save it. */
       info_ptr->vrsave_size  = 4;
 
+      /* If we are going to save the world, we need to save the link register too.  */
+      info_ptr->lr_save_p = 1;
+
       /* "Save" the VRsave register too if we're saving the world.  */
       if (info_ptr->vrsave_mask == 0)
        info_ptr->vrsave_mask = compute_vrsave_mask ();
index 35112f287f48509d1301ba16961dabca2ac96af5..4c4feb177559a9d20c1f9ebed388549b61a9c6f5 100644 (file)
@@ -1,3 +1,7 @@
+2008-04-12  Andrew Pinski  <pinskia@gmail.com>
+
+       * gcc.target/powerpc/darwin-save-world-1.c: New test.
+
 2008-04-11  Richard Guenther  <rguenther@suse.de>
 
        PR tree-optimization/35869
diff --git a/gcc/testsuite/gcc.target/powerpc/darwin-save-world-1.c b/gcc/testsuite/gcc.target/powerpc/darwin-save-world-1.c
new file mode 100644 (file)
index 0000000..452060e
--- /dev/null
@@ -0,0 +1,18 @@
+/* { dg-do run { target powerpc*-*-* } } */
+/* { dg-require-effective-target powerpc_altivec_ok } */
+/* { dg-options "-maltivec" } */
+
+/* With altivec turned on, Darwin wants to save the world but we did not mark lr as being saved any more
+   as saving the lr is not needed for saving altivec registers.  */
+
+int main (void)
+{
+  __label__ l1;
+  void __attribute__((used)) q(void)
+  {
+    goto l1;
+  }
+
+  l1:;
+  return 0;
+}