This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH]: Handle pow10 like exp10 optab
- From: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 11 Mar 2004 21:14:05 -0500 (EST)
- Subject: [PATCH]: Handle pow10 like exp10 optab
When the exp2 and exp10 optab entries were added, we should have
handled pow10 like exp10. The patch below fixes this omission.
I don't have access to an x86 box, so I tested the change by building
a cross-compiler to i686-unknown-linux-gnu and compiled (-S) the
testcase with and without the builtins.c hunk. I visually verified
that pow10 gets a function call with a clean src tree and with my
patch it gets expanded inline just like exp10 does.
Ok for mainline?
Thanks,
--Kaveh
2004-03-11 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* builtins.c (expand_builtin_mathfn): Add pow10* to the
existing exp10* case.
(expand_builtin): Likewise.
testsuite:
* gcc.dg/builtins-34.c: Also check pow10*.
diff -rup orig/egcc-CVS20040310/gcc/builtins.c egcc-CVS20040310/gcc/builtins.c
--- orig/egcc-CVS20040310/gcc/builtins.c Wed Mar 10 20:02:07 2004
+++ egcc-CVS20040310/gcc/builtins.c Thu Mar 11 19:59:44 2004
@@ -1632,6 +1632,9 @@ expand_builtin_mathfn (tree exp, rtx tar
case BUILT_IN_EXP10:
case BUILT_IN_EXP10F:
case BUILT_IN_EXP10L:
+ case BUILT_IN_POW10:
+ case BUILT_IN_POW10F:
+ case BUILT_IN_POW10L:
errno_set = true; builtin_optab = exp10_optab; break;
case BUILT_IN_EXP2:
case BUILT_IN_EXP2F:
@@ -5130,6 +5133,9 @@ expand_builtin (tree exp, rtx target, rt
case BUILT_IN_LOG2:
case BUILT_IN_LOG2F:
case BUILT_IN_LOG2L:
+ case BUILT_IN_POW10:
+ case BUILT_IN_POW10F:
+ case BUILT_IN_POW10L:
case BUILT_IN_TAN:
case BUILT_IN_TANF:
case BUILT_IN_TANL:
diff -rup orig/egcc-CVS20040310/gcc/testsuite/gcc.dg/builtins-34.c egcc-CVS20040310/gcc/testsuite/gcc.dg/builtins-34.c
--- orig/egcc-CVS20040310/gcc/testsuite/gcc.dg/builtins-34.c Wed Mar 10 17:36:22 2004
+++ egcc-CVS20040310/gcc/testsuite/gcc.dg/builtins-34.c Thu Mar 11 20:02:25 2004
@@ -1,7 +1,7 @@
/* Copyright (C) 2004 Free Software Foundation.
- Check that exp10, exp10f, exp10l, exp2, exp2f and exp2l
- built-in functions compile.
+ Check that exp10, exp10f, exp10l, exp2, exp2f, exp2l, pow10, pow10f
+ and pow10l built-in functions compile.
Written by Uros Bizjak, 13th February 2004. */
@@ -10,10 +10,13 @@
extern double exp10(double);
extern double exp2(double);
+extern double pow10(double);
extern float exp10f(float);
extern float exp2f(float);
+extern float pow10f(float);
extern long double exp10l(long double);
extern long double exp2l(long double);
+extern long double pow10l(long double);
double test1(double x)
@@ -26,6 +29,11 @@ double test2(double x)
return exp2(x);
}
+double test3(double x)
+{
+ return pow10(x);
+}
+
float test1f(float x)
{
return exp10f(x);
@@ -36,6 +44,11 @@ float test2f(float x)
return exp2f(x);
}
+float test3f(float x)
+{
+ return pow10f(x);
+}
+
long double test1l(long double x)
{
return exp10l(x);
@@ -44,5 +57,10 @@ long double test1l(long double x)
long double test2l(long double x)
{
return exp2l(x);
+}
+
+long double test3l(long double x)
+{
+ return pow10l(x);
}