From: ghazi Date: Sat, 20 Jan 2007 00:33:00 +0000 (+0000) Subject: PR middle-end/29335 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=46b3f23721e3ebb750f891559cb13594edc2f3f4;p=thirdparty%2Fgcc.git PR middle-end/29335 * builtins.c (fold_builtin_1): Handle builtin fdim. testsuite: * gcc.dg/torture/builtin-math-3.c: Test fdim. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@120993 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c4aede67bcbe..5a9e553c6c57 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2007-01-19 Kaveh R. Ghazi + + PR middle-end/29335 + * builtins.c (fold_builtin_1): Handle builtin fdim. + 2007-01-20 Jan Hubicka * tree-ssa.c (init_tree_ssa): Do not call init_alias_heapvars. diff --git a/gcc/builtins.c b/gcc/builtins.c index 82e5a1e7da20..bf57c7bf55e0 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -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), diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 640d3b789ee6..e9f9c9f125aa 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2007-01-19 Kaveh R. Ghazi + + * gcc.dg/torture/builtin-math-3.c: Test fdim. + 2007-01-19 Mike Stump * gcc.dg/darwin-ld-6.c: Remove, tests a linker flag that is going diff --git a/gcc/testsuite/gcc.dg/torture/builtin-math-3.c b/gcc/testsuite/gcc.dg/torture/builtin-math-3.c index 67304f8191e5..b347dccbecc3 100644 --- a/gcc/testsuite/gcc.dg/torture/builtin-math-3.c +++ b/gcc/testsuite/gcc.dg/torture/builtin-math-3.c @@ -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 */