Commit ea6a6627 by Volker Reichelt Committed by Volker Reichelt

tree.h (CASE_FLT_FN, [...]): New macros.

	* tree.h (CASE_FLT_FN, CASE_INT_FN): New macros.
	* builtins.c (expand_builtin_mathfn): Use them.
	(expand_builtin_mathfn_2): Likewise.
	(expand_builtin_mathfn_3): Likewise.
	(expand_builtin_int_roundingfn): Likewise.
	(expand_builtin): Likewise.
	(integer_valued_real_p): Likewise.
	(fold_builtin_int_roundingfn): Likewise.
	(fold_builtin_bitop): Likewise.
	(fold_builtin_logarithm): Likewise.
	(fold_builtin_1): Likewise.
	* convert.c (convert_to_integer): Likewise.
	* fold-const.c (negate_mathfn_p): Likewise.
	(tree_expr_nonnegative_p): Likewise.

From-SVN: r107733
parent f6173932
2005-11-30 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
* tree.h (CASE_FLT_FN, CASE_INT_FN): New macros.
* builtins.c (expand_builtin_mathfn): Use them.
(expand_builtin_mathfn_2): Likewise.
(expand_builtin_mathfn_3): Likewise.
(expand_builtin_int_roundingfn): Likewise.
(expand_builtin): Likewise.
(integer_valued_real_p): Likewise.
(fold_builtin_int_roundingfn): Likewise.
(fold_builtin_bitop): Likewise.
(fold_builtin_logarithm): Likewise.
(fold_builtin_1): Likewise.
* convert.c (convert_to_integer): Likewise.
* fold-const.c (negate_mathfn_p): Likewise.
(tree_expr_nonnegative_p): Likewise.
2005-11-30 Dale Johannesen <dalej@apple.com> 2005-11-30 Dale Johannesen <dalej@apple.com>
Andrew Pinski <pinskia@physics.uc.edu> Andrew Pinski <pinskia@physics.uc.edu>
......
...@@ -1790,101 +1790,53 @@ expand_builtin_mathfn (tree exp, rtx target, rtx subtarget) ...@@ -1790,101 +1790,53 @@ expand_builtin_mathfn (tree exp, rtx target, rtx subtarget)
switch (DECL_FUNCTION_CODE (fndecl)) switch (DECL_FUNCTION_CODE (fndecl))
{ {
case BUILT_IN_SQRT: CASE_FLT_FN (BUILT_IN_SQRT):
case BUILT_IN_SQRTF:
case BUILT_IN_SQRTL:
errno_set = ! tree_expr_nonnegative_p (arg); errno_set = ! tree_expr_nonnegative_p (arg);
builtin_optab = sqrt_optab; builtin_optab = sqrt_optab;
break; break;
case BUILT_IN_EXP: CASE_FLT_FN (BUILT_IN_EXP):
case BUILT_IN_EXPF:
case BUILT_IN_EXPL:
errno_set = true; builtin_optab = exp_optab; break; errno_set = true; builtin_optab = exp_optab; break;
case BUILT_IN_EXP10: CASE_FLT_FN (BUILT_IN_EXP10):
case BUILT_IN_EXP10F: CASE_FLT_FN (BUILT_IN_POW10):
case BUILT_IN_EXP10L:
case BUILT_IN_POW10:
case BUILT_IN_POW10F:
case BUILT_IN_POW10L:
errno_set = true; builtin_optab = exp10_optab; break; errno_set = true; builtin_optab = exp10_optab; break;
case BUILT_IN_EXP2: CASE_FLT_FN (BUILT_IN_EXP2):
case BUILT_IN_EXP2F:
case BUILT_IN_EXP2L:
errno_set = true; builtin_optab = exp2_optab; break; errno_set = true; builtin_optab = exp2_optab; break;
case BUILT_IN_EXPM1: CASE_FLT_FN (BUILT_IN_EXPM1):
case BUILT_IN_EXPM1F:
case BUILT_IN_EXPM1L:
errno_set = true; builtin_optab = expm1_optab; break; errno_set = true; builtin_optab = expm1_optab; break;
case BUILT_IN_LOGB: CASE_FLT_FN (BUILT_IN_LOGB):
case BUILT_IN_LOGBF:
case BUILT_IN_LOGBL:
errno_set = true; builtin_optab = logb_optab; break; errno_set = true; builtin_optab = logb_optab; break;
case BUILT_IN_ILOGB: CASE_FLT_FN (BUILT_IN_ILOGB):
case BUILT_IN_ILOGBF:
case BUILT_IN_ILOGBL:
errno_set = true; builtin_optab = ilogb_optab; break; errno_set = true; builtin_optab = ilogb_optab; break;
case BUILT_IN_LOG: CASE_FLT_FN (BUILT_IN_LOG):
case BUILT_IN_LOGF:
case BUILT_IN_LOGL:
errno_set = true; builtin_optab = log_optab; break; errno_set = true; builtin_optab = log_optab; break;
case BUILT_IN_LOG10: CASE_FLT_FN (BUILT_IN_LOG10):
case BUILT_IN_LOG10F:
case BUILT_IN_LOG10L:
errno_set = true; builtin_optab = log10_optab; break; errno_set = true; builtin_optab = log10_optab; break;
case BUILT_IN_LOG2: CASE_FLT_FN (BUILT_IN_LOG2):
case BUILT_IN_LOG2F:
case BUILT_IN_LOG2L:
errno_set = true; builtin_optab = log2_optab; break; errno_set = true; builtin_optab = log2_optab; break;
case BUILT_IN_LOG1P: CASE_FLT_FN (BUILT_IN_LOG1P):
case BUILT_IN_LOG1PF:
case BUILT_IN_LOG1PL:
errno_set = true; builtin_optab = log1p_optab; break; errno_set = true; builtin_optab = log1p_optab; break;
case BUILT_IN_ASIN: CASE_FLT_FN (BUILT_IN_ASIN):
case BUILT_IN_ASINF:
case BUILT_IN_ASINL:
builtin_optab = asin_optab; break; builtin_optab = asin_optab; break;
case BUILT_IN_ACOS: CASE_FLT_FN (BUILT_IN_ACOS):
case BUILT_IN_ACOSF:
case BUILT_IN_ACOSL:
builtin_optab = acos_optab; break; builtin_optab = acos_optab; break;
case BUILT_IN_TAN: CASE_FLT_FN (BUILT_IN_TAN):
case BUILT_IN_TANF:
case BUILT_IN_TANL:
builtin_optab = tan_optab; break; builtin_optab = tan_optab; break;
case BUILT_IN_ATAN: CASE_FLT_FN (BUILT_IN_ATAN):
case BUILT_IN_ATANF:
case BUILT_IN_ATANL:
builtin_optab = atan_optab; break; builtin_optab = atan_optab; break;
case BUILT_IN_FLOOR: CASE_FLT_FN (BUILT_IN_FLOOR):
case BUILT_IN_FLOORF:
case BUILT_IN_FLOORL:
builtin_optab = floor_optab; break; builtin_optab = floor_optab; break;
case BUILT_IN_CEIL: CASE_FLT_FN (BUILT_IN_CEIL):
case BUILT_IN_CEILF:
case BUILT_IN_CEILL:
builtin_optab = ceil_optab; break; builtin_optab = ceil_optab; break;
case BUILT_IN_TRUNC: CASE_FLT_FN (BUILT_IN_TRUNC):
case BUILT_IN_TRUNCF:
case BUILT_IN_TRUNCL:
builtin_optab = btrunc_optab; break; builtin_optab = btrunc_optab; break;
case BUILT_IN_ROUND: CASE_FLT_FN (BUILT_IN_ROUND):
case BUILT_IN_ROUNDF:
case BUILT_IN_ROUNDL:
builtin_optab = round_optab; break; builtin_optab = round_optab; break;
case BUILT_IN_NEARBYINT: CASE_FLT_FN (BUILT_IN_NEARBYINT):
case BUILT_IN_NEARBYINTF:
case BUILT_IN_NEARBYINTL:
builtin_optab = nearbyint_optab; break; builtin_optab = nearbyint_optab; break;
case BUILT_IN_RINT: CASE_FLT_FN (BUILT_IN_RINT):
case BUILT_IN_RINTF:
case BUILT_IN_RINTL:
builtin_optab = rint_optab; break; builtin_optab = rint_optab; break;
case BUILT_IN_LRINT: CASE_FLT_FN (BUILT_IN_LRINT):
case BUILT_IN_LRINTF: CASE_FLT_FN (BUILT_IN_LLRINT):
case BUILT_IN_LRINTL:
case BUILT_IN_LLRINT:
case BUILT_IN_LLRINTF:
case BUILT_IN_LLRINTL:
builtin_optab = lrint_optab; break; builtin_optab = lrint_optab; break;
default: default:
gcc_unreachable (); gcc_unreachable ();
...@@ -2017,25 +1969,15 @@ expand_builtin_mathfn_2 (tree exp, rtx target, rtx subtarget) ...@@ -2017,25 +1969,15 @@ expand_builtin_mathfn_2 (tree exp, rtx target, rtx subtarget)
switch (DECL_FUNCTION_CODE (fndecl)) switch (DECL_FUNCTION_CODE (fndecl))
{ {
case BUILT_IN_POW: CASE_FLT_FN (BUILT_IN_POW):
case BUILT_IN_POWF:
case BUILT_IN_POWL:
builtin_optab = pow_optab; break; builtin_optab = pow_optab; break;
case BUILT_IN_ATAN2: CASE_FLT_FN (BUILT_IN_ATAN2):
case BUILT_IN_ATAN2F:
case BUILT_IN_ATAN2L:
builtin_optab = atan2_optab; break; builtin_optab = atan2_optab; break;
case BUILT_IN_LDEXP: CASE_FLT_FN (BUILT_IN_LDEXP):
case BUILT_IN_LDEXPF:
case BUILT_IN_LDEXPL:
builtin_optab = ldexp_optab; break; builtin_optab = ldexp_optab; break;
case BUILT_IN_FMOD: CASE_FLT_FN (BUILT_IN_FMOD):
case BUILT_IN_FMODF:
case BUILT_IN_FMODL:
builtin_optab = fmod_optab; break; builtin_optab = fmod_optab; break;
case BUILT_IN_DREM: CASE_FLT_FN (BUILT_IN_DREM):
case BUILT_IN_DREMF:
case BUILT_IN_DREML:
builtin_optab = drem_optab; break; builtin_optab = drem_optab; break;
default: default:
gcc_unreachable (); gcc_unreachable ();
...@@ -2132,12 +2074,8 @@ expand_builtin_mathfn_3 (tree exp, rtx target, rtx subtarget) ...@@ -2132,12 +2074,8 @@ expand_builtin_mathfn_3 (tree exp, rtx target, rtx subtarget)
switch (DECL_FUNCTION_CODE (fndecl)) switch (DECL_FUNCTION_CODE (fndecl))
{ {
case BUILT_IN_SIN: CASE_FLT_FN (BUILT_IN_SIN):
case BUILT_IN_SINF: CASE_FLT_FN (BUILT_IN_COS):
case BUILT_IN_SINL:
case BUILT_IN_COS:
case BUILT_IN_COSF:
case BUILT_IN_COSL:
builtin_optab = sincos_optab; break; builtin_optab = sincos_optab; break;
default: default:
gcc_unreachable (); gcc_unreachable ();
...@@ -2154,13 +2092,9 @@ expand_builtin_mathfn_3 (tree exp, rtx target, rtx subtarget) ...@@ -2154,13 +2092,9 @@ expand_builtin_mathfn_3 (tree exp, rtx target, rtx subtarget)
if (builtin_optab->handlers[(int) mode].insn_code == CODE_FOR_nothing) { if (builtin_optab->handlers[(int) mode].insn_code == CODE_FOR_nothing) {
switch (DECL_FUNCTION_CODE (fndecl)) switch (DECL_FUNCTION_CODE (fndecl))
{ {
case BUILT_IN_SIN: CASE_FLT_FN (BUILT_IN_SIN):
case BUILT_IN_SINF:
case BUILT_IN_SINL:
builtin_optab = sin_optab; break; builtin_optab = sin_optab; break;
case BUILT_IN_COS: CASE_FLT_FN (BUILT_IN_COS):
case BUILT_IN_COSF:
case BUILT_IN_COSL:
builtin_optab = cos_optab; break; builtin_optab = cos_optab; break;
default: default:
gcc_unreachable (); gcc_unreachable ();
...@@ -2195,14 +2129,10 @@ expand_builtin_mathfn_3 (tree exp, rtx target, rtx subtarget) ...@@ -2195,14 +2129,10 @@ expand_builtin_mathfn_3 (tree exp, rtx target, rtx subtarget)
switch (DECL_FUNCTION_CODE (fndecl)) switch (DECL_FUNCTION_CODE (fndecl))
{ {
case BUILT_IN_SIN: CASE_FLT_FN (BUILT_IN_SIN):
case BUILT_IN_SINF:
case BUILT_IN_SINL:
result = expand_twoval_unop (builtin_optab, op0, 0, target, 0); result = expand_twoval_unop (builtin_optab, op0, 0, target, 0);
break; break;
case BUILT_IN_COS: CASE_FLT_FN (BUILT_IN_COS):
case BUILT_IN_COSF:
case BUILT_IN_COSL:
result = expand_twoval_unop (builtin_optab, op0, target, 0, 0); result = expand_twoval_unop (builtin_optab, op0, target, 0, 0);
break; break;
default: default:
...@@ -2263,22 +2193,14 @@ expand_builtin_int_roundingfn (tree exp, rtx target, rtx subtarget) ...@@ -2263,22 +2193,14 @@ expand_builtin_int_roundingfn (tree exp, rtx target, rtx subtarget)
switch (DECL_FUNCTION_CODE (fndecl)) switch (DECL_FUNCTION_CODE (fndecl))
{ {
case BUILT_IN_LCEIL: CASE_FLT_FN (BUILT_IN_LCEIL):
case BUILT_IN_LCEILF: CASE_FLT_FN (BUILT_IN_LLCEIL):
case BUILT_IN_LCEILL:
case BUILT_IN_LLCEIL:
case BUILT_IN_LLCEILF:
case BUILT_IN_LLCEILL:
builtin_optab = lceil_optab; builtin_optab = lceil_optab;
fallback_fn = BUILT_IN_CEIL; fallback_fn = BUILT_IN_CEIL;
break; break;
case BUILT_IN_LFLOOR: CASE_FLT_FN (BUILT_IN_LFLOOR):
case BUILT_IN_LFLOORF: CASE_FLT_FN (BUILT_IN_LLFLOOR):
case BUILT_IN_LFLOORL:
case BUILT_IN_LLFLOOR:
case BUILT_IN_LLFLOORF:
case BUILT_IN_LLFLOORL:
builtin_optab = lfloor_optab; builtin_optab = lfloor_optab;
fallback_fn = BUILT_IN_FLOOR; fallback_fn = BUILT_IN_FLOOR;
break; break;
...@@ -5638,17 +5560,13 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode, ...@@ -5638,17 +5560,13 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
switch (fcode) switch (fcode)
{ {
case BUILT_IN_FABS: CASE_FLT_FN (BUILT_IN_FABS):
case BUILT_IN_FABSF:
case BUILT_IN_FABSL:
target = expand_builtin_fabs (arglist, target, subtarget); target = expand_builtin_fabs (arglist, target, subtarget);
if (target) if (target)
return target; return target;
break; break;
case BUILT_IN_COPYSIGN: CASE_FLT_FN (BUILT_IN_COPYSIGN):
case BUILT_IN_COPYSIGNF:
case BUILT_IN_COPYSIGNL:
target = expand_builtin_copysign (arglist, target, subtarget); target = expand_builtin_copysign (arglist, target, subtarget);
if (target) if (target)
return target; return target;
...@@ -5656,137 +5574,67 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode, ...@@ -5656,137 +5574,67 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
/* Just do a normal library call if we were unable to fold /* Just do a normal library call if we were unable to fold
the values. */ the values. */
case BUILT_IN_CABS: CASE_FLT_FN (BUILT_IN_CABS):
case BUILT_IN_CABSF: break;
case BUILT_IN_CABSL:
break; CASE_FLT_FN (BUILT_IN_EXP):
CASE_FLT_FN (BUILT_IN_EXP10):
case BUILT_IN_EXP: CASE_FLT_FN (BUILT_IN_POW10):
case BUILT_IN_EXPF: CASE_FLT_FN (BUILT_IN_EXP2):
case BUILT_IN_EXPL: CASE_FLT_FN (BUILT_IN_EXPM1):
case BUILT_IN_EXP10: CASE_FLT_FN (BUILT_IN_LOGB):
case BUILT_IN_EXP10F: CASE_FLT_FN (BUILT_IN_ILOGB):
case BUILT_IN_EXP10L: CASE_FLT_FN (BUILT_IN_LOG):
case BUILT_IN_POW10: CASE_FLT_FN (BUILT_IN_LOG10):
case BUILT_IN_POW10F: CASE_FLT_FN (BUILT_IN_LOG2):
case BUILT_IN_POW10L: CASE_FLT_FN (BUILT_IN_LOG1P):
case BUILT_IN_EXP2: CASE_FLT_FN (BUILT_IN_TAN):
case BUILT_IN_EXP2F: CASE_FLT_FN (BUILT_IN_ASIN):
case BUILT_IN_EXP2L: CASE_FLT_FN (BUILT_IN_ACOS):
case BUILT_IN_EXPM1: CASE_FLT_FN (BUILT_IN_ATAN):
case BUILT_IN_EXPM1F:
case BUILT_IN_EXPM1L:
case BUILT_IN_LOGB:
case BUILT_IN_LOGBF:
case BUILT_IN_LOGBL:
case BUILT_IN_ILOGB:
case BUILT_IN_ILOGBF:
case BUILT_IN_ILOGBL:
case BUILT_IN_LOG:
case BUILT_IN_LOGF:
case BUILT_IN_LOGL:
case BUILT_IN_LOG10:
case BUILT_IN_LOG10F:
case BUILT_IN_LOG10L:
case BUILT_IN_LOG2:
case BUILT_IN_LOG2F:
case BUILT_IN_LOG2L:
case BUILT_IN_LOG1P:
case BUILT_IN_LOG1PF:
case BUILT_IN_LOG1PL:
case BUILT_IN_TAN:
case BUILT_IN_TANF:
case BUILT_IN_TANL:
case BUILT_IN_ASIN:
case BUILT_IN_ASINF:
case BUILT_IN_ASINL:
case BUILT_IN_ACOS:
case BUILT_IN_ACOSF:
case BUILT_IN_ACOSL:
case BUILT_IN_ATAN:
case BUILT_IN_ATANF:
case BUILT_IN_ATANL:
/* Treat these like sqrt only if unsafe math optimizations are allowed, /* Treat these like sqrt only if unsafe math optimizations are allowed,
because of possible accuracy problems. */ because of possible accuracy problems. */
if (! flag_unsafe_math_optimizations) if (! flag_unsafe_math_optimizations)
break; break;
case BUILT_IN_SQRT: CASE_FLT_FN (BUILT_IN_SQRT):
case BUILT_IN_SQRTF: CASE_FLT_FN (BUILT_IN_FLOOR):
case BUILT_IN_SQRTL: CASE_FLT_FN (BUILT_IN_CEIL):
case BUILT_IN_FLOOR: CASE_FLT_FN (BUILT_IN_TRUNC):
case BUILT_IN_FLOORF: CASE_FLT_FN (BUILT_IN_ROUND):
case BUILT_IN_FLOORL: CASE_FLT_FN (BUILT_IN_NEARBYINT):
case BUILT_IN_CEIL: CASE_FLT_FN (BUILT_IN_RINT):
case BUILT_IN_CEILF: CASE_FLT_FN (BUILT_IN_LRINT):
case BUILT_IN_CEILL: CASE_FLT_FN (BUILT_IN_LLRINT):
case BUILT_IN_TRUNC:
case BUILT_IN_TRUNCF:
case BUILT_IN_TRUNCL:
case BUILT_IN_ROUND:
case BUILT_IN_ROUNDF:
case BUILT_IN_ROUNDL:
case BUILT_IN_NEARBYINT:
case BUILT_IN_NEARBYINTF:
case BUILT_IN_NEARBYINTL:
case BUILT_IN_RINT:
case BUILT_IN_RINTF:
case BUILT_IN_RINTL:
case BUILT_IN_LRINT:
case BUILT_IN_LRINTF:
case BUILT_IN_LRINTL:
case BUILT_IN_LLRINT:
case BUILT_IN_LLRINTF:
case BUILT_IN_LLRINTL:
target = expand_builtin_mathfn (exp, target, subtarget); target = expand_builtin_mathfn (exp, target, subtarget);
if (target) if (target)
return target; return target;
break; break;
case BUILT_IN_LCEIL: CASE_FLT_FN (BUILT_IN_LCEIL):
case BUILT_IN_LCEILF: CASE_FLT_FN (BUILT_IN_LLCEIL):
case BUILT_IN_LCEILL: CASE_FLT_FN (BUILT_IN_LFLOOR):
case BUILT_IN_LLCEIL: CASE_FLT_FN (BUILT_IN_LLFLOOR):
case BUILT_IN_LLCEILF:
case BUILT_IN_LLCEILL:
case BUILT_IN_LFLOOR:
case BUILT_IN_LFLOORF:
case BUILT_IN_LFLOORL:
case BUILT_IN_LLFLOOR:
case BUILT_IN_LLFLOORF:
case BUILT_IN_LLFLOORL:
target = expand_builtin_int_roundingfn (exp, target, subtarget); target = expand_builtin_int_roundingfn (exp, target, subtarget);
if (target) if (target)
return target; return target;
break; break;
case BUILT_IN_POW: CASE_FLT_FN (BUILT_IN_POW):
case BUILT_IN_POWF:
case BUILT_IN_POWL:
target = expand_builtin_pow (exp, target, subtarget); target = expand_builtin_pow (exp, target, subtarget);
if (target) if (target)
return target; return target;
break; break;
case BUILT_IN_POWI: CASE_FLT_FN (BUILT_IN_POWI):
case BUILT_IN_POWIF:
case BUILT_IN_POWIL:
target = expand_builtin_powi (exp, target, subtarget); target = expand_builtin_powi (exp, target, subtarget);
if (target) if (target)
return target; return target;
break; break;
case BUILT_IN_ATAN2: CASE_FLT_FN (BUILT_IN_ATAN2):
case BUILT_IN_ATAN2F: CASE_FLT_FN (BUILT_IN_LDEXP):
case BUILT_IN_ATAN2L: CASE_FLT_FN (BUILT_IN_FMOD):
case BUILT_IN_LDEXP: CASE_FLT_FN (BUILT_IN_DREM):
case BUILT_IN_LDEXPF:
case BUILT_IN_LDEXPL:
case BUILT_IN_FMOD:
case BUILT_IN_FMODF:
case BUILT_IN_FMODL:
case BUILT_IN_DREM:
case BUILT_IN_DREMF:
case BUILT_IN_DREML:
if (! flag_unsafe_math_optimizations) if (! flag_unsafe_math_optimizations)
break; break;
target = expand_builtin_mathfn_2 (exp, target, subtarget); target = expand_builtin_mathfn_2 (exp, target, subtarget);
...@@ -5794,12 +5642,8 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode, ...@@ -5794,12 +5642,8 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
return target; return target;
break; break;
case BUILT_IN_SIN: CASE_FLT_FN (BUILT_IN_SIN):
case BUILT_IN_SINF: CASE_FLT_FN (BUILT_IN_COS):
case BUILT_IN_SINL:
case BUILT_IN_COS:
case BUILT_IN_COSF:
case BUILT_IN_COSL:
if (! flag_unsafe_math_optimizations) if (! flag_unsafe_math_optimizations)
break; break;
target = expand_builtin_mathfn_3 (exp, target, subtarget); target = expand_builtin_mathfn_3 (exp, target, subtarget);
...@@ -5892,9 +5736,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode, ...@@ -5892,9 +5736,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
expand_stack_restore (TREE_VALUE (arglist)); expand_stack_restore (TREE_VALUE (arglist));
return const0_rtx; return const0_rtx;
case BUILT_IN_FFS: CASE_INT_FN (BUILT_IN_FFS):
case BUILT_IN_FFSL:
case BUILT_IN_FFSLL:
case BUILT_IN_FFSIMAX: case BUILT_IN_FFSIMAX:
target = expand_builtin_unop (target_mode, arglist, target, target = expand_builtin_unop (target_mode, arglist, target,
subtarget, ffs_optab); subtarget, ffs_optab);
...@@ -5902,9 +5744,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode, ...@@ -5902,9 +5744,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
return target; return target;
break; break;
case BUILT_IN_CLZ: CASE_INT_FN (BUILT_IN_CLZ):
case BUILT_IN_CLZL:
case BUILT_IN_CLZLL:
case BUILT_IN_CLZIMAX: case BUILT_IN_CLZIMAX:
target = expand_builtin_unop (target_mode, arglist, target, target = expand_builtin_unop (target_mode, arglist, target,
subtarget, clz_optab); subtarget, clz_optab);
...@@ -5912,9 +5752,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode, ...@@ -5912,9 +5752,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
return target; return target;
break; break;
case BUILT_IN_CTZ: CASE_INT_FN (BUILT_IN_CTZ):
case BUILT_IN_CTZL:
case BUILT_IN_CTZLL:
case BUILT_IN_CTZIMAX: case BUILT_IN_CTZIMAX:
target = expand_builtin_unop (target_mode, arglist, target, target = expand_builtin_unop (target_mode, arglist, target,
subtarget, ctz_optab); subtarget, ctz_optab);
...@@ -5922,9 +5760,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode, ...@@ -5922,9 +5760,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
return target; return target;
break; break;
case BUILT_IN_POPCOUNT: CASE_INT_FN (BUILT_IN_POPCOUNT):
case BUILT_IN_POPCOUNTL:
case BUILT_IN_POPCOUNTLL:
case BUILT_IN_POPCOUNTIMAX: case BUILT_IN_POPCOUNTIMAX:
target = expand_builtin_unop (target_mode, arglist, target, target = expand_builtin_unop (target_mode, arglist, target,
subtarget, popcount_optab); subtarget, popcount_optab);
...@@ -5932,9 +5768,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode, ...@@ -5932,9 +5768,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
return target; return target;
break; break;
case BUILT_IN_PARITY: CASE_INT_FN (BUILT_IN_PARITY):
case BUILT_IN_PARITYL:
case BUILT_IN_PARITYLL:
case BUILT_IN_PARITYIMAX: case BUILT_IN_PARITYIMAX:
target = expand_builtin_unop (target_mode, arglist, target, target = expand_builtin_unop (target_mode, arglist, target,
subtarget, parity_optab); subtarget, parity_optab);
...@@ -6165,9 +5999,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode, ...@@ -6165,9 +5999,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
return target; return target;
break; break;
case BUILT_IN_SIGNBIT: CASE_FLT_FN (BUILT_IN_SIGNBIT):
case BUILT_IN_SIGNBITF:
case BUILT_IN_SIGNBITL:
target = expand_builtin_signbit (exp, target); target = expand_builtin_signbit (exp, target);
if (target) if (target)
return target; return target;
...@@ -6740,24 +6572,12 @@ integer_valued_real_p (tree t) ...@@ -6740,24 +6572,12 @@ integer_valued_real_p (tree t)
case CALL_EXPR: case CALL_EXPR:
switch (builtin_mathfn_code (t)) switch (builtin_mathfn_code (t))
{ {
case BUILT_IN_CEIL: CASE_FLT_FN (BUILT_IN_CEIL):
case BUILT_IN_CEILF: CASE_FLT_FN (BUILT_IN_FLOOR):
case BUILT_IN_CEILL: CASE_FLT_FN (BUILT_IN_NEARBYINT):
case BUILT_IN_FLOOR: CASE_FLT_FN (BUILT_IN_RINT):
case BUILT_IN_FLOORF: CASE_FLT_FN (BUILT_IN_ROUND):
case BUILT_IN_FLOORL: CASE_FLT_FN (BUILT_IN_TRUNC):
case BUILT_IN_NEARBYINT:
case BUILT_IN_NEARBYINTF:
case BUILT_IN_NEARBYINTL:
case BUILT_IN_RINT:
case BUILT_IN_RINTF:
case BUILT_IN_RINTL:
case BUILT_IN_ROUND:
case BUILT_IN_ROUNDF:
case BUILT_IN_ROUNDL:
case BUILT_IN_TRUNC:
case BUILT_IN_TRUNCF:
case BUILT_IN_TRUNCL:
return true; return true;
default: default:
...@@ -7348,30 +7168,18 @@ fold_builtin_int_roundingfn (tree fndecl, tree arglist) ...@@ -7348,30 +7168,18 @@ fold_builtin_int_roundingfn (tree fndecl, tree arglist)
switch (DECL_FUNCTION_CODE (fndecl)) switch (DECL_FUNCTION_CODE (fndecl))
{ {
case BUILT_IN_LFLOOR: CASE_FLT_FN (BUILT_IN_LFLOOR):
case BUILT_IN_LFLOORF: CASE_FLT_FN (BUILT_IN_LLFLOOR):
case BUILT_IN_LFLOORL:
case BUILT_IN_LLFLOOR:
case BUILT_IN_LLFLOORF:
case BUILT_IN_LLFLOORL:
real_floor (&r, TYPE_MODE (ftype), &x); real_floor (&r, TYPE_MODE (ftype), &x);
break; break;
case BUILT_IN_LCEIL: CASE_FLT_FN (BUILT_IN_LCEIL):
case BUILT_IN_LCEILF: CASE_FLT_FN (BUILT_IN_LLCEIL):
case BUILT_IN_LCEILL:
case BUILT_IN_LLCEIL:
case BUILT_IN_LLCEILF:
case BUILT_IN_LLCEILL:
real_ceil (&r, TYPE_MODE (ftype), &x); real_ceil (&r, TYPE_MODE (ftype), &x);
break; break;
case BUILT_IN_LROUND: CASE_FLT_FN (BUILT_IN_LROUND):
case BUILT_IN_LROUNDF: CASE_FLT_FN (BUILT_IN_LLROUND):
case BUILT_IN_LROUNDL:
case BUILT_IN_LLROUND:
case BUILT_IN_LLROUNDF:
case BUILT_IN_LLROUNDL:
real_round (&r, TYPE_MODE (ftype), &x); real_round (&r, TYPE_MODE (ftype), &x);
break; break;
...@@ -7429,9 +7237,7 @@ fold_builtin_bitop (tree fndecl, tree arglist) ...@@ -7429,9 +7237,7 @@ fold_builtin_bitop (tree fndecl, tree arglist)
switch (DECL_FUNCTION_CODE (fndecl)) switch (DECL_FUNCTION_CODE (fndecl))
{ {
case BUILT_IN_FFS: CASE_INT_FN (BUILT_IN_FFS):
case BUILT_IN_FFSL:
case BUILT_IN_FFSLL:
if (lo != 0) if (lo != 0)
result = exact_log2 (lo & -lo) + 1; result = exact_log2 (lo & -lo) + 1;
else if (hi != 0) else if (hi != 0)
...@@ -7440,9 +7246,7 @@ fold_builtin_bitop (tree fndecl, tree arglist) ...@@ -7440,9 +7246,7 @@ fold_builtin_bitop (tree fndecl, tree arglist)
result = 0; result = 0;
break; break;
case BUILT_IN_CLZ: CASE_INT_FN (BUILT_IN_CLZ):
case BUILT_IN_CLZL:
case BUILT_IN_CLZLL:
if (hi != 0) if (hi != 0)
result = width - floor_log2 (hi) - 1 - HOST_BITS_PER_WIDE_INT; result = width - floor_log2 (hi) - 1 - HOST_BITS_PER_WIDE_INT;
else if (lo != 0) else if (lo != 0)
...@@ -7451,9 +7255,7 @@ fold_builtin_bitop (tree fndecl, tree arglist) ...@@ -7451,9 +7255,7 @@ fold_builtin_bitop (tree fndecl, tree arglist)
result = width; result = width;
break; break;
case BUILT_IN_CTZ: CASE_INT_FN (BUILT_IN_CTZ):
case BUILT_IN_CTZL:
case BUILT_IN_CTZLL:
if (lo != 0) if (lo != 0)
result = exact_log2 (lo & -lo); result = exact_log2 (lo & -lo);
else if (hi != 0) else if (hi != 0)
...@@ -7462,9 +7264,7 @@ fold_builtin_bitop (tree fndecl, tree arglist) ...@@ -7462,9 +7264,7 @@ fold_builtin_bitop (tree fndecl, tree arglist)
result = width; result = width;
break; break;
case BUILT_IN_POPCOUNT: CASE_INT_FN (BUILT_IN_POPCOUNT):
case BUILT_IN_POPCOUNTL:
case BUILT_IN_POPCOUNTLL:
result = 0; result = 0;
while (lo) while (lo)
result++, lo &= lo - 1; result++, lo &= lo - 1;
...@@ -7472,9 +7272,7 @@ fold_builtin_bitop (tree fndecl, tree arglist) ...@@ -7472,9 +7272,7 @@ fold_builtin_bitop (tree fndecl, tree arglist)
result++, hi &= hi - 1; result++, hi &= hi - 1;
break; break;
case BUILT_IN_PARITY: CASE_INT_FN (BUILT_IN_PARITY):
case BUILT_IN_PARITYL:
case BUILT_IN_PARITYLL:
result = 0; result = 0;
while (lo) while (lo)
result++, lo &= lo - 1; result++, lo &= lo - 1;
...@@ -7559,49 +7357,35 @@ fold_builtin_logarithm (tree fndecl, tree arglist, ...@@ -7559,49 +7357,35 @@ fold_builtin_logarithm (tree fndecl, tree arglist,
switch (fcode) switch (fcode)
{ {
case BUILT_IN_EXP: CASE_FLT_FN (BUILT_IN_EXP):
case BUILT_IN_EXPF:
case BUILT_IN_EXPL:
/* Prepare to do logN(exp(exponent) -> exponent*logN(e). */ /* Prepare to do logN(exp(exponent) -> exponent*logN(e). */
x = build_real (type, x = build_real (type,
real_value_truncate (TYPE_MODE (type), dconste)); real_value_truncate (TYPE_MODE (type), dconste));
exponent = TREE_VALUE (TREE_OPERAND (arg, 1)); exponent = TREE_VALUE (TREE_OPERAND (arg, 1));
break; break;
case BUILT_IN_EXP2: CASE_FLT_FN (BUILT_IN_EXP2):
case BUILT_IN_EXP2F:
case BUILT_IN_EXP2L:
/* Prepare to do logN(exp2(exponent) -> exponent*logN(2). */ /* Prepare to do logN(exp2(exponent) -> exponent*logN(2). */
x = build_real (type, dconst2); x = build_real (type, dconst2);
exponent = TREE_VALUE (TREE_OPERAND (arg, 1)); exponent = TREE_VALUE (TREE_OPERAND (arg, 1));
break; break;
case BUILT_IN_EXP10: CASE_FLT_FN (BUILT_IN_EXP10):
case BUILT_IN_EXP10F: CASE_FLT_FN (BUILT_IN_POW10):
case BUILT_IN_EXP10L:
case BUILT_IN_POW10:
case BUILT_IN_POW10F:
case BUILT_IN_POW10L:
/* Prepare to do logN(exp10(exponent) -> exponent*logN(10). */ /* Prepare to do logN(exp10(exponent) -> exponent*logN(10). */
x = build_real (type, dconst10); x = build_real (type, dconst10);
exponent = TREE_VALUE (TREE_OPERAND (arg, 1)); exponent = TREE_VALUE (TREE_OPERAND (arg, 1));
break; break;
case BUILT_IN_SQRT: CASE_FLT_FN (BUILT_IN_SQRT):
case BUILT_IN_SQRTF:
case BUILT_IN_SQRTL:
/* Prepare to do logN(sqrt(x) -> 0.5*logN(x). */ /* Prepare to do logN(sqrt(x) -> 0.5*logN(x). */
x = TREE_VALUE (TREE_OPERAND (arg, 1)); x = TREE_VALUE (TREE_OPERAND (arg, 1));
exponent = build_real (type, dconsthalf); exponent = build_real (type, dconsthalf);
break; break;
case BUILT_IN_CBRT: CASE_FLT_FN (BUILT_IN_CBRT):
case BUILT_IN_CBRTF:
case BUILT_IN_CBRTL:
/* Prepare to do logN(cbrt(x) -> (1/3)*logN(x). */ /* Prepare to do logN(cbrt(x) -> (1/3)*logN(x). */
x = TREE_VALUE (TREE_OPERAND (arg, 1)); x = TREE_VALUE (TREE_OPERAND (arg, 1));
exponent = build_real (type, real_value_truncate (TYPE_MODE (type), exponent = build_real (type, real_value_truncate (TYPE_MODE (type),
dconstthird)); dconstthird));
break; break;
case BUILT_IN_POW: CASE_FLT_FN (BUILT_IN_POW):
case BUILT_IN_POWF:
case BUILT_IN_POWL:
/* Prepare to do logN(pow(x,exponent) -> exponent*logN(x). */ /* Prepare to do logN(pow(x,exponent) -> exponent*logN(x). */
x = TREE_VALUE (TREE_OPERAND (arg, 1)); x = TREE_VALUE (TREE_OPERAND (arg, 1));
exponent = TREE_VALUE (TREE_CHAIN (TREE_OPERAND (arg, 1))); exponent = TREE_VALUE (TREE_CHAIN (TREE_OPERAND (arg, 1)));
...@@ -8736,9 +8520,7 @@ fold_builtin_1 (tree fndecl, tree arglist, bool ignore) ...@@ -8736,9 +8520,7 @@ fold_builtin_1 (tree fndecl, tree arglist, bool ignore)
case BUILT_IN_STRLEN: case BUILT_IN_STRLEN:
return fold_builtin_strlen (arglist); return fold_builtin_strlen (arglist);
case BUILT_IN_FABS: CASE_FLT_FN (BUILT_IN_FABS):
case BUILT_IN_FABSF:
case BUILT_IN_FABSL:
return fold_builtin_fabs (arglist, type); return fold_builtin_fabs (arglist, type);
case BUILT_IN_ABS: case BUILT_IN_ABS:
...@@ -8747,198 +8529,114 @@ fold_builtin_1 (tree fndecl, tree arglist, bool ignore) ...@@ -8747,198 +8529,114 @@ fold_builtin_1 (tree fndecl, tree arglist, bool ignore)
case BUILT_IN_IMAXABS: case BUILT_IN_IMAXABS:
return fold_builtin_abs (arglist, type); return fold_builtin_abs (arglist, type);
case BUILT_IN_CONJ: CASE_FLT_FN (BUILT_IN_CONJ):
case BUILT_IN_CONJF:
case BUILT_IN_CONJL:
if (validate_arglist (arglist, COMPLEX_TYPE, VOID_TYPE)) if (validate_arglist (arglist, COMPLEX_TYPE, VOID_TYPE))
return fold_build1 (CONJ_EXPR, type, TREE_VALUE (arglist)); return fold_build1 (CONJ_EXPR, type, TREE_VALUE (arglist));
break; break;
case BUILT_IN_CREAL: CASE_FLT_FN (BUILT_IN_CREAL):
case BUILT_IN_CREALF:
case BUILT_IN_CREALL:
if (validate_arglist (arglist, COMPLEX_TYPE, VOID_TYPE)) if (validate_arglist (arglist, COMPLEX_TYPE, VOID_TYPE))
return non_lvalue (fold_build1 (REALPART_EXPR, type, return non_lvalue (fold_build1 (REALPART_EXPR, type,
TREE_VALUE (arglist))); TREE_VALUE (arglist)));
break; break;
case BUILT_IN_CIMAG: CASE_FLT_FN (BUILT_IN_CIMAG):
case BUILT_IN_CIMAGF:
case BUILT_IN_CIMAGL:
if (validate_arglist (arglist, COMPLEX_TYPE, VOID_TYPE)) if (validate_arglist (arglist, COMPLEX_TYPE, VOID_TYPE))
return non_lvalue (fold_build1 (IMAGPART_EXPR, type, return non_lvalue (fold_build1 (IMAGPART_EXPR, type,
TREE_VALUE (arglist))); TREE_VALUE (arglist)));
break; break;
case BUILT_IN_CABS: CASE_FLT_FN (BUILT_IN_CABS):
case BUILT_IN_CABSF:
case BUILT_IN_CABSL:
return fold_builtin_cabs (arglist, type); return fold_builtin_cabs (arglist, type);
case BUILT_IN_SQRT: CASE_FLT_FN (BUILT_IN_SQRT):
case BUILT_IN_SQRTF:
case BUILT_IN_SQRTL:
return fold_builtin_sqrt (arglist, type); return fold_builtin_sqrt (arglist, type);
case BUILT_IN_CBRT: CASE_FLT_FN (BUILT_IN_CBRT):
case BUILT_IN_CBRTF:
case BUILT_IN_CBRTL:
return fold_builtin_cbrt (arglist, type); return fold_builtin_cbrt (arglist, type);
case BUILT_IN_SIN: CASE_FLT_FN (BUILT_IN_SIN):
case BUILT_IN_SINF:
case BUILT_IN_SINL:
return fold_builtin_sin (arglist); return fold_builtin_sin (arglist);
case BUILT_IN_COS: CASE_FLT_FN (BUILT_IN_COS):
case BUILT_IN_COSF:
case BUILT_IN_COSL:
return fold_builtin_cos (arglist, type, fndecl); return fold_builtin_cos (arglist, type, fndecl);
case BUILT_IN_EXP: CASE_FLT_FN (BUILT_IN_EXP):
case BUILT_IN_EXPF:
case BUILT_IN_EXPL:
return fold_builtin_exponent (fndecl, arglist, &dconste); return fold_builtin_exponent (fndecl, arglist, &dconste);
case BUILT_IN_EXP2: CASE_FLT_FN (BUILT_IN_EXP2):
case BUILT_IN_EXP2F:
case BUILT_IN_EXP2L:
return fold_builtin_exponent (fndecl, arglist, &dconst2); return fold_builtin_exponent (fndecl, arglist, &dconst2);
case BUILT_IN_EXP10: CASE_FLT_FN (BUILT_IN_EXP10):
case BUILT_IN_EXP10F: CASE_FLT_FN (BUILT_IN_POW10):
case BUILT_IN_EXP10L:
case BUILT_IN_POW10:
case BUILT_IN_POW10F:
case BUILT_IN_POW10L:
return fold_builtin_exponent (fndecl, arglist, &dconst10); return fold_builtin_exponent (fndecl, arglist, &dconst10);
case BUILT_IN_LOG: CASE_FLT_FN (BUILT_IN_LOG):
case BUILT_IN_LOGF:
case BUILT_IN_LOGL:
return fold_builtin_logarithm (fndecl, arglist, &dconste); return fold_builtin_logarithm (fndecl, arglist, &dconste);
case BUILT_IN_LOG2: CASE_FLT_FN (BUILT_IN_LOG2):
case BUILT_IN_LOG2F:
case BUILT_IN_LOG2L:
return fold_builtin_logarithm (fndecl, arglist, &dconst2); return fold_builtin_logarithm (fndecl, arglist, &dconst2);
case BUILT_IN_LOG10: CASE_FLT_FN (BUILT_IN_LOG10):
case BUILT_IN_LOG10F:
case BUILT_IN_LOG10L:
return fold_builtin_logarithm (fndecl, arglist, &dconst10); return fold_builtin_logarithm (fndecl, arglist, &dconst10);
case BUILT_IN_TAN: CASE_FLT_FN (BUILT_IN_TAN):
case BUILT_IN_TANF:
case BUILT_IN_TANL:
return fold_builtin_tan (arglist); return fold_builtin_tan (arglist);
case BUILT_IN_ATAN: CASE_FLT_FN (BUILT_IN_ATAN):
case BUILT_IN_ATANF:
case BUILT_IN_ATANL:
return fold_builtin_atan (arglist, type); return fold_builtin_atan (arglist, type);
case BUILT_IN_POW: CASE_FLT_FN (BUILT_IN_POW):
case BUILT_IN_POWF:
case BUILT_IN_POWL:
return fold_builtin_pow (fndecl, arglist, type); return fold_builtin_pow (fndecl, arglist, type);
case BUILT_IN_POWI: CASE_FLT_FN (BUILT_IN_POWI):
case BUILT_IN_POWIF:
case BUILT_IN_POWIL:
return fold_builtin_powi (fndecl, arglist, type); return fold_builtin_powi (fndecl, arglist, type);
case BUILT_IN_INF: CASE_FLT_FN (BUILT_IN_INF):
case BUILT_IN_INFF:
case BUILT_IN_INFL:
return fold_builtin_inf (type, true); return fold_builtin_inf (type, true);
case BUILT_IN_HUGE_VAL: CASE_FLT_FN (BUILT_IN_HUGE_VAL):
case BUILT_IN_HUGE_VALF:
case BUILT_IN_HUGE_VALL:
return fold_builtin_inf (type, false); return fold_builtin_inf (type, false);
case BUILT_IN_NAN: CASE_FLT_FN (BUILT_IN_NAN):
case BUILT_IN_NANF:
case BUILT_IN_NANL:
return fold_builtin_nan (arglist, type, true); return fold_builtin_nan (arglist, type, true);
case BUILT_IN_NANS: CASE_FLT_FN (BUILT_IN_NANS):
case BUILT_IN_NANSF:
case BUILT_IN_NANSL:
return fold_builtin_nan (arglist, type, false); return fold_builtin_nan (arglist, type, false);
case BUILT_IN_FLOOR: CASE_FLT_FN (BUILT_IN_FLOOR):
case BUILT_IN_FLOORF:
case BUILT_IN_FLOORL:
return fold_builtin_floor (fndecl, arglist); return fold_builtin_floor (fndecl, arglist);
case BUILT_IN_CEIL: CASE_FLT_FN (BUILT_IN_CEIL):
case BUILT_IN_CEILF:
case BUILT_IN_CEILL:
return fold_builtin_ceil (fndecl, arglist); return fold_builtin_ceil (fndecl, arglist);
case BUILT_IN_TRUNC: CASE_FLT_FN (BUILT_IN_TRUNC):
case BUILT_IN_TRUNCF:
case BUILT_IN_TRUNCL:
return fold_builtin_trunc (fndecl, arglist); return fold_builtin_trunc (fndecl, arglist);
case BUILT_IN_ROUND: CASE_FLT_FN (BUILT_IN_ROUND):
case BUILT_IN_ROUNDF:
case BUILT_IN_ROUNDL:
return fold_builtin_round (fndecl, arglist); return fold_builtin_round (fndecl, arglist);
case BUILT_IN_NEARBYINT: CASE_FLT_FN (BUILT_IN_NEARBYINT):
case BUILT_IN_NEARBYINTF: CASE_FLT_FN (BUILT_IN_RINT):
case BUILT_IN_NEARBYINTL:
case BUILT_IN_RINT:
case BUILT_IN_RINTF:
case BUILT_IN_RINTL:
return fold_trunc_transparent_mathfn (fndecl, arglist); return fold_trunc_transparent_mathfn (fndecl, arglist);
case BUILT_IN_LCEIL: CASE_FLT_FN (BUILT_IN_LCEIL):
case BUILT_IN_LCEILF: CASE_FLT_FN (BUILT_IN_LLCEIL):
case BUILT_IN_LCEILL: CASE_FLT_FN (BUILT_IN_LFLOOR):
case BUILT_IN_LLCEIL: CASE_FLT_FN (BUILT_IN_LLFLOOR):
case BUILT_IN_LLCEILF: CASE_FLT_FN (BUILT_IN_LROUND):
case BUILT_IN_LLCEILL: CASE_FLT_FN (BUILT_IN_LLROUND):
case BUILT_IN_LFLOOR:
case BUILT_IN_LFLOORF:
case BUILT_IN_LFLOORL:
case BUILT_IN_LLFLOOR:
case BUILT_IN_LLFLOORF:
case BUILT_IN_LLFLOORL:
case BUILT_IN_LROUND:
case BUILT_IN_LROUNDF:
case BUILT_IN_LROUNDL:
case BUILT_IN_LLROUND:
case BUILT_IN_LLROUNDF:
case BUILT_IN_LLROUNDL:
return fold_builtin_int_roundingfn (fndecl, arglist); return fold_builtin_int_roundingfn (fndecl, arglist);
case BUILT_IN_LRINT: CASE_FLT_FN (BUILT_IN_LRINT):
case BUILT_IN_LRINTF: CASE_FLT_FN (BUILT_IN_LLRINT):
case BUILT_IN_LRINTL:
case BUILT_IN_LLRINT:
case BUILT_IN_LLRINTF:
case BUILT_IN_LLRINTL:
return fold_fixed_mathfn (fndecl, arglist); return fold_fixed_mathfn (fndecl, arglist);
case BUILT_IN_FFS: CASE_INT_FN (BUILT_IN_FFS):
case BUILT_IN_FFSL: CASE_INT_FN (BUILT_IN_CLZ):
case BUILT_IN_FFSLL: CASE_INT_FN (BUILT_IN_CTZ):
case BUILT_IN_CLZ: CASE_INT_FN (BUILT_IN_POPCOUNT):
case BUILT_IN_CLZL: CASE_INT_FN (BUILT_IN_PARITY):
case BUILT_IN_CLZLL:
case BUILT_IN_CTZ:
case BUILT_IN_CTZL:
case BUILT_IN_CTZLL:
case BUILT_IN_POPCOUNT:
case BUILT_IN_POPCOUNTL:
case BUILT_IN_POPCOUNTLL:
case BUILT_IN_PARITY:
case BUILT_IN_PARITYL:
case BUILT_IN_PARITYLL:
return fold_builtin_bitop (fndecl, arglist); return fold_builtin_bitop (fndecl, arglist);
case BUILT_IN_MEMCPY: case BUILT_IN_MEMCPY:
...@@ -8950,9 +8648,7 @@ fold_builtin_1 (tree fndecl, tree arglist, bool ignore) ...@@ -8950,9 +8648,7 @@ fold_builtin_1 (tree fndecl, tree arglist, bool ignore)
case BUILT_IN_MEMMOVE: case BUILT_IN_MEMMOVE:
return fold_builtin_memmove (arglist, type); return fold_builtin_memmove (arglist, type);
case BUILT_IN_SIGNBIT: CASE_FLT_FN (BUILT_IN_SIGNBIT):
case BUILT_IN_SIGNBITF:
case BUILT_IN_SIGNBITL:
return fold_builtin_signbit (fndecl, arglist); return fold_builtin_signbit (fndecl, arglist);
case BUILT_IN_ISASCII: case BUILT_IN_ISASCII:
...@@ -8964,24 +8660,16 @@ fold_builtin_1 (tree fndecl, tree arglist, bool ignore) ...@@ -8964,24 +8660,16 @@ fold_builtin_1 (tree fndecl, tree arglist, bool ignore)
case BUILT_IN_ISDIGIT: case BUILT_IN_ISDIGIT:
return fold_builtin_isdigit (arglist); return fold_builtin_isdigit (arglist);
case BUILT_IN_COPYSIGN: CASE_FLT_FN (BUILT_IN_COPYSIGN):
case BUILT_IN_COPYSIGNF:
case BUILT_IN_COPYSIGNL:
return fold_builtin_copysign (fndecl, arglist, type); return fold_builtin_copysign (fndecl, arglist, type);
case BUILT_IN_FINITE: CASE_FLT_FN (BUILT_IN_FINITE):
case BUILT_IN_FINITEF:
case BUILT_IN_FINITEL:
return fold_builtin_classify (fndecl, arglist, BUILT_IN_FINITE); return fold_builtin_classify (fndecl, arglist, BUILT_IN_FINITE);
case BUILT_IN_ISINF: CASE_FLT_FN (BUILT_IN_ISINF):
case BUILT_IN_ISINFF:
case BUILT_IN_ISINFL:
return fold_builtin_classify (fndecl, arglist, BUILT_IN_ISINF); return fold_builtin_classify (fndecl, arglist, BUILT_IN_ISINF);
case BUILT_IN_ISNAN: CASE_FLT_FN (BUILT_IN_ISNAN):
case BUILT_IN_ISNANF:
case BUILT_IN_ISNANL:
return fold_builtin_classify (fndecl, arglist, BUILT_IN_ISNAN); return fold_builtin_classify (fndecl, arglist, BUILT_IN_ISNAN);
case BUILT_IN_ISGREATER: case BUILT_IN_ISGREATER:
......
...@@ -351,7 +351,7 @@ convert_to_integer (tree type, tree expr) ...@@ -351,7 +351,7 @@ convert_to_integer (tree type, tree expr)
switch (fcode) switch (fcode)
{ {
case BUILT_IN_CEIL: case BUILT_IN_CEILF: case BUILT_IN_CEILL: CASE_FLT_FN (BUILT_IN_CEIL):
/* Only convert in ISO C99 mode. */ /* Only convert in ISO C99 mode. */
if (!TARGET_C99_FUNCTIONS) if (!TARGET_C99_FUNCTIONS)
break; break;
...@@ -361,7 +361,7 @@ convert_to_integer (tree type, tree expr) ...@@ -361,7 +361,7 @@ convert_to_integer (tree type, tree expr)
fn = mathfn_built_in (s_intype, BUILT_IN_LCEIL); fn = mathfn_built_in (s_intype, BUILT_IN_LCEIL);
break; break;
case BUILT_IN_FLOOR: case BUILT_IN_FLOORF: case BUILT_IN_FLOORL: CASE_FLT_FN (BUILT_IN_FLOOR):
/* Only convert in ISO C99 mode. */ /* Only convert in ISO C99 mode. */
if (!TARGET_C99_FUNCTIONS) if (!TARGET_C99_FUNCTIONS)
break; break;
...@@ -371,26 +371,26 @@ convert_to_integer (tree type, tree expr) ...@@ -371,26 +371,26 @@ convert_to_integer (tree type, tree expr)
fn = mathfn_built_in (s_intype, BUILT_IN_LFLOOR); fn = mathfn_built_in (s_intype, BUILT_IN_LFLOOR);
break; break;
case BUILT_IN_ROUND: case BUILT_IN_ROUNDF: case BUILT_IN_ROUNDL: CASE_FLT_FN (BUILT_IN_ROUND):
if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (long_long_integer_type_node)) if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (long_long_integer_type_node))
fn = mathfn_built_in (s_intype, BUILT_IN_LLROUND); fn = mathfn_built_in (s_intype, BUILT_IN_LLROUND);
else else
fn = mathfn_built_in (s_intype, BUILT_IN_LROUND); fn = mathfn_built_in (s_intype, BUILT_IN_LROUND);
break; break;
case BUILT_IN_RINT: case BUILT_IN_RINTF: case BUILT_IN_RINTL: CASE_FLT_FN (BUILT_IN_RINT):
/* Only convert rint* if we can ignore math exceptions. */ /* Only convert rint* if we can ignore math exceptions. */
if (flag_trapping_math) if (flag_trapping_math)
break; break;
/* ... Fall through ... */ /* ... Fall through ... */
case BUILT_IN_NEARBYINT: case BUILT_IN_NEARBYINTF: case BUILT_IN_NEARBYINTL: CASE_FLT_FN (BUILT_IN_NEARBYINT):
if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (long_long_integer_type_node)) if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (long_long_integer_type_node))
fn = mathfn_built_in (s_intype, BUILT_IN_LLRINT); fn = mathfn_built_in (s_intype, BUILT_IN_LLRINT);
else else
fn = mathfn_built_in (s_intype, BUILT_IN_LRINT); fn = mathfn_built_in (s_intype, BUILT_IN_LRINT);
break; break;
case BUILT_IN_TRUNC: case BUILT_IN_TRUNCF: case BUILT_IN_TRUNCL: CASE_FLT_FN (BUILT_IN_TRUNC):
{ {
tree arglist = TREE_OPERAND (s_expr, 1); tree arglist = TREE_OPERAND (s_expr, 1);
return convert_to_integer (type, TREE_VALUE (arglist)); return convert_to_integer (type, TREE_VALUE (arglist));
......
...@@ -865,33 +865,15 @@ negate_mathfn_p (enum built_in_function code) ...@@ -865,33 +865,15 @@ negate_mathfn_p (enum built_in_function code)
{ {
switch (code) switch (code)
{ {
case BUILT_IN_ASIN: CASE_FLT_FN (BUILT_IN_ASIN):
case BUILT_IN_ASINF: CASE_FLT_FN (BUILT_IN_ASINH):
case BUILT_IN_ASINL: CASE_FLT_FN (BUILT_IN_ATAN):
case BUILT_IN_ASINH: CASE_FLT_FN (BUILT_IN_ATANH):
case BUILT_IN_ASINHF: CASE_FLT_FN (BUILT_IN_CBRT):
case BUILT_IN_ASINHL: CASE_FLT_FN (BUILT_IN_SIN):
case BUILT_IN_ATAN: CASE_FLT_FN (BUILT_IN_SINH):
case BUILT_IN_ATANF: CASE_FLT_FN (BUILT_IN_TAN):
case BUILT_IN_ATANL: CASE_FLT_FN (BUILT_IN_TANH):
case BUILT_IN_ATANH:
case BUILT_IN_ATANHF:
case BUILT_IN_ATANHL:
case BUILT_IN_CBRT:
case BUILT_IN_CBRTF:
case BUILT_IN_CBRTL:
case BUILT_IN_SIN:
case BUILT_IN_SINF:
case BUILT_IN_SINL:
case BUILT_IN_SINH:
case BUILT_IN_SINHF:
case BUILT_IN_SINHL:
case BUILT_IN_TAN:
case BUILT_IN_TANF:
case BUILT_IN_TANL:
case BUILT_IN_TANH:
case BUILT_IN_TANHF:
case BUILT_IN_TANHL:
return true; return true;
default: default:
...@@ -11075,84 +11057,77 @@ tree_expr_nonnegative_p (tree t) ...@@ -11075,84 +11057,77 @@ tree_expr_nonnegative_p (tree t)
if (fndecl && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL) if (fndecl && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL)
switch (DECL_FUNCTION_CODE (fndecl)) switch (DECL_FUNCTION_CODE (fndecl))
{ {
#define CASE_BUILTIN_F(BUILT_IN_FN) \ CASE_FLT_FN (BUILT_IN_ACOS):
case BUILT_IN_FN: case BUILT_IN_FN##F: case BUILT_IN_FN##L: CASE_FLT_FN (BUILT_IN_ACOSH):
#define CASE_BUILTIN_I(BUILT_IN_FN) \ CASE_FLT_FN (BUILT_IN_CABS):
case BUILT_IN_FN: case BUILT_IN_FN##L: case BUILT_IN_FN##LL: CASE_FLT_FN (BUILT_IN_COSH):
CASE_FLT_FN (BUILT_IN_ERFC):
CASE_BUILTIN_F (BUILT_IN_ACOS) CASE_FLT_FN (BUILT_IN_EXP):
CASE_BUILTIN_F (BUILT_IN_ACOSH) CASE_FLT_FN (BUILT_IN_EXP10):
CASE_BUILTIN_F (BUILT_IN_CABS) CASE_FLT_FN (BUILT_IN_EXP2):
CASE_BUILTIN_F (BUILT_IN_COSH) CASE_FLT_FN (BUILT_IN_FABS):
CASE_BUILTIN_F (BUILT_IN_ERFC) CASE_FLT_FN (BUILT_IN_FDIM):
CASE_BUILTIN_F (BUILT_IN_EXP) CASE_FLT_FN (BUILT_IN_HYPOT):
CASE_BUILTIN_F (BUILT_IN_EXP10) CASE_FLT_FN (BUILT_IN_POW10):
CASE_BUILTIN_F (BUILT_IN_EXP2) CASE_INT_FN (BUILT_IN_FFS):
CASE_BUILTIN_F (BUILT_IN_FABS) CASE_INT_FN (BUILT_IN_PARITY):
CASE_BUILTIN_F (BUILT_IN_FDIM) CASE_INT_FN (BUILT_IN_POPCOUNT):
CASE_BUILTIN_F (BUILT_IN_HYPOT)
CASE_BUILTIN_F (BUILT_IN_POW10)
CASE_BUILTIN_I (BUILT_IN_FFS)
CASE_BUILTIN_I (BUILT_IN_PARITY)
CASE_BUILTIN_I (BUILT_IN_POPCOUNT)
/* Always true. */ /* Always true. */
return 1; return 1;
CASE_BUILTIN_F (BUILT_IN_SQRT) CASE_FLT_FN (BUILT_IN_SQRT):
/* sqrt(-0.0) is -0.0. */ /* sqrt(-0.0) is -0.0. */
if (!HONOR_SIGNED_ZEROS (TYPE_MODE (TREE_TYPE (t)))) if (!HONOR_SIGNED_ZEROS (TYPE_MODE (TREE_TYPE (t))))
return 1; return 1;
return tree_expr_nonnegative_p (TREE_VALUE (arglist)); return tree_expr_nonnegative_p (TREE_VALUE (arglist));
CASE_BUILTIN_F (BUILT_IN_ASINH) CASE_FLT_FN (BUILT_IN_ASINH):
CASE_BUILTIN_F (BUILT_IN_ATAN) CASE_FLT_FN (BUILT_IN_ATAN):
CASE_BUILTIN_F (BUILT_IN_ATANH) CASE_FLT_FN (BUILT_IN_ATANH):
CASE_BUILTIN_F (BUILT_IN_CBRT) CASE_FLT_FN (BUILT_IN_CBRT):
CASE_BUILTIN_F (BUILT_IN_CEIL) CASE_FLT_FN (BUILT_IN_CEIL):
CASE_BUILTIN_F (BUILT_IN_ERF) CASE_FLT_FN (BUILT_IN_ERF):
CASE_BUILTIN_F (BUILT_IN_EXPM1) CASE_FLT_FN (BUILT_IN_EXPM1):
CASE_BUILTIN_F (BUILT_IN_FLOOR) CASE_FLT_FN (BUILT_IN_FLOOR):
CASE_BUILTIN_F (BUILT_IN_FMOD) CASE_FLT_FN (BUILT_IN_FMOD):
CASE_BUILTIN_F (BUILT_IN_FREXP) CASE_FLT_FN (BUILT_IN_FREXP):
CASE_BUILTIN_F (BUILT_IN_LCEIL) CASE_FLT_FN (BUILT_IN_LCEIL):
CASE_BUILTIN_F (BUILT_IN_LDEXP) CASE_FLT_FN (BUILT_IN_LDEXP):
CASE_BUILTIN_F (BUILT_IN_LFLOOR) CASE_FLT_FN (BUILT_IN_LFLOOR):
CASE_BUILTIN_F (BUILT_IN_LLCEIL) CASE_FLT_FN (BUILT_IN_LLCEIL):
CASE_BUILTIN_F (BUILT_IN_LLFLOOR) CASE_FLT_FN (BUILT_IN_LLFLOOR):
CASE_BUILTIN_F (BUILT_IN_LLRINT) CASE_FLT_FN (BUILT_IN_LLRINT):
CASE_BUILTIN_F (BUILT_IN_LLROUND) CASE_FLT_FN (BUILT_IN_LLROUND):
CASE_BUILTIN_F (BUILT_IN_LRINT) CASE_FLT_FN (BUILT_IN_LRINT):
CASE_BUILTIN_F (BUILT_IN_LROUND) CASE_FLT_FN (BUILT_IN_LROUND):
CASE_BUILTIN_F (BUILT_IN_MODF) CASE_FLT_FN (BUILT_IN_MODF):
CASE_BUILTIN_F (BUILT_IN_NEARBYINT) CASE_FLT_FN (BUILT_IN_NEARBYINT):
CASE_BUILTIN_F (BUILT_IN_POW) CASE_FLT_FN (BUILT_IN_POW):
CASE_BUILTIN_F (BUILT_IN_RINT) CASE_FLT_FN (BUILT_IN_RINT):
CASE_BUILTIN_F (BUILT_IN_ROUND) CASE_FLT_FN (BUILT_IN_ROUND):
CASE_BUILTIN_F (BUILT_IN_SIGNBIT) CASE_FLT_FN (BUILT_IN_SIGNBIT):
CASE_BUILTIN_F (BUILT_IN_SINH) CASE_FLT_FN (BUILT_IN_SINH):
CASE_BUILTIN_F (BUILT_IN_TANH) CASE_FLT_FN (BUILT_IN_TANH):
CASE_BUILTIN_F (BUILT_IN_TRUNC) CASE_FLT_FN (BUILT_IN_TRUNC):
/* True if the 1st argument is nonnegative. */ /* True if the 1st argument is nonnegative. */
return tree_expr_nonnegative_p (TREE_VALUE (arglist)); return tree_expr_nonnegative_p (TREE_VALUE (arglist));
CASE_BUILTIN_F (BUILT_IN_FMAX) CASE_FLT_FN (BUILT_IN_FMAX):
/* True if the 1st OR 2nd arguments are nonnegative. */ /* True if the 1st OR 2nd arguments are nonnegative. */
return tree_expr_nonnegative_p (TREE_VALUE (arglist)) return tree_expr_nonnegative_p (TREE_VALUE (arglist))
|| tree_expr_nonnegative_p (TREE_VALUE (TREE_CHAIN (arglist))); || tree_expr_nonnegative_p (TREE_VALUE (TREE_CHAIN (arglist)));
CASE_BUILTIN_F (BUILT_IN_FMIN) CASE_FLT_FN (BUILT_IN_FMIN):
/* True if the 1st AND 2nd arguments are nonnegative. */ /* True if the 1st AND 2nd arguments are nonnegative. */
return tree_expr_nonnegative_p (TREE_VALUE (arglist)) return tree_expr_nonnegative_p (TREE_VALUE (arglist))
&& tree_expr_nonnegative_p (TREE_VALUE (TREE_CHAIN (arglist))); && tree_expr_nonnegative_p (TREE_VALUE (TREE_CHAIN (arglist)));
CASE_BUILTIN_F (BUILT_IN_COPYSIGN) CASE_FLT_FN (BUILT_IN_COPYSIGN):
/* True if the 2nd argument is nonnegative. */ /* True if the 2nd argument is nonnegative. */
return tree_expr_nonnegative_p (TREE_VALUE (TREE_CHAIN (arglist))); return tree_expr_nonnegative_p (TREE_VALUE (TREE_CHAIN (arglist)));
default: default:
break; break;
#undef CASE_BUILTIN_F
#undef CASE_BUILTIN_I
} }
} }
......
...@@ -234,6 +234,9 @@ extern const char * built_in_names[(int) END_BUILTINS]; ...@@ -234,6 +234,9 @@ extern const char * built_in_names[(int) END_BUILTINS];
#define BUILTIN_ROOT_P(FN) (BUILTIN_SQRT_P (FN) || BUILTIN_CBRT_P (FN)) #define BUILTIN_ROOT_P(FN) (BUILTIN_SQRT_P (FN) || BUILTIN_CBRT_P (FN))
#define CASE_FLT_FN(FN) case FN: case FN##F: case FN##L
#define CASE_INT_FN(FN) case FN: case FN##L: case FN##LL
/* An array of _DECL trees for the above. */ /* An array of _DECL trees for the above. */
extern GTY(()) tree built_in_decls[(int) END_BUILTINS]; extern GTY(()) tree built_in_decls[(int) END_BUILTINS];
extern GTY(()) tree implicit_built_in_decls[(int) END_BUILTINS]; extern GTY(()) tree implicit_built_in_decls[(int) END_BUILTINS];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment