patch: rs6000-specific ICE (redone)
Dale Johannesen
dalej@apple.com
Mon Oct 21 14:29:00 GMT 2002
I've rewritten this along the lines Geoff suggested. It's much cleaner
this way. Bootstrapped and tested on Darwin.
2002-10-18 Dale Johannesen <dalej@apple.com>
* config/rs6000/rs6000.c (rs6000_reverse_condition): Handle
unsafe math reversals correctly for RTL generation.
(output_cbranch): Replace rs6000_reverse_condition call
by its former definition.
Index: rs6000.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.c,v
retrieving revision 1.391
diff -u -d -b -w -c -3 -p -r1.391 rs6000.c
*** rs6000.c 16 Oct 2002 23:08:43 -0000 1.391
--- rs6000.c 21 Oct 2002 21:18:51 -0000
*************** rs6000_reverse_condition (mode, code)
*** 8125,8131 ****
{
/* Reversal of FP compares takes care -- an ordered compare
becomes an unordered compare and vice versa. */
! if (mode == CCFPmode)
return reverse_condition_maybe_unordered (code);
else
return reverse_condition (code);
--- 8125,8131 ----
{
/* Reversal of FP compares takes care -- an ordered compare
becomes an unordered compare and vice versa. */
! if (mode == CCFPmode && !flag_unsafe_math_optimizations )
return reverse_condition_maybe_unordered (code);
else
return reverse_condition (code);
*************** output_cbranch (op, label, reversed, ins
*** 8397,8403 ****
reverse_condition_maybe_unordered here always but this
makes the resulting assembler clearer. */
if (really_reversed)
! code = rs6000_reverse_condition (mode, code);
if ((TARGET_SPE && TARGET_HARD_FLOAT) && mode == CCFPmode)
{
--- 8397,8410 ----
reverse_condition_maybe_unordered here always but this
makes the resulting assembler clearer. */
if (really_reversed)
! {
! /* Reversal of FP compares takes care -- an ordered compare
! becomes an unordered compare and vice versa. */
! if (mode == CCFPmode)
! code = reverse_condition_maybe_unordered (code);
! else
! code = reverse_condition (code);
! }
if ((TARGET_SPE && TARGET_HARD_FLOAT) && mode == CCFPmode)
{
/* { dg-do run } */
/* { dg-options "-O2 -ffast-math" } */
int foo ( float* dists, int k)
{
if ( ( dists [ 0 ] > 0 ) == ( dists [ 1 ] > 0 ) )
return k;
return 0;
}
main() {
float dists[16] = { 0., 1., 1., 0., 0., -1., -1., 0.,
1., 1., 1., -1., -1., 1., -1., -1. };
if ( foo(&dists[0], 1) +
foo(&dists[2], 2) +
foo(&dists[4], 4) +
foo(&dists[6], 8) +
foo(&dists[8], 16) +
foo(&dists[10], 32) +
foo(&dists[12], 64) +
foo(&dists[14], 128)
!= 156)
abort();
}
More information about the Gcc-patches
mailing list