re PR middle-end/29335 (transcendental functions with constant arguments should be resolved at compile-time)

PR middle-end/29335
	* builtins.c (fold_builtin_1): Handle builtin fdim.

testsuite:
	* gcc.dg/torture/builtin-math-3.c: Test fdim.

From-SVN: r120993
This commit is contained in:
Kaveh R. Ghazi 2007-01-20 00:33:00 +00:00 committed by Kaveh Ghazi
parent 77dbd49bdc
commit 92d966284c
4 changed files with 26 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2007-01-19 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
PR middle-end/29335
* builtins.c (fold_builtin_1): Handle builtin fdim.
2007-01-20 Jan Hubicka <jh@suse.cz>
* tree-ssa.c (init_tree_ssa): Do not call init_alias_heapvars.

View File

@ -9469,6 +9469,13 @@ fold_builtin_1 (tree fndecl, tree arglist, bool ignore)
type, mpfr_atan2);
break;
CASE_FLT_FN (BUILT_IN_FDIM):
if (validate_arglist (arglist, REAL_TYPE, REAL_TYPE, VOID_TYPE))
return do_mpfr_arg2 (TREE_VALUE (arglist),
TREE_VALUE (TREE_CHAIN (arglist)),
type, mpfr_dim);
break;
CASE_FLT_FN (BUILT_IN_FMA):
if (validate_arglist (arglist, REAL_TYPE, REAL_TYPE, REAL_TYPE, VOID_TYPE))
return do_mpfr_arg3 (TREE_VALUE (arglist),

View File

@ -1,3 +1,7 @@
2007-01-19 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* gcc.dg/torture/builtin-math-3.c: Test fdim.
2007-01-19 Mike Stump <mrs@apple.com>
* gcc.dg/darwin-ld-6.c: Remove, tests a linker flag that is going

View File

@ -294,6 +294,16 @@ int main (void)
TESTIT2_R (atan2, -1.0, 0.0, -1.58, -1.57); /* atan2(-1,0) == -pi/2 */
TESTIT2_R (atan2, 1.0, 0.0, 1.57, 1.58); /* atan2(1,0) == pi/2 */
TESTIT2 (fdim, 0.0, 0.0, 0.0); /* fdim(0,0) == 0 */
TESTIT2 (fdim, -0.0, 0.0, 0.0); /* fdim(-0,0) == 0 */
TESTIT2 (fdim, 0.0, -0.0, 0.0); /* fdim(0,-0) == 0 */
TESTIT2 (fdim, -0.0, -0.0, 0.0); /* fdim(-0,-0) == 0 */
TESTIT2 (fdim, 5.0, 5.0, 0.0); /* fdim(5,5) == 0 */
TESTIT2 (fdim, 5.0, 6.0, 0.0); /* fdim(5,6) == 0 */
TESTIT2 (fdim, 6.0, 5.0, 1.0); /* fdim(6,5) == 1 */
TESTIT2 (fdim, -5.0, -6.0, 1.0); /* fdim(-5,-6) == 1 */
TESTIT2 (fdim, -6.0, -5.0, 0.0); /* fdim(-6,-5) == 0 */
TESTIT2 (fmin, 5.0, 6.0, 5.0); /* fmin(5,6) == 5 */
TESTIT2 (fmin, 6.0, 5.0, 5.0); /* fmin(6,5) == 5 */
TESTIT2 (fmin, -5.0, -6.0, -6.0); /* fmin(-5,-6) == -6 */