From 71aca5a07a0b9646d5040577ab646c3d147fb228 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Tue, 3 May 2016 22:08:32 +0930 Subject: [PATCH] [RS6000] Fix ICE caused by rs6000_savres_strategy thinko rev 235672 (git cffc0b35) changed the condition for SAVE_MULTIPLE/ STORE_MULTIPLE, wrongly allowing a single reg. gcc/ * config/rs6000/rs6000.c (rs6000_savres_strategy): Correct condition for SAVE_MULTIPLE/STORE_MULTIPLE. gcc/testsuite/ * gcc.target/powerpc/savres.c: Add func using a single gpr. From-SVN: r235820 --- gcc/ChangeLog | 5 +++++ gcc/config/rs6000/rs6000.c | 2 +- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gcc.target/powerpc/savres.c | 12 ++++++++++++ 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index af475b3ea38..6d8b0d620de 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2016-05-03 Alan Modra + + * config/rs6000/rs6000.c (rs6000_savres_strategy): Correct condition + for SAVE_MULTIPLE/STORE_MULTIPLE. + 2016-05-03 Jakub Jelinek * config/i386/i386.md (*truncdfsf_mixed, *truncdfsf_i387, diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 839ff5b71e6..61d39242b39 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -23425,7 +23425,7 @@ rs6000_savres_strategy (rs6000_stack_t *info, if (TARGET_MULTIPLE && !TARGET_POWERPC64 && !(TARGET_SPE_ABI && info->spe_64bit_regs_used) - && info->first_gp_reg_save != 32) + && info->first_gp_reg_save < 31) { /* Prefer store multiple for saves over out-of-line routines, since the store-multiple instruction will always be smaller. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 020312fa643..f8682ad9a77 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2016-05-03 Alan Modra + + * gcc.target/powerpc/savres.c: Add func using a single gpr. + 2016-05-03 Jakub Jelinek * gcc.target/i386/avx512f-cvt-1.c: New test. diff --git a/gcc/testsuite/gcc.target/powerpc/savres.c b/gcc/testsuite/gcc.target/powerpc/savres.c index f10c99a4b93..f472f23e728 100644 --- a/gcc/testsuite/gcc.target/powerpc/savres.c +++ b/gcc/testsuite/gcc.target/powerpc/savres.c @@ -441,6 +441,16 @@ void s_r (void) __asm __volatile ("#%0" : "=m" (a) : : "r30", "r31"); } +void s_r31 (void) +{ + char a[33]; +#ifndef NO_BODY + TRASH_GPR (r31); + __asm__ __volatile__ ("#%0" : : "r" (r31)); +#endif + __asm __volatile ("#%0" : "=m" (a) : : "r31"); +} + void s_c (void) { char a[33]; @@ -1140,6 +1150,8 @@ int main (void) VERIFY_REGS; s_r (); VERIFY_REGS; + s_r31 (); + VERIFY_REGS; s_c (); VERIFY_REGS; s_0 (); -- 2.30.2