summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/builtins-3.c
diff options
context:
space:
mode:
authorZack Weinberg <zack@gcc.gnu.org>2002-12-16 18:23:00 +0000
committerZack Weinberg <zack@gcc.gnu.org>2002-12-16 18:23:00 +0000
commit4977bab6ed59f01c73f9c8b9e92298706df9b6d5 (patch)
treec259697c448b0c6f548f153c48c46a8d7a75970f /gcc/testsuite/gcc.dg/builtins-3.c
parentb51dc045004ee7eb8d2bf4358ddf22a6cc6c1d00 (diff)
downloadgcc-4977bab6ed59f01c73f9c8b9e92298706df9b6d5.tar.gz
Merge basic-improvements-branch to trunk
From-SVN: r60174
Diffstat (limited to 'gcc/testsuite/gcc.dg/builtins-3.c')
-rw-r--r--gcc/testsuite/gcc.dg/builtins-3.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/builtins-3.c b/gcc/testsuite/gcc.dg/builtins-3.c
new file mode 100644
index 00000000000..49bea5e126e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/builtins-3.c
@@ -0,0 +1,55 @@
+/* Copyright (C) 2002 Free Software Foundation.
+
+ Verify that built-in math function constant folding of constant
+ arguments is correctly performed by the by the compiler.
+
+ Written by Roger Sayle, 16th August 2002. */
+
+/* { dg-do link } */
+/* { dg-options "-O2 -ffast-math" } */
+
+extern void link_error(void);
+
+int main()
+{
+ if (sqrt (0.0) != 0.0)
+ link_error ();
+
+ if (sqrt (1.0) != 1.0)
+ link_error ();
+
+ if (exp (0.0) != 1.0)
+ link_error ();
+
+ if (log (1.0) != 0.0)
+ link_error ();
+
+
+ if (sqrtf (0.0f) != 0.0f)
+ link_error ();
+
+ if (sqrtf (1.0f) != 1.0f)
+ link_error ();
+
+ if (expf (0.0f) != 1.0f)
+ link_error ();
+
+ if (logf (1.0f) != 0.0f)
+ link_error ();
+
+
+ if (sqrtl (0.0l) != 0.0l)
+ link_error ();
+
+ if (sqrtl (1.0l) != 1.0l)
+ link_error ();
+
+ if (expl (0.0l) != 1.0l)
+ link_error ();
+
+ if (logl (1.0l) != 0.0l)
+ link_error ();
+
+ return 0;
+}
+