Commit 0da65b89 by Roger Sayle Committed by Roger Sayle

simplify-rtx.c (simplify_relational_operation): Optimize abs(x) < 0.0 (and…

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
parent 68cd2524
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> 2002-07-20 Michae Matz <matz@suse.de>
* ra-build.c: (remember_web_was_spilled): Use GENERAL_REGS. * ra-build.c: (remember_web_was_spilled): Use GENERAL_REGS.
......
...@@ -2075,6 +2075,28 @@ simplify_relational_operation (code, mode, op0, op1) ...@@ -2075,6 +2075,28 @@ simplify_relational_operation (code, mode, op0, op1)
return const0_rtx; return const0_rtx;
break; 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: default:
break; break;
} }
......
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> 2002-07-20 Neil Booth <neil@daikokuya.co.uk>
* gcc.dg/cpp/Wsignprom.c: New tests. * gcc.dg/cpp/Wsignprom.c: New tests.
......
/* 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
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