summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/builtins-53.c
diff options
context:
space:
mode:
authoruros <uros@138bc75d-0d04-0410-961f-82ee72b054a4>2005-04-09 05:31:46 +0000
committeruros <uros@138bc75d-0d04-0410-961f-82ee72b054a4>2005-04-09 05:31:46 +0000
commitad52b9b7edd93fef93bc1f3163978a55e4eda546 (patch)
tree03e11f5c02fd01186c4ac1e8629da56190c39031 /gcc/testsuite/gcc.dg/builtins-53.c
parente7911019b785da4b45f6ed37b7b03227afa38661 (diff)
downloadgcc-ad52b9b7edd93fef93bc1f3163978a55e4eda546.tar.gz
* builtins.def (BUILT_IN_LFLOOR, BUILT_IN_LFLOORF, BUILT_IN_LFLOORL)
(BUILT_IN_LLFLOOR, BUILT_IN_LLFLOORF, BUILT_IN_LLFLOORL): New. * optabs.h (enum optab_index): Add new OTI_lfloor. (lfloor_optab): Define corresponding macro. * optabs.c (init_optabs): Initialize lfloor_optab. * genopinit.c (optabs): Implement lfloor_optab using lfloorsi2 and lfloordi2 patterns. * builtins.c (expand_builtin_int_roundingfn): New prototype. (expand_builtin_int_roundingfn): New function. (fold_builtin_int_roundingfn): New prototype. (fold_builtin_int_roundingfn): New function, renamed from fold_builtin_lround. Handle BUILT_IN_LROUND{,F,L}, BUILT_IN_LLROUND{,F,L} and BUILT_IN_LFLOOR{,F,L}, BUILT_IN_LLFLOOR{,F,L}. (fold_builtin_1): Fold BUILT_IN_LFLOOR{,F,L} and BUILT_IN_LLFLOOR{,F,L} using fold_builtin_int_roundingfn. (mathfn_built_in): Handle BUILT_IN LFLOOR and BUILT_IN_LLFLOOR. (expand_builtin): Expand BUILT_IN_LFLOOR{,F,L} and BUILT_IN_LLFLOOR{,F,L} using expand_builtin_int_roundingfn. * convert.c (convert_to_integer): Convert (long int)floor{,f,l}, into lfloor built-in function and (long long int)floor{,f,l} into llfloor built-in function. * fold-const.c (tree_expr_nonnegative_p): Add BUILT_IN_LFLOOR and BUILT_IN_LLFLOOR. testsuite: * gcc.dg/builtins-53.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@97886 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/builtins-53.c')
-rw-r--r--gcc/testsuite/gcc.dg/builtins-53.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/builtins-53.c b/gcc/testsuite/gcc.dg/builtins-53.c
new file mode 100644
index 00000000000..6b1a6f8cb9d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/builtins-53.c
@@ -0,0 +1,45 @@
+/* Copyright (C) 2005 Free Software Foundation.
+
+ Check that (long)floor, (long)floorf, (long)floorl,
+ (long long)floor, (long long)floorf and (long long)floorl
+ built-in functions compile.
+
+ Written by Uros Bizjak, 5th April 2005. */
+
+/* { dg-do compile } */
+/* { dg-options "-O2 -ffast-math" } */
+
+extern double floor(double);
+extern float floorf(float);
+extern long double floorl(long double);
+
+
+long int test1(double x)
+{
+ return floor(x);
+}
+
+long long int test2(double x)
+{
+ return floor(x);
+}
+
+long int test1f(float x)
+{
+ return floorf(x);
+}
+
+long long int test2f(float x)
+{
+ return floorf(x);
+}
+
+long int test1l(long double x)
+{
+ return floorl(x);
+}
+
+long long int test2l(long double x)
+{
+ return floorl(x);
+}