From 298ac1dd20a0f91e5975bf8a3ca8138e4f0499e4 Mon Sep 17 00:00:00 2001 From: Andrew Pinski Date: Sat, 12 Apr 2008 20:17:01 -0700 Subject: [PATCH] rs6000.c (compute_save_world_info): Set lr_save_p if we are going to "save the world". 2008-04-12 Andrew Pinski * 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 * gcc.target/powerpc/darwin-save-world-1.c: New test. From-SVN: r134237 --- gcc/ChangeLog | 5 +++++ gcc/config/rs6000/rs6000.c | 3 +++ gcc/testsuite/ChangeLog | 4 ++++ .../gcc.target/powerpc/darwin-save-world-1.c | 18 ++++++++++++++++++ 4 files changed, 30 insertions(+) create mode 100644 gcc/testsuite/gcc.target/powerpc/darwin-save-world-1.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 69cb7f2316d..9aa7f7dcac6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2008-04-12 Andrew Pinski + + * 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 * config/cris/cris.md ("*andhi_lowpart_non_v32", "*andhi_lowpart_v32") diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index be069ccb7a5..0d868944218 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -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 (); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 35112f287f4..4c4feb17755 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2008-04-12 Andrew Pinski + + * gcc.target/powerpc/darwin-save-world-1.c: New test. + 2008-04-11 Richard Guenther 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 index 00000000000..452060e9f61 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/darwin-save-world-1.c @@ -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; +} -- 2.30.2