fold-const.c (fold_strip_sign_ops): New function to simplify a floating point express...
authorRoger Sayle <roger@eyesopen.com>
Wed, 9 Feb 2005 21:56:35 +0000 (21:56 +0000)
committerRoger Sayle <sayle@gcc.gnu.org>
Wed, 9 Feb 2005 21:56:35 +0000 (21:56 +0000)
commite3bb43c0fef35c410538453c6a70a22822e03b10
treeb165cf0028ec1a832fc59f34df44d639c9c318a2
parent08c2481a791a11ac8aee6652c6fb8c57faf4d584
fold-const.c (fold_strip_sign_ops): New function to simplify a floating point expression ignoring the sign of the...

* fold-const.c (fold_strip_sign_ops): New function to simplify a
floating point expression ignoring the sign of the result.
(fold) <ABS_EXPR>: Use it to simplify fabs(x).
(fold) <MULT_EXPR>: Use it to simplify x*x.
* tree.h (fold_strip_sign_ops): Prototype here.
* builtins.c (fold_builtin_copysign): Take an additional FNDECL
argument.  Use fold_strip_sign_ops to simplify the first argument.
(fold_builtin_pow):  Use fold_strip_sign_ops to simplify the
first argument when the second argument is an even integer
constant, but only with -funsafe_math_optimizations.
(fold_builtin_1): Update call to fold_builtin_copysign.

* gcc.dg/builtins-48.c: New test case.
* gcc.dg/builtins-49.c: New test case.
* gcc.dg/builtins-50.c: New test case.
* gcc.dg/builtins-51.c: New test case.

From-SVN: r94779
gcc/ChangeLog
gcc/builtins.c
gcc/fold-const.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/builtins-48.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/builtins-49.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/builtins-50.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/builtins-51.c [new file with mode: 0644]
gcc/tree.h