aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/builtins-67.c
diff options
context:
space:
mode:
authorUros Bizjak <ubizjak@gmail.com>2011-08-12 14:32:41 +0200
committerUros Bizjak <uros@gcc.gnu.org>2011-08-12 14:32:41 +0200
commit6c32ee74491f947dafdce3656c6ec9e48a185fdb (patch)
treecd499a40f57a9bb51448aec4aefe1d8a6decc748 /gcc/testsuite/gcc.dg/builtins-67.c
parentd9fbc86e446fd574db0d79c3af8d0bd2b1cdc820 (diff)
downloadgcc-6c32ee74491f947dafdce3656c6ec9e48a185fdb.zip
gcc-6c32ee74491f947dafdce3656c6ec9e48a185fdb.tar.gz
gcc-6c32ee74491f947dafdce3656c6ec9e48a185fdb.tar.bz2
builtins.def (BUILT_IN_ICEIL{,F,L}, [...]): New builtin definitions.
* builtins.def (BUILT_IN_ICEIL{,F,L}, BUILT_IN_IFLOOR{,F,L} BUILT_IN_IRINT{,F,L}, BUILT_IN_IROUND{,F,L}: New builtin definitions. * convert.c (convert_to_integer): Convert to BUILT_IN_ICEIL, BUILT_IN_IFLOOR, BUILT_IN_IRINT or BUILT_INT_IROUND when converting to integer_type_node. * fold-const.c (tree_call_nonnegative_warnv_p): Handle BUILT_IN_ICEIL, BUILT_IN_IFLOOR, BUILT_IN_IRINT and BUILT_INT_IROUND. * builtins.c (expand_builtin_in): Ditto. (mathfn_built_in_1): Ditto. (expand_builtin_int_roundingfn): Handle BUILT_IN_ICEIL and BUILT_IN_IFLOOR. (expand_builtin_int_roundingfn_2): Handle BUILT_IN_IRINT and BUILT_IN_IROUND. (fold_fixed_mathfn): Canonicalize BUILT_IN_ICEIL, BUILTIN_IN_IFLOOR BUILT_IN_IRINT and BUILT_IN_IROUND to BUILT_IN_LCEIL, BUILTIN_IN_LFLOOR, BUILT_IN_LRINT and BUILT_IN_LROUND on ILP32 targets. testsuite/ChangeLog: * gcc.dg/builtins-67.c: New test. * gcc.target/i386/conversion.c: Ditto. From-SVN: r177694
Diffstat (limited to 'gcc/testsuite/gcc.dg/builtins-67.c')
-rw-r--r--gcc/testsuite/gcc.dg/builtins-67.c72
1 files changed, 72 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/builtins-67.c b/gcc/testsuite/gcc.dg/builtins-67.c
new file mode 100644
index 0000000..0863955
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/builtins-67.c
@@ -0,0 +1,72 @@
+/* Check that conversion functions link correctly with -ffast-math. */
+
+/* { dg-do link } */
+/* { dg-options "-ffast-math -lm" } */
+
+#include "builtins-config.h"
+
+double floor (double);
+float floorf (float);
+long double floorl (long double);
+
+double ceil (double);
+float ceilf (float);
+long double ceill (long double);
+
+double round (double);
+float roundf (float);
+long double roundl (long double);
+
+double rint (double);
+float rintf (float);
+long double rintl (long double);
+
+int ifloor (double a) { return (int) floor (a); }
+#ifdef HAVE_C99_RUNTIME
+int ifloorf (float a) { return (int) floorf (a); }
+int ifloorl (long double a) { return (int) floorl (a); }
+#endif
+
+long lfloor (double a) { return (long) floor (a); }
+#ifdef HAVE_C99_RUNTIME
+long lfloorf (float a) { return (long) floorf (a); }
+long lfloorl (long double a) { return (long) floorl (a); }
+#endif
+
+long long llfloor (double a) { return (long long) floor (a); }
+#ifdef HAVE_C99_RUNTIME
+long long llfloorf (float a) { return (long long) floorf (a); }
+long long llfloorl (long double a) { return (long long) floorl (a); }
+#endif
+
+int iceil (double a) { return (int) ceil (a); }
+#ifdef HAVE_C99_RUNTIME
+int iceilf (float a) { return (int) ceilf (a); }
+int iceill (long double a) { return (int) ceill (a); }
+#endif
+
+long lceil (double a) { return (long) ceil (a); }
+#ifdef HAVE_C99_RUNTIME
+long lceilf (float a) { return (long) ceilf (a); }
+long lceill (long double a) { return (long) ceill (a); }
+#endif
+
+long long llceil (double a) { return (long long) ceil (a); }
+#ifdef HAVE_C99_RUNTIME
+long long llceilf (float a) { return (long long) ceilf (a); }
+long long llceill (long double a) { return (long long) ceill (a); }
+#endif
+
+int iround (double a) { return (int) round (a); }
+#ifdef HAVE_C99_RUNTIME
+int iroundf (float a) { return (int) roundf (a); }
+int iroundl (long double a) { return (int) roundl (a); }
+#endif
+
+int irint (double a) { return (int) rint (a); }
+#ifdef HAVE_C99_RUNTIME
+int irintf (float a) { return (int) rintf (a); }
+int irintl (long double a) { return (int) rintl (a); }
+#endif
+
+int main () { return 0; }