* fold-const.c (fold_strip_sign_ops): New function to simplify a
commit198d9bbee87d11cad4547476146f84d5495c0260
authorsayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 9 Feb 2005 21:56:35 +0000 (9 21:56 +0000)
committersayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 9 Feb 2005 21:56:35 +0000 (9 21:56 +0000)
treeb165cf0028ec1a832fc59f34df44d639c9c318a2
parentd1001cc93ca3fc8a93e1048911c52dab4a56d6da
* 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@94779 138bc75d-0d04-0410-961f-82ee72b054a4
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