mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-16 02:20:27 +08:00
simplify-rtx.c (simplify_relational_operation): Optimize abs(x) < 0.0 (and abs(x) >= 0.0 when using -ffast-math).
* simplify-rtx.c (simplify_relational_operation): Optimize abs(x) < 0.0 (and abs(x) >= 0.0 when using -ffast-math). * gcc.c-torture/execute/20020720-1.c: New test case. From-SVN: r55614
This commit is contained in:
parent
68cd2524d6
commit
0da65b89f1
@ -1,3 +1,8 @@
|
||||
2002-07-20 Roger Sayle <roger@eyesopen.com>
|
||||
|
||||
* simplify-rtx.c (simplify_relational_operation): Optimize
|
||||
abs(x) < 0.0 (and abs(x) >= 0.0 when using -ffast-math).
|
||||
|
||||
2002-07-20 Michae Matz <matz@suse.de>
|
||||
|
||||
* ra-build.c: (remember_web_was_spilled): Use GENERAL_REGS.
|
||||
|
@ -2075,6 +2075,28 @@ simplify_relational_operation (code, mode, op0, op1)
|
||||
return const0_rtx;
|
||||
break;
|
||||
|
||||
case LT:
|
||||
/* Optimize abs(x) < 0.0. */
|
||||
if (trueop1 == CONST0_RTX (mode))
|
||||
{
|
||||
tem = GET_CODE (trueop0) == FLOAT_EXTEND ? XEXP (trueop0, 0)
|
||||
: trueop0;
|
||||
if (GET_CODE (tem) == ABS)
|
||||
return const0_rtx;
|
||||
}
|
||||
break;
|
||||
|
||||
case GE:
|
||||
/* Optimize abs(x) >= 0.0. */
|
||||
if (trueop1 == CONST0_RTX (mode) && !HONOR_NANS (mode))
|
||||
{
|
||||
tem = GET_CODE (trueop0) == FLOAT_EXTEND ? XEXP (trueop0, 0)
|
||||
: trueop0;
|
||||
if (GET_CODE (tem) == ABS)
|
||||
return const1_rtx;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -1,3 +1,7 @@
|
||||
2002-07-20 Roger Sayle <roger@eyesopen.com>
|
||||
|
||||
* gcc.c-torture/execute/20020720-1.c: New testcase.
|
||||
|
||||
2002-07-20 Neil Booth <neil@daikokuya.co.uk>
|
||||
|
||||
* gcc.dg/cpp/Wsignprom.c: New tests.
|
||||
|
36
gcc/testsuite/gcc.c-torture/execute/20020720-1.c
Normal file
36
gcc/testsuite/gcc.c-torture/execute/20020720-1.c
Normal file
@ -0,0 +1,36 @@
|
||||
/* Copyright (C) 2002 Free Software Foundation.
|
||||
|
||||
Ensure that fabs(x) < 0.0 optimization is working.
|
||||
|
||||
Written by Roger Sayle, 20th July 2002. */
|
||||
|
||||
extern void abort (void);
|
||||
extern double fabs (double);
|
||||
extern void link_error (void);
|
||||
|
||||
void
|
||||
foo (double x)
|
||||
{
|
||||
double p, q;
|
||||
|
||||
p = fabs (x);
|
||||
q = 0.0;
|
||||
if (p < q)
|
||||
link_error ();
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
foo (1.0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef __OPTIMIZE__
|
||||
void
|
||||
link_error ()
|
||||
{
|
||||
abort ();
|
||||
}
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user