re PR target/16195 ([3.4 only] Miscompilation of GCC 3.3.x by 3.4.x)

PR target/16195
	* config/rs6000/rs6000.c (rs6000_conditional_register_usage): Make
	r30 fixed if TARGET_TOC && TARGET_MINIMAL_TOC.
	(first_reg_to_save): Pretend call_used_regs[30] is 0 if
	TARGET_TOC && TARGET_MINIMAL_TOC.
	(rs6000_emit_prologue, rs6000_emit_epilogue): Likewise.

	* gcc.dg/20040625-1.c: New test.

From-SVN: r83872
This commit is contained in:
Jakub Jelinek 2004-06-29 21:27:07 +02:00 committed by Jakub Jelinek
parent 9056bd7025
commit b4db40bf1d
4 changed files with 64 additions and 3 deletions

View File

@ -1,3 +1,12 @@
2004-06-29 Jakub Jelinek <jakub@redhat.com>
PR target/16195
* config/rs6000/rs6000.c (rs6000_conditional_register_usage): Make
r30 fixed if TARGET_TOC && TARGET_MINIMAL_TOC.
(first_reg_to_save): Pretend call_used_regs[30] is 0 if
TARGET_TOC && TARGET_MINIMAL_TOC.
(rs6000_emit_prologue, rs6000_emit_epilogue): Likewise.
2004-06-29 J"orn Rennecke <joern.rennecke@superh.com>
Fix gcc.dg/builtin-apply2.c failures:

View File

@ -3480,6 +3480,10 @@ rs6000_conditional_register_usage (void)
= call_used_regs[RS6000_PIC_OFFSET_TABLE_REGNUM]
= call_really_used_regs[RS6000_PIC_OFFSET_TABLE_REGNUM] = 1;
if (TARGET_TOC && TARGET_MINIMAL_TOC)
fixed_regs[RS6000_PIC_OFFSET_TABLE_REGNUM]
= call_used_regs[RS6000_PIC_OFFSET_TABLE_REGNUM] = 1;
if (TARGET_ALTIVEC)
global_regs[VSCR_REGNO] = 1;
@ -10834,7 +10838,8 @@ first_reg_to_save (void)
&& (! call_used_regs[first_reg]
|| (first_reg == RS6000_PIC_OFFSET_TABLE_REGNUM
&& ((DEFAULT_ABI == ABI_V4 && flag_pic != 0)
|| (DEFAULT_ABI == ABI_DARWIN && flag_pic)))))
|| (DEFAULT_ABI == ABI_DARWIN && flag_pic)
|| (TARGET_TOC && TARGET_MINIMAL_TOC)))))
break;
#if TARGET_MACHO
@ -12428,7 +12433,10 @@ rs6000_emit_prologue (void)
int i;
for (i = 0; i < 32 - info->first_gp_reg_save; i++)
if ((regs_ever_live[info->first_gp_reg_save+i]
&& ! call_used_regs[info->first_gp_reg_save+i])
&& (! call_used_regs[info->first_gp_reg_save+i]
|| (i+info->first_gp_reg_save
== RS6000_PIC_OFFSET_TABLE_REGNUM
&& TARGET_TOC && TARGET_MINIMAL_TOC)))
|| (i+info->first_gp_reg_save == RS6000_PIC_OFFSET_TABLE_REGNUM
&& ((DEFAULT_ABI == ABI_V4 && flag_pic != 0)
|| (DEFAULT_ABI == ABI_DARWIN && flag_pic))))
@ -12877,7 +12885,9 @@ rs6000_emit_epilogue (int sibcall)
else
for (i = 0; i < 32 - info->first_gp_reg_save; i++)
if ((regs_ever_live[info->first_gp_reg_save+i]
&& ! call_used_regs[info->first_gp_reg_save+i])
&& (! call_used_regs[info->first_gp_reg_save+i]
|| (i+info->first_gp_reg_save == RS6000_PIC_OFFSET_TABLE_REGNUM
&& TARGET_TOC && TARGET_MINIMAL_TOC)))
|| (i+info->first_gp_reg_save == RS6000_PIC_OFFSET_TABLE_REGNUM
&& ((DEFAULT_ABI == ABI_V4 && flag_pic != 0)
|| (DEFAULT_ABI == ABI_DARWIN && flag_pic))))

View File

@ -1,3 +1,8 @@
2004-06-29 Jakub Jelinek <jakub@redhat.com>
PR target/16195
* gcc.dg/20040625-1.c: New test.
2004-06-29 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
* gfortran.fortran-torture/execute/parameter_2.f90: New test.

View File

@ -0,0 +1,37 @@
/* { dg-do run } */
/* { dg-options "-O2" } */
/* { dg-options "-mminimal-toc" { target powerpc64-*-* powerpc-ibm-aix* } } */
extern void abort (void);
extern void exit (int);
double __attribute__((noinline))
foo (void)
{
return 16441577472.0;
}
double __attribute__((noinline))
bar (double x)
{
return x;
}
int __attribute__((noinline))
test (void)
{
double x = foo ();
x = bar (x);
x /= 1024 * 1024 * 1024;
x *= 70;
x = x < 70 ? x : 70;
x += 30;
return x;
}
int main (void)
{
if (test () != 100)
abort ();
exit (0);
}