summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>2007-01-20 00:33:00 +0000
committerghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>2007-01-20 00:33:00 +0000
commit46b3f23721e3ebb750f891559cb13594edc2f3f4 (patch)
treee249678ebbc25e4a25e5298a7a8f98047b509888
parent45e0fd16c544ad87fae20a1578558ef9f482104f (diff)
downloadgcc-46b3f23721e3ebb750f891559cb13594edc2f3f4.tar.gz
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
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/builtins.c7
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.dg/torture/builtin-math-3.c10
4 files changed, 26 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index c4aede67bcb..5a9e553c6c5 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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.
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 82e5a1e7da2..bf57c7bf55e 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 640d3b789ee..e9f9c9f125a 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
diff --git a/gcc/testsuite/gcc.dg/torture/builtin-math-3.c b/gcc/testsuite/gcc.dg/torture/builtin-math-3.c
index 67304f8191e..b347dccbecc 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 */