summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/builtins-45.c
diff options
context:
space:
mode:
authorbonzini <bonzini@138bc75d-0d04-0410-961f-82ee72b054a4>2004-07-01 08:02:34 +0000
committerbonzini <bonzini@138bc75d-0d04-0410-961f-82ee72b054a4>2004-07-01 08:02:34 +0000
commit726069ba41789438058bc6ce1a5ce2ff21d0868f (patch)
treea36dd2e20b0d8ec8ec87600ce7b3f20a3c5ce3a2 /gcc/testsuite/gcc.dg/builtins-45.c
parent32a2193a17b2653895e7bd6d15944f4e41fb0b9d (diff)
downloadgcc-726069ba41789438058bc6ce1a5ce2ff21d0868f.tar.gz
gcc/ChangeLog:
2004-07-01 Paolo Bonzini <bonzini@gnu.org> * builtins.c (fold_builtin_classify): New. (fold_builtin_unordered_cmp): Fix commentary. (fold_builtin): Use it. * builtins.def: Define builtins for isnan, isnanf, isnanl, finite, finitef, finitel, isinf, isinff, isinfl. gcc/testsuite/ChangeLog: 2004-07-01 Paolo Bonzini <bonzini@gnu.org> * gcc.dg/builtins-43.c: New. * gcc.dg/builtins-44.c: New. * gcc.dg/builtins-45.c: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@83960 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/builtins-45.c')
-rw-r--r--gcc/testsuite/gcc.dg/builtins-45.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/builtins-45.c b/gcc/testsuite/gcc.dg/builtins-45.c
new file mode 100644
index 00000000000..967fba4afe4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/builtins-45.c
@@ -0,0 +1,47 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fno-trapping-math -fdump-tree-optimized" } */
+
+extern void f(int);
+extern void link_error ();
+
+extern float x;
+extern double y;
+extern long double z;
+
+int
+main ()
+{
+ double nan = __builtin_nan ("");
+ float nanf = __builtin_nanf ("");
+ long double nanl = __builtin_nanl ("");
+
+ double pinf = __builtin_inf ();
+ float pinff = __builtin_inff ();
+ long double pinfl = __builtin_infl ();
+
+ if (__builtin_finite (pinf))
+ link_error ();
+ if (__builtin_finitef (pinff))
+ link_error ();
+ if (__builtin_finitel (pinfl))
+ link_error ();
+
+ if (__builtin_finite (nan))
+ link_error ();
+ if (__builtin_finitef (nanf))
+ link_error ();
+ if (__builtin_finitel (nanl))
+ link_error ();
+
+ if (!__builtin_finite (4.0))
+ link_error ();
+ if (!__builtin_finitef (4.0))
+ link_error ();
+ if (!__builtin_finitel (4.0))
+ link_error ();
+}
+
+
+/* Check that all instances of link_error were subject to DCE. */
+/* { dg-final { scan-tree-dump-times "link_error" 0 "optimized" } } */
+