mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-21 15:31:09 +08:00
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
This commit is contained in:
parent
392e6b81c3
commit
5514386120
@ -1,3 +1,7 @@
|
||||
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)
|
||||
|
@ -1,3 +1,7 @@
|
||||
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
|
||||
|
39
gcc/testsuite/gcc.dg/20001013-1.c
Normal file
39
gcc/testsuite/gcc.dg/20001013-1.c
Normal file
@ -0,0 +1,39 @@
|
||||
/* { 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);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user