Commit 55143861 by Jakub Jelinek Committed by Jakub Jelinek

rtlanal.c (may_trap_p): Check operand modes of COMPARE.

	* rtlanal.c (may_trap_p): Check operand modes of COMPARE.
	* gcc.dg/20001013-1.c: New test.

From-SVN: r36878
parent 392e6b81
2000-10-16 Jakub Jelinek <jakub@redhat.com>
* rtlanal.c (may_trap_p): Check operand modes of COMPARE.
2000-10-14 Joseph S. Myers <jsm28@cam.ac.uk>
* PROBLEMS: Remove.
......
......@@ -1930,6 +1930,17 @@ may_trap_p (x)
certainly may trap. */
return 1;
case COMPARE:
/* Any floating comparison may trap. */
if (GET_MODE_CLASS (GET_MODE (x)) == MODE_FLOAT)
return 1;
/* But often the compare has some CC mode, so check operand
modes as well. */
if (GET_MODE_CLASS (GET_MODE (XEXP (x, 0))) == MODE_FLOAT
|| GET_MODE_CLASS (GET_MODE (XEXP (x, 1))) == MODE_FLOAT)
return 1;
break;
default:
/* Any floating arithmetic may trap. */
if (GET_MODE_CLASS (GET_MODE (x)) == MODE_FLOAT)
......
2000-10-16 Jakub Jelinek <jakub@redhat.com>
* gcc.dg/20001013-1.c: New test.
2000-10-15 Joseph S. Myers <jsm28@cam.ac.uk>
* gcc.dg/c90-printf-2.c, gcc.dg/c90-scanf-2.c: Determine the type
......
/* { dg-do run { target sparc*-*-* } } */
/* { dg-options "-O2 -mvis" } */
int l;
int baz (double x)
{
return l == 0;
}
double bar (double x)
{
return 1.0;
}
double foo (double x)
{
if (l == -1 || baz (x)) return x;
if (x < 0.0)
return bar (x);
else
return 0.0;
}
union {
double d;
long long l;
} x = { l: 0x7ff8000000000000LL }, y;
main ()
{
unsigned int fsr = 0;
__asm __volatile ("ld %0, %%fsr" : : "m" (fsr));
y.d = foo (x.d);
__asm __volatile ("st %%fsr, %0" : "=m" (fsr));
if (x.l != y.l || (fsr & 0x3ff))
abort ();
exit (0);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment