summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/builtins-33.c
diff options
context:
space:
mode:
authorsayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>2004-02-11 23:39:41 +0000
committersayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>2004-02-11 23:39:41 +0000
commitd3cd9bdec0a817502f9f19b48d5fb7699159077c (patch)
tree159c66f75d67ab22ee9d79a474ed9f6f66eab4ba /gcc/testsuite/gcc.dg/builtins-33.c
parent40d28aff0745d807be1d1e07747bc3f32e62ff29 (diff)
downloadgcc-d3cd9bdec0a817502f9f19b48d5fb7699159077c.tar.gz
2004-02-11 Uros Bizjak <uros@kss-loka.si>
* optabs.h (enum optab_index): Add new OTI_log10 and OTI_log2. (log10_optab, log2_optab): Define corresponding macros. * optabs.c (init_optabs): Initialize log10_optab and log2_optab. * genopinit.c (optabs): Implement log10_optab and log2_optab using log10?f2 and log2?f2 patterns. * builtins.c (expand_builtin_mathfn): Handle BUILT_IN_LOG10{,F,L} using log10_optab, and BUILT_IN_LOG2{,F,L} using log2_optab. (expand_builtin): Expand BUILT_IN_LOG10{,F,L} and BUILT_IN_LOG2{,F,L} using expand_builtin_mathfn if flag_unsafe_math_optimizations is set. * config/i386/i386.md (log10sf2, log10df2, log10xf2, log2sf2, log2df2, log2xf2): New patterns to implement log10, log10f, log10l, log2, log2f and log2l built-ins as inline x87 intrinsics. * gcc.dg/builtins-33.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@77675 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/builtins-33.c')
-rw-r--r--gcc/testsuite/gcc.dg/builtins-33.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/builtins-33.c b/gcc/testsuite/gcc.dg/builtins-33.c
new file mode 100644
index 00000000000..758978f0600
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/builtins-33.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 2004 Free Software Foundation.
+
+ Check that log10, log10f, log10l, log2, log2f and log2l
+ built-in functions compile.
+
+ Written by Uros Bizjak, 11th February 2004. */
+
+/* { dg-do compile } */
+/* { dg-options "-O2 -ffast-math" } */
+
+extern double log10(double);
+extern double log2(double);
+extern float log10f(float);
+extern float log2f(float);
+extern long double log10l(long double);
+extern long double log2l(long double);
+
+
+double test1(double x)
+{
+ return log10(x);
+}
+
+double test2(double x)
+{
+ return log2(x);
+}
+
+float test1f(float x)
+{
+ return log10f(x);
+}
+
+float test2f(float x)
+{
+ return log2f(x);
+}
+
+long double test1l(long double x)
+{
+ return log10l(x);
+}
+
+long double test2l(long double x)
+{
+ return log2l(x);
+}
+