This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH]: add more builtins to convert.c:convert_to_real()


This patch adds several more builtins to convert.c:convert_to_real()
and the respective testcase.  All of the added functions take exactly
one FP argument and return one FP value.

Bootstrapped on sparc-sun-solaris2.7, no regressions.  To test a c99
target, I also built clean & patched cross-compilers to
i686-unknown-linux-gnu and compiled the testcase.  Then I made sure
that with the patched cross, all function calls were eliminated in the
resulting .s file.  (Whereas the unpatched cross-compiler failed to
eliminate the new functions.)

Ok for mainline?

		Thanks,
		--Kaveh


2004-03-18  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* convert.c (convert_to_real): Add more math builtins.
	
testsuite:
	* gcc.dg/torture/builtin-convert-1.c: Test more math builtins.

diff -rup orig/egcc-CVS20040317/gcc/convert.c egcc-CVS20040317/gcc/convert.c
--- orig/egcc-CVS20040317/gcc/convert.c	2004-03-17 17:57:43.182572530 -0500
+++ egcc-CVS20040317/gcc/convert.c	2004-03-17 18:01:58.891473860 -0500
@@ -137,11 +137,40 @@ convert_to_real (tree type, tree expr)
       switch (fcode)
         {
 #define CASE_MATHFN(FN) case BUILT_IN_##FN: case BUILT_IN_##FN##L:
-	  CASE_MATHFN (SQRT)
-	  CASE_MATHFN (SIN)
+	  CASE_MATHFN (ACOS)
+	  CASE_MATHFN (ACOSH)
+	  CASE_MATHFN (ASIN)
+	  CASE_MATHFN (ASINH)
+	  CASE_MATHFN (ATAN)
+	  CASE_MATHFN (ATANH)
+	  CASE_MATHFN (CBRT)
 	  CASE_MATHFN (COS)
+	  CASE_MATHFN (COSH)
+	  CASE_MATHFN (ERF)
+	  CASE_MATHFN (ERFC)
 	  CASE_MATHFN (EXP)
+	  CASE_MATHFN (EXP10)
+	  CASE_MATHFN (EXP2)
+	  CASE_MATHFN (EXPM1)
+	  CASE_MATHFN (FABS)
+	  CASE_MATHFN (GAMMA)
+	  CASE_MATHFN (J0)
+	  CASE_MATHFN (J1)
+	  CASE_MATHFN (LGAMMA)
 	  CASE_MATHFN (LOG)
+	  CASE_MATHFN (LOG10)
+	  CASE_MATHFN (LOG1P)
+	  CASE_MATHFN (LOG2)
+	  CASE_MATHFN (LOGB)
+	  CASE_MATHFN (POW10)
+	  CASE_MATHFN (SIN)
+	  CASE_MATHFN (SINH)
+	  CASE_MATHFN (SQRT)
+	  CASE_MATHFN (TAN)
+	  CASE_MATHFN (TANH)
+	  CASE_MATHFN (TGAMMA)
+	  CASE_MATHFN (Y0)
+	  CASE_MATHFN (Y1)
 #undef CASE_MATHFN
 	    {
 	      tree arg0 = strip_float_extensions (TREE_VALUE (TREE_OPERAND (expr, 1)));
diff -rup orig/egcc-CVS20040317/gcc/testsuite/gcc.dg/torture/builtin-convert-1.c egcc-CVS20040317/gcc/testsuite/gcc.dg/torture/builtin-convert-1.c
--- orig/egcc-CVS20040317/gcc/testsuite/gcc.dg/torture/builtin-convert-1.c	2004-03-17 12:53:20.000000000 -0500
+++ egcc-CVS20040317/gcc/testsuite/gcc.dg/torture/builtin-convert-1.c	2004-03-17 19:48:50.362675667 -0500
@@ -89,11 +89,33 @@ void test(double d1, float f1, long doub
 
 
 #ifdef __OPTIMIZE__
+  OUTER_CAST1 (acos, /*C99=*/ 0);
+  OUTER_CAST1 (acosh, /*C99=*/ 1);
+  OUTER_CAST1 (asin, /*C99=*/ 1);
+  OUTER_CAST1 (asinh, /*C99=*/ 1);
+  OUTER_CAST1 (atan, /*C99=*/ 0);
+  OUTER_CAST1 (atanh, /*C99=*/ 1);
+  OUTER_CAST1 (cbrt, /*C99=*/ 1);
   OUTER_CAST1 (cos, /*C99=*/ 0);
+  OUTER_CAST1 (cosh, /*C99=*/ 0);
+  OUTER_CAST1 (erf, /*C99=*/ 1);
+  OUTER_CAST1 (erfc, /*C99=*/ 1);
   OUTER_CAST1 (exp, /*C99=*/ 0);
+  OUTER_CAST1 (exp2, /*C99=*/ 1);
+  OUTER_CAST1 (expm1, /*C99=*/ 1);
+  OUTER_CAST1 (fabs, /*C99=*/ 0);
+  OUTER_CAST1 (lgamma, /*C99=*/ 1);
   OUTER_CAST1 (log, /*C99=*/ 0);
+  OUTER_CAST1 (log10, /*C99=*/ 0);
+  OUTER_CAST1 (log1p, /*C99=*/ 1);
+  OUTER_CAST1 (log2, /*C99=*/ 1);
+  OUTER_CAST1 (logb, /*C99=*/ 1);
   OUTER_CAST1 (sin, /*C99=*/ 0);
+  OUTER_CAST1 (sinh, /*C99=*/ 0);
   OUTER_CAST1 (sqrt, /*C99=*/ 0);
+  OUTER_CAST1 (tan, /*C99=*/ 0);
+  OUTER_CAST1 (tanh, /*C99=*/ 0);
+  OUTER_CAST1 (tgamma, /*C99=*/ 1);
 
   INNER_CAST1 (ceil, /*C99=*/ 0);
   OUTER_CAST1 (ceil, /*C99=*/ 0);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]