convert.c (convert_to_real): Add more math builtins.

* convert.c (convert_to_real): Add more math builtins.

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

From-SVN: r79668
This commit is contained in:
Kaveh R. Ghazi 2004-03-19 03:21:47 +00:00 committed by Kaveh Ghazi
parent b381036092
commit 1fb7e3af5b
4 changed files with 61 additions and 2 deletions

View File

@ -1,3 +1,7 @@
2004-03-18 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* convert.c (convert_to_real): Add more math builtins.
2004-03-18 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* convert.c (convert_to_real): Reformat using switch stmt.

View File

@ -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)));

View File

@ -1,3 +1,7 @@
2004-03-18 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* gcc.dg/torture/builtin-convert-1.c: Test more math builtins.
2004-03-18 Mark Mitchell <mark@codesourcery.com>
* g++.dg/expr/cond5.C: New test.

View File

@ -89,11 +89,33 @@ void test(double d1, float f1, long double ld1)
#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);