diff options
author | Volker Reichelt <reichelt@igpm.rwth-aachen.de> | 2005-11-30 19:59:50 +0000 |
---|---|---|
committer | Volker Reichelt <reichelt@gcc.gnu.org> | 2005-11-30 19:59:50 +0000 |
commit | ea6a66274744eba7f56f982909b08dbe0ef293c2 (patch) | |
tree | a25bfbbd8528680ac1478ddb93a3ef85fed8d6c9 /gcc/builtins.c | |
parent | f6173932d327c20b74dd73676deae86aafed35a8 (diff) | |
download | gcc-ea6a66274744eba7f56f982909b08dbe0ef293c2.zip gcc-ea6a66274744eba7f56f982909b08dbe0ef293c2.tar.gz gcc-ea6a66274744eba7f56f982909b08dbe0ef293c2.tar.bz2 |
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
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r-- | gcc/builtins.c | 624 |
1 files changed, 156 insertions, 468 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c index 2f7b23a..aff2499 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -1790,101 +1790,53 @@ expand_builtin_mathfn (tree exp, rtx target, rtx subtarget) switch (DECL_FUNCTION_CODE (fndecl)) { - case BUILT_IN_SQRT: - case BUILT_IN_SQRTF: - case BUILT_IN_SQRTL: + CASE_FLT_FN (BUILT_IN_SQRT): errno_set = ! tree_expr_nonnegative_p (arg); builtin_optab = sqrt_optab; break; - case BUILT_IN_EXP: - case BUILT_IN_EXPF: - case BUILT_IN_EXPL: + CASE_FLT_FN (BUILT_IN_EXP): errno_set = true; builtin_optab = exp_optab; break; - case BUILT_IN_EXP10: - case BUILT_IN_EXP10F: - case BUILT_IN_EXP10L: - case BUILT_IN_POW10: - case BUILT_IN_POW10F: - case BUILT_IN_POW10L: + CASE_FLT_FN (BUILT_IN_EXP10): + CASE_FLT_FN (BUILT_IN_POW10): errno_set = true; builtin_optab = exp10_optab; break; - case BUILT_IN_EXP2: - case BUILT_IN_EXP2F: - case BUILT_IN_EXP2L: + CASE_FLT_FN (BUILT_IN_EXP2): errno_set = true; builtin_optab = exp2_optab; break; - case BUILT_IN_EXPM1: - case BUILT_IN_EXPM1F: - case BUILT_IN_EXPM1L: + CASE_FLT_FN (BUILT_IN_EXPM1): errno_set = true; builtin_optab = expm1_optab; break; - case BUILT_IN_LOGB: - case BUILT_IN_LOGBF: - case BUILT_IN_LOGBL: + CASE_FLT_FN (BUILT_IN_LOGB): errno_set = true; builtin_optab = logb_optab; break; - case BUILT_IN_ILOGB: - case BUILT_IN_ILOGBF: - case BUILT_IN_ILOGBL: + CASE_FLT_FN (BUILT_IN_ILOGB): errno_set = true; builtin_optab = ilogb_optab; break; - case BUILT_IN_LOG: - case BUILT_IN_LOGF: - case BUILT_IN_LOGL: + CASE_FLT_FN (BUILT_IN_LOG): errno_set = true; builtin_optab = log_optab; break; - case BUILT_IN_LOG10: - case BUILT_IN_LOG10F: - case BUILT_IN_LOG10L: + CASE_FLT_FN (BUILT_IN_LOG10): errno_set = true; builtin_optab = log10_optab; break; - case BUILT_IN_LOG2: - case BUILT_IN_LOG2F: - case BUILT_IN_LOG2L: + CASE_FLT_FN (BUILT_IN_LOG2): errno_set = true; builtin_optab = log2_optab; break; - case BUILT_IN_LOG1P: - case BUILT_IN_LOG1PF: - case BUILT_IN_LOG1PL: + CASE_FLT_FN (BUILT_IN_LOG1P): errno_set = true; builtin_optab = log1p_optab; break; - case BUILT_IN_ASIN: - case BUILT_IN_ASINF: - case BUILT_IN_ASINL: + CASE_FLT_FN (BUILT_IN_ASIN): builtin_optab = asin_optab; break; - case BUILT_IN_ACOS: - case BUILT_IN_ACOSF: - case BUILT_IN_ACOSL: + CASE_FLT_FN (BUILT_IN_ACOS): builtin_optab = acos_optab; break; - case BUILT_IN_TAN: - case BUILT_IN_TANF: - case BUILT_IN_TANL: + CASE_FLT_FN (BUILT_IN_TAN): builtin_optab = tan_optab; break; - case BUILT_IN_ATAN: - case BUILT_IN_ATANF: - case BUILT_IN_ATANL: + CASE_FLT_FN (BUILT_IN_ATAN): builtin_optab = atan_optab; break; - case BUILT_IN_FLOOR: - case BUILT_IN_FLOORF: - case BUILT_IN_FLOORL: + CASE_FLT_FN (BUILT_IN_FLOOR): builtin_optab = floor_optab; break; - case BUILT_IN_CEIL: - case BUILT_IN_CEILF: - case BUILT_IN_CEILL: + CASE_FLT_FN (BUILT_IN_CEIL): builtin_optab = ceil_optab; break; - case BUILT_IN_TRUNC: - case BUILT_IN_TRUNCF: - case BUILT_IN_TRUNCL: + CASE_FLT_FN (BUILT_IN_TRUNC): builtin_optab = btrunc_optab; break; - case BUILT_IN_ROUND: - case BUILT_IN_ROUNDF: - case BUILT_IN_ROUNDL: + CASE_FLT_FN (BUILT_IN_ROUND): builtin_optab = round_optab; break; - case BUILT_IN_NEARBYINT: - case BUILT_IN_NEARBYINTF: - case BUILT_IN_NEARBYINTL: + CASE_FLT_FN (BUILT_IN_NEARBYINT): builtin_optab = nearbyint_optab; break; - case BUILT_IN_RINT: - case BUILT_IN_RINTF: - case BUILT_IN_RINTL: + CASE_FLT_FN (BUILT_IN_RINT): builtin_optab = rint_optab; break; - case BUILT_IN_LRINT: - case BUILT_IN_LRINTF: - case BUILT_IN_LRINTL: - case BUILT_IN_LLRINT: - case BUILT_IN_LLRINTF: - case BUILT_IN_LLRINTL: + CASE_FLT_FN (BUILT_IN_LRINT): + CASE_FLT_FN (BUILT_IN_LLRINT): builtin_optab = lrint_optab; break; default: gcc_unreachable (); @@ -2017,25 +1969,15 @@ expand_builtin_mathfn_2 (tree exp, rtx target, rtx subtarget) switch (DECL_FUNCTION_CODE (fndecl)) { - case BUILT_IN_POW: - case BUILT_IN_POWF: - case BUILT_IN_POWL: + CASE_FLT_FN (BUILT_IN_POW): builtin_optab = pow_optab; break; - case BUILT_IN_ATAN2: - case BUILT_IN_ATAN2F: - case BUILT_IN_ATAN2L: + CASE_FLT_FN (BUILT_IN_ATAN2): builtin_optab = atan2_optab; break; - case BUILT_IN_LDEXP: - case BUILT_IN_LDEXPF: - case BUILT_IN_LDEXPL: + CASE_FLT_FN (BUILT_IN_LDEXP): builtin_optab = ldexp_optab; break; - case BUILT_IN_FMOD: - case BUILT_IN_FMODF: - case BUILT_IN_FMODL: + CASE_FLT_FN (BUILT_IN_FMOD): builtin_optab = fmod_optab; break; - case BUILT_IN_DREM: - case BUILT_IN_DREMF: - case BUILT_IN_DREML: + CASE_FLT_FN (BUILT_IN_DREM): builtin_optab = drem_optab; break; default: gcc_unreachable (); @@ -2132,12 +2074,8 @@ expand_builtin_mathfn_3 (tree exp, rtx target, rtx subtarget) switch (DECL_FUNCTION_CODE (fndecl)) { - case BUILT_IN_SIN: - case BUILT_IN_SINF: - case BUILT_IN_SINL: - case BUILT_IN_COS: - case BUILT_IN_COSF: - case BUILT_IN_COSL: + CASE_FLT_FN (BUILT_IN_SIN): + CASE_FLT_FN (BUILT_IN_COS): builtin_optab = sincos_optab; break; default: gcc_unreachable (); @@ -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) { switch (DECL_FUNCTION_CODE (fndecl)) { - case BUILT_IN_SIN: - case BUILT_IN_SINF: - case BUILT_IN_SINL: + CASE_FLT_FN (BUILT_IN_SIN): builtin_optab = sin_optab; break; - case BUILT_IN_COS: - case BUILT_IN_COSF: - case BUILT_IN_COSL: + CASE_FLT_FN (BUILT_IN_COS): builtin_optab = cos_optab; break; default: gcc_unreachable (); @@ -2195,14 +2129,10 @@ expand_builtin_mathfn_3 (tree exp, rtx target, rtx subtarget) switch (DECL_FUNCTION_CODE (fndecl)) { - case BUILT_IN_SIN: - case BUILT_IN_SINF: - case BUILT_IN_SINL: + CASE_FLT_FN (BUILT_IN_SIN): result = expand_twoval_unop (builtin_optab, op0, 0, target, 0); break; - case BUILT_IN_COS: - case BUILT_IN_COSF: - case BUILT_IN_COSL: + CASE_FLT_FN (BUILT_IN_COS): result = expand_twoval_unop (builtin_optab, op0, target, 0, 0); break; default: @@ -2263,22 +2193,14 @@ expand_builtin_int_roundingfn (tree exp, rtx target, rtx subtarget) switch (DECL_FUNCTION_CODE (fndecl)) { - case BUILT_IN_LCEIL: - case BUILT_IN_LCEILF: - case BUILT_IN_LCEILL: - case BUILT_IN_LLCEIL: - case BUILT_IN_LLCEILF: - case BUILT_IN_LLCEILL: + CASE_FLT_FN (BUILT_IN_LCEIL): + CASE_FLT_FN (BUILT_IN_LLCEIL): builtin_optab = lceil_optab; fallback_fn = BUILT_IN_CEIL; break; - 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_FLT_FN (BUILT_IN_LFLOOR): + CASE_FLT_FN (BUILT_IN_LLFLOOR): builtin_optab = lfloor_optab; fallback_fn = BUILT_IN_FLOOR; break; @@ -5638,17 +5560,13 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode, switch (fcode) { - case BUILT_IN_FABS: - case BUILT_IN_FABSF: - case BUILT_IN_FABSL: + CASE_FLT_FN (BUILT_IN_FABS): target = expand_builtin_fabs (arglist, target, subtarget); if (target) return target; break; - case BUILT_IN_COPYSIGN: - case BUILT_IN_COPYSIGNF: - case BUILT_IN_COPYSIGNL: + CASE_FLT_FN (BUILT_IN_COPYSIGN): target = expand_builtin_copysign (arglist, target, subtarget); if (target) return target; @@ -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 the values. */ - case BUILT_IN_CABS: - case BUILT_IN_CABSF: - case BUILT_IN_CABSL: + CASE_FLT_FN (BUILT_IN_CABS): break; - case BUILT_IN_EXP: - case BUILT_IN_EXPF: - case BUILT_IN_EXPL: - case BUILT_IN_EXP10: - case BUILT_IN_EXP10F: - case BUILT_IN_EXP10L: - case BUILT_IN_POW10: - case BUILT_IN_POW10F: - case BUILT_IN_POW10L: - case BUILT_IN_EXP2: - case BUILT_IN_EXP2F: - case BUILT_IN_EXP2L: - case BUILT_IN_EXPM1: - 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: + CASE_FLT_FN (BUILT_IN_EXP): + CASE_FLT_FN (BUILT_IN_EXP10): + CASE_FLT_FN (BUILT_IN_POW10): + CASE_FLT_FN (BUILT_IN_EXP2): + CASE_FLT_FN (BUILT_IN_EXPM1): + CASE_FLT_FN (BUILT_IN_LOGB): + CASE_FLT_FN (BUILT_IN_ILOGB): + CASE_FLT_FN (BUILT_IN_LOG): + CASE_FLT_FN (BUILT_IN_LOG10): + CASE_FLT_FN (BUILT_IN_LOG2): + CASE_FLT_FN (BUILT_IN_LOG1P): + CASE_FLT_FN (BUILT_IN_TAN): + CASE_FLT_FN (BUILT_IN_ASIN): + CASE_FLT_FN (BUILT_IN_ACOS): + CASE_FLT_FN (BUILT_IN_ATAN): /* Treat these like sqrt only if unsafe math optimizations are allowed, because of possible accuracy problems. */ if (! flag_unsafe_math_optimizations) break; - case BUILT_IN_SQRT: - case BUILT_IN_SQRTF: - case BUILT_IN_SQRTL: - case BUILT_IN_FLOOR: - case BUILT_IN_FLOORF: - case BUILT_IN_FLOORL: - case BUILT_IN_CEIL: - case BUILT_IN_CEILF: - case BUILT_IN_CEILL: - 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: + CASE_FLT_FN (BUILT_IN_SQRT): + CASE_FLT_FN (BUILT_IN_FLOOR): + CASE_FLT_FN (BUILT_IN_CEIL): + CASE_FLT_FN (BUILT_IN_TRUNC): + CASE_FLT_FN (BUILT_IN_ROUND): + CASE_FLT_FN (BUILT_IN_NEARBYINT): + CASE_FLT_FN (BUILT_IN_RINT): + CASE_FLT_FN (BUILT_IN_LRINT): + CASE_FLT_FN (BUILT_IN_LLRINT): target = expand_builtin_mathfn (exp, target, subtarget); if (target) return target; break; - case BUILT_IN_LCEIL: - case BUILT_IN_LCEILF: - case BUILT_IN_LCEILL: - case BUILT_IN_LLCEIL: - 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: + CASE_FLT_FN (BUILT_IN_LCEIL): + CASE_FLT_FN (BUILT_IN_LLCEIL): + CASE_FLT_FN (BUILT_IN_LFLOOR): + CASE_FLT_FN (BUILT_IN_LLFLOOR): target = expand_builtin_int_roundingfn (exp, target, subtarget); if (target) return target; break; - case BUILT_IN_POW: - case BUILT_IN_POWF: - case BUILT_IN_POWL: + CASE_FLT_FN (BUILT_IN_POW): target = expand_builtin_pow (exp, target, subtarget); if (target) return target; break; - case BUILT_IN_POWI: - case BUILT_IN_POWIF: - case BUILT_IN_POWIL: + CASE_FLT_FN (BUILT_IN_POWI): target = expand_builtin_powi (exp, target, subtarget); if (target) return target; break; - case BUILT_IN_ATAN2: - case BUILT_IN_ATAN2F: - case BUILT_IN_ATAN2L: - case BUILT_IN_LDEXP: - 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: + CASE_FLT_FN (BUILT_IN_ATAN2): + CASE_FLT_FN (BUILT_IN_LDEXP): + CASE_FLT_FN (BUILT_IN_FMOD): + CASE_FLT_FN (BUILT_IN_DREM): if (! flag_unsafe_math_optimizations) break; target = expand_builtin_mathfn_2 (exp, target, subtarget); @@ -5794,12 +5642,8 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode, return target; break; - case BUILT_IN_SIN: - case BUILT_IN_SINF: - case BUILT_IN_SINL: - case BUILT_IN_COS: - case BUILT_IN_COSF: - case BUILT_IN_COSL: + CASE_FLT_FN (BUILT_IN_SIN): + CASE_FLT_FN (BUILT_IN_COS): if (! flag_unsafe_math_optimizations) break; target = expand_builtin_mathfn_3 (exp, target, subtarget); @@ -5892,9 +5736,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode, expand_stack_restore (TREE_VALUE (arglist)); return const0_rtx; - case BUILT_IN_FFS: - case BUILT_IN_FFSL: - case BUILT_IN_FFSLL: + CASE_INT_FN (BUILT_IN_FFS): case BUILT_IN_FFSIMAX: target = expand_builtin_unop (target_mode, arglist, target, subtarget, ffs_optab); @@ -5902,9 +5744,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode, return target; break; - case BUILT_IN_CLZ: - case BUILT_IN_CLZL: - case BUILT_IN_CLZLL: + CASE_INT_FN (BUILT_IN_CLZ): case BUILT_IN_CLZIMAX: target = expand_builtin_unop (target_mode, arglist, target, subtarget, clz_optab); @@ -5912,9 +5752,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode, return target; break; - case BUILT_IN_CTZ: - case BUILT_IN_CTZL: - case BUILT_IN_CTZLL: + CASE_INT_FN (BUILT_IN_CTZ): case BUILT_IN_CTZIMAX: target = expand_builtin_unop (target_mode, arglist, target, subtarget, ctz_optab); @@ -5922,9 +5760,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode, return target; break; - case BUILT_IN_POPCOUNT: - case BUILT_IN_POPCOUNTL: - case BUILT_IN_POPCOUNTLL: + CASE_INT_FN (BUILT_IN_POPCOUNT): case BUILT_IN_POPCOUNTIMAX: target = expand_builtin_unop (target_mode, arglist, target, subtarget, popcount_optab); @@ -5932,9 +5768,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode, return target; break; - case BUILT_IN_PARITY: - case BUILT_IN_PARITYL: - case BUILT_IN_PARITYLL: + CASE_INT_FN (BUILT_IN_PARITY): case BUILT_IN_PARITYIMAX: target = expand_builtin_unop (target_mode, arglist, target, subtarget, parity_optab); @@ -6165,9 +5999,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode, return target; break; - case BUILT_IN_SIGNBIT: - case BUILT_IN_SIGNBITF: - case BUILT_IN_SIGNBITL: + CASE_FLT_FN (BUILT_IN_SIGNBIT): target = expand_builtin_signbit (exp, target); if (target) return target; @@ -6740,24 +6572,12 @@ integer_valued_real_p (tree t) case CALL_EXPR: switch (builtin_mathfn_code (t)) { - case BUILT_IN_CEIL: - case BUILT_IN_CEILF: - case BUILT_IN_CEILL: - case BUILT_IN_FLOOR: - case BUILT_IN_FLOORF: - case BUILT_IN_FLOORL: - 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: + CASE_FLT_FN (BUILT_IN_CEIL): + CASE_FLT_FN (BUILT_IN_FLOOR): + CASE_FLT_FN (BUILT_IN_NEARBYINT): + CASE_FLT_FN (BUILT_IN_RINT): + CASE_FLT_FN (BUILT_IN_ROUND): + CASE_FLT_FN (BUILT_IN_TRUNC): return true; default: @@ -7348,30 +7168,18 @@ fold_builtin_int_roundingfn (tree fndecl, tree arglist) switch (DECL_FUNCTION_CODE (fndecl)) { - 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_FLT_FN (BUILT_IN_LFLOOR): + CASE_FLT_FN (BUILT_IN_LLFLOOR): real_floor (&r, TYPE_MODE (ftype), &x); break; - case BUILT_IN_LCEIL: - case BUILT_IN_LCEILF: - case BUILT_IN_LCEILL: - case BUILT_IN_LLCEIL: - case BUILT_IN_LLCEILF: - case BUILT_IN_LLCEILL: + CASE_FLT_FN (BUILT_IN_LCEIL): + CASE_FLT_FN (BUILT_IN_LLCEIL): real_ceil (&r, TYPE_MODE (ftype), &x); break; - case BUILT_IN_LROUND: - case BUILT_IN_LROUNDF: - case BUILT_IN_LROUNDL: - case BUILT_IN_LLROUND: - case BUILT_IN_LLROUNDF: - case BUILT_IN_LLROUNDL: + CASE_FLT_FN (BUILT_IN_LROUND): + CASE_FLT_FN (BUILT_IN_LLROUND): real_round (&r, TYPE_MODE (ftype), &x); break; @@ -7429,9 +7237,7 @@ fold_builtin_bitop (tree fndecl, tree arglist) switch (DECL_FUNCTION_CODE (fndecl)) { - case BUILT_IN_FFS: - case BUILT_IN_FFSL: - case BUILT_IN_FFSLL: + CASE_INT_FN (BUILT_IN_FFS): if (lo != 0) result = exact_log2 (lo & -lo) + 1; else if (hi != 0) @@ -7440,9 +7246,7 @@ fold_builtin_bitop (tree fndecl, tree arglist) result = 0; break; - case BUILT_IN_CLZ: - case BUILT_IN_CLZL: - case BUILT_IN_CLZLL: + CASE_INT_FN (BUILT_IN_CLZ): if (hi != 0) result = width - floor_log2 (hi) - 1 - HOST_BITS_PER_WIDE_INT; else if (lo != 0) @@ -7451,9 +7255,7 @@ fold_builtin_bitop (tree fndecl, tree arglist) result = width; break; - case BUILT_IN_CTZ: - case BUILT_IN_CTZL: - case BUILT_IN_CTZLL: + CASE_INT_FN (BUILT_IN_CTZ): if (lo != 0) result = exact_log2 (lo & -lo); else if (hi != 0) @@ -7462,9 +7264,7 @@ fold_builtin_bitop (tree fndecl, tree arglist) result = width; break; - case BUILT_IN_POPCOUNT: - case BUILT_IN_POPCOUNTL: - case BUILT_IN_POPCOUNTLL: + CASE_INT_FN (BUILT_IN_POPCOUNT): result = 0; while (lo) result++, lo &= lo - 1; @@ -7472,9 +7272,7 @@ fold_builtin_bitop (tree fndecl, tree arglist) result++, hi &= hi - 1; break; - case BUILT_IN_PARITY: - case BUILT_IN_PARITYL: - case BUILT_IN_PARITYLL: + CASE_INT_FN (BUILT_IN_PARITY): result = 0; while (lo) result++, lo &= lo - 1; @@ -7559,49 +7357,35 @@ fold_builtin_logarithm (tree fndecl, tree arglist, switch (fcode) { - case BUILT_IN_EXP: - case BUILT_IN_EXPF: - case BUILT_IN_EXPL: + CASE_FLT_FN (BUILT_IN_EXP): /* Prepare to do logN(exp(exponent) -> exponent*logN(e). */ x = build_real (type, real_value_truncate (TYPE_MODE (type), dconste)); exponent = TREE_VALUE (TREE_OPERAND (arg, 1)); break; - case BUILT_IN_EXP2: - case BUILT_IN_EXP2F: - case BUILT_IN_EXP2L: + CASE_FLT_FN (BUILT_IN_EXP2): /* Prepare to do logN(exp2(exponent) -> exponent*logN(2). */ x = build_real (type, dconst2); exponent = TREE_VALUE (TREE_OPERAND (arg, 1)); break; - case BUILT_IN_EXP10: - case BUILT_IN_EXP10F: - case BUILT_IN_EXP10L: - case BUILT_IN_POW10: - case BUILT_IN_POW10F: - case BUILT_IN_POW10L: + CASE_FLT_FN (BUILT_IN_EXP10): + CASE_FLT_FN (BUILT_IN_POW10): /* Prepare to do logN(exp10(exponent) -> exponent*logN(10). */ x = build_real (type, dconst10); exponent = TREE_VALUE (TREE_OPERAND (arg, 1)); break; - case BUILT_IN_SQRT: - case BUILT_IN_SQRTF: - case BUILT_IN_SQRTL: + CASE_FLT_FN (BUILT_IN_SQRT): /* Prepare to do logN(sqrt(x) -> 0.5*logN(x). */ x = TREE_VALUE (TREE_OPERAND (arg, 1)); exponent = build_real (type, dconsthalf); break; - case BUILT_IN_CBRT: - case BUILT_IN_CBRTF: - case BUILT_IN_CBRTL: + CASE_FLT_FN (BUILT_IN_CBRT): /* Prepare to do logN(cbrt(x) -> (1/3)*logN(x). */ x = TREE_VALUE (TREE_OPERAND (arg, 1)); exponent = build_real (type, real_value_truncate (TYPE_MODE (type), dconstthird)); break; - case BUILT_IN_POW: - case BUILT_IN_POWF: - case BUILT_IN_POWL: + CASE_FLT_FN (BUILT_IN_POW): /* Prepare to do logN(pow(x,exponent) -> exponent*logN(x). */ x = TREE_VALUE (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) case BUILT_IN_STRLEN: return fold_builtin_strlen (arglist); - case BUILT_IN_FABS: - case BUILT_IN_FABSF: - case BUILT_IN_FABSL: + CASE_FLT_FN (BUILT_IN_FABS): return fold_builtin_fabs (arglist, type); case BUILT_IN_ABS: @@ -8747,198 +8529,114 @@ fold_builtin_1 (tree fndecl, tree arglist, bool ignore) case BUILT_IN_IMAXABS: return fold_builtin_abs (arglist, type); - case BUILT_IN_CONJ: - case BUILT_IN_CONJF: - case BUILT_IN_CONJL: + CASE_FLT_FN (BUILT_IN_CONJ): if (validate_arglist (arglist, COMPLEX_TYPE, VOID_TYPE)) return fold_build1 (CONJ_EXPR, type, TREE_VALUE (arglist)); break; - case BUILT_IN_CREAL: - case BUILT_IN_CREALF: - case BUILT_IN_CREALL: + CASE_FLT_FN (BUILT_IN_CREAL): if (validate_arglist (arglist, COMPLEX_TYPE, VOID_TYPE)) return non_lvalue (fold_build1 (REALPART_EXPR, type, TREE_VALUE (arglist))); break; - case BUILT_IN_CIMAG: - case BUILT_IN_CIMAGF: - case BUILT_IN_CIMAGL: + CASE_FLT_FN (BUILT_IN_CIMAG): if (validate_arglist (arglist, COMPLEX_TYPE, VOID_TYPE)) return non_lvalue (fold_build1 (IMAGPART_EXPR, type, TREE_VALUE (arglist))); break; - case BUILT_IN_CABS: - case BUILT_IN_CABSF: - case BUILT_IN_CABSL: + CASE_FLT_FN (BUILT_IN_CABS): return fold_builtin_cabs (arglist, type); - case BUILT_IN_SQRT: - case BUILT_IN_SQRTF: - case BUILT_IN_SQRTL: + CASE_FLT_FN (BUILT_IN_SQRT): return fold_builtin_sqrt (arglist, type); - case BUILT_IN_CBRT: - case BUILT_IN_CBRTF: - case BUILT_IN_CBRTL: + CASE_FLT_FN (BUILT_IN_CBRT): return fold_builtin_cbrt (arglist, type); - case BUILT_IN_SIN: - case BUILT_IN_SINF: - case BUILT_IN_SINL: + CASE_FLT_FN (BUILT_IN_SIN): return fold_builtin_sin (arglist); - case BUILT_IN_COS: - case BUILT_IN_COSF: - case BUILT_IN_COSL: + CASE_FLT_FN (BUILT_IN_COS): return fold_builtin_cos (arglist, type, fndecl); - case BUILT_IN_EXP: - case BUILT_IN_EXPF: - case BUILT_IN_EXPL: + CASE_FLT_FN (BUILT_IN_EXP): return fold_builtin_exponent (fndecl, arglist, &dconste); - case BUILT_IN_EXP2: - case BUILT_IN_EXP2F: - case BUILT_IN_EXP2L: + CASE_FLT_FN (BUILT_IN_EXP2): return fold_builtin_exponent (fndecl, arglist, &dconst2); - case BUILT_IN_EXP10: - case BUILT_IN_EXP10F: - case BUILT_IN_EXP10L: - case BUILT_IN_POW10: - case BUILT_IN_POW10F: - case BUILT_IN_POW10L: + CASE_FLT_FN (BUILT_IN_EXP10): + CASE_FLT_FN (BUILT_IN_POW10): return fold_builtin_exponent (fndecl, arglist, &dconst10); - case BUILT_IN_LOG: - case BUILT_IN_LOGF: - case BUILT_IN_LOGL: + CASE_FLT_FN (BUILT_IN_LOG): return fold_builtin_logarithm (fndecl, arglist, &dconste); - case BUILT_IN_LOG2: - case BUILT_IN_LOG2F: - case BUILT_IN_LOG2L: + CASE_FLT_FN (BUILT_IN_LOG2): return fold_builtin_logarithm (fndecl, arglist, &dconst2); - case BUILT_IN_LOG10: - case BUILT_IN_LOG10F: - case BUILT_IN_LOG10L: + CASE_FLT_FN (BUILT_IN_LOG10): return fold_builtin_logarithm (fndecl, arglist, &dconst10); - case BUILT_IN_TAN: - case BUILT_IN_TANF: - case BUILT_IN_TANL: + CASE_FLT_FN (BUILT_IN_TAN): return fold_builtin_tan (arglist); - case BUILT_IN_ATAN: - case BUILT_IN_ATANF: - case BUILT_IN_ATANL: + CASE_FLT_FN (BUILT_IN_ATAN): return fold_builtin_atan (arglist, type); - case BUILT_IN_POW: - case BUILT_IN_POWF: - case BUILT_IN_POWL: + CASE_FLT_FN (BUILT_IN_POW): return fold_builtin_pow (fndecl, arglist, type); - case BUILT_IN_POWI: - case BUILT_IN_POWIF: - case BUILT_IN_POWIL: + CASE_FLT_FN (BUILT_IN_POWI): return fold_builtin_powi (fndecl, arglist, type); - case BUILT_IN_INF: - case BUILT_IN_INFF: - case BUILT_IN_INFL: + CASE_FLT_FN (BUILT_IN_INF): return fold_builtin_inf (type, true); - case BUILT_IN_HUGE_VAL: - case BUILT_IN_HUGE_VALF: - case BUILT_IN_HUGE_VALL: + CASE_FLT_FN (BUILT_IN_HUGE_VAL): return fold_builtin_inf (type, false); - case BUILT_IN_NAN: - case BUILT_IN_NANF: - case BUILT_IN_NANL: + CASE_FLT_FN (BUILT_IN_NAN): return fold_builtin_nan (arglist, type, true); - case BUILT_IN_NANS: - case BUILT_IN_NANSF: - case BUILT_IN_NANSL: + CASE_FLT_FN (BUILT_IN_NANS): return fold_builtin_nan (arglist, type, false); - case BUILT_IN_FLOOR: - case BUILT_IN_FLOORF: - case BUILT_IN_FLOORL: + CASE_FLT_FN (BUILT_IN_FLOOR): return fold_builtin_floor (fndecl, arglist); - case BUILT_IN_CEIL: - case BUILT_IN_CEILF: - case BUILT_IN_CEILL: + CASE_FLT_FN (BUILT_IN_CEIL): return fold_builtin_ceil (fndecl, arglist); - case BUILT_IN_TRUNC: - case BUILT_IN_TRUNCF: - case BUILT_IN_TRUNCL: + CASE_FLT_FN (BUILT_IN_TRUNC): return fold_builtin_trunc (fndecl, arglist); - case BUILT_IN_ROUND: - case BUILT_IN_ROUNDF: - case BUILT_IN_ROUNDL: + CASE_FLT_FN (BUILT_IN_ROUND): return fold_builtin_round (fndecl, arglist); - 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_FLT_FN (BUILT_IN_NEARBYINT): + CASE_FLT_FN (BUILT_IN_RINT): return fold_trunc_transparent_mathfn (fndecl, arglist); - case BUILT_IN_LCEIL: - case BUILT_IN_LCEILF: - case BUILT_IN_LCEILL: - case BUILT_IN_LLCEIL: - 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: - case BUILT_IN_LROUND: - case BUILT_IN_LROUNDF: - case BUILT_IN_LROUNDL: - case BUILT_IN_LLROUND: - case BUILT_IN_LLROUNDF: - case BUILT_IN_LLROUNDL: + CASE_FLT_FN (BUILT_IN_LCEIL): + CASE_FLT_FN (BUILT_IN_LLCEIL): + CASE_FLT_FN (BUILT_IN_LFLOOR): + CASE_FLT_FN (BUILT_IN_LLFLOOR): + CASE_FLT_FN (BUILT_IN_LROUND): + CASE_FLT_FN (BUILT_IN_LLROUND): return fold_builtin_int_roundingfn (fndecl, arglist); - case BUILT_IN_LRINT: - case BUILT_IN_LRINTF: - case BUILT_IN_LRINTL: - case BUILT_IN_LLRINT: - case BUILT_IN_LLRINTF: - case BUILT_IN_LLRINTL: + CASE_FLT_FN (BUILT_IN_LRINT): + CASE_FLT_FN (BUILT_IN_LLRINT): return fold_fixed_mathfn (fndecl, arglist); - case BUILT_IN_FFS: - case BUILT_IN_FFSL: - case BUILT_IN_FFSLL: - case BUILT_IN_CLZ: - case BUILT_IN_CLZL: - 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: + CASE_INT_FN (BUILT_IN_FFS): + CASE_INT_FN (BUILT_IN_CLZ): + CASE_INT_FN (BUILT_IN_CTZ): + CASE_INT_FN (BUILT_IN_POPCOUNT): + CASE_INT_FN (BUILT_IN_PARITY): return fold_builtin_bitop (fndecl, arglist); case BUILT_IN_MEMCPY: @@ -8950,9 +8648,7 @@ fold_builtin_1 (tree fndecl, tree arglist, bool ignore) case BUILT_IN_MEMMOVE: return fold_builtin_memmove (arglist, type); - case BUILT_IN_SIGNBIT: - case BUILT_IN_SIGNBITF: - case BUILT_IN_SIGNBITL: + CASE_FLT_FN (BUILT_IN_SIGNBIT): return fold_builtin_signbit (fndecl, arglist); case BUILT_IN_ISASCII: @@ -8964,24 +8660,16 @@ fold_builtin_1 (tree fndecl, tree arglist, bool ignore) case BUILT_IN_ISDIGIT: return fold_builtin_isdigit (arglist); - case BUILT_IN_COPYSIGN: - case BUILT_IN_COPYSIGNF: - case BUILT_IN_COPYSIGNL: + CASE_FLT_FN (BUILT_IN_COPYSIGN): return fold_builtin_copysign (fndecl, arglist, type); - case BUILT_IN_FINITE: - case BUILT_IN_FINITEF: - case BUILT_IN_FINITEL: + CASE_FLT_FN (BUILT_IN_FINITE): return fold_builtin_classify (fndecl, arglist, BUILT_IN_FINITE); - case BUILT_IN_ISINF: - case BUILT_IN_ISINFF: - case BUILT_IN_ISINFL: + CASE_FLT_FN (BUILT_IN_ISINF): return fold_builtin_classify (fndecl, arglist, BUILT_IN_ISINF); - case BUILT_IN_ISNAN: - case BUILT_IN_ISNANF: - case BUILT_IN_ISNANL: + CASE_FLT_FN (BUILT_IN_ISNAN): return fold_builtin_classify (fndecl, arglist, BUILT_IN_ISNAN); case BUILT_IN_ISGREATER: |