Free Software Foundation, Inc.
Contributed by Xinliang David Li <davidxl@google.com>
This file is part of GCC.
Free Software Foundation, Inc.
Contributed by Xinliang David Li <davidxl@google.com>
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3, or (at your option) any
later version.
GCC is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3, or (at your option) any
later version.
GCC is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
GCC is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
not used, the compiler can still not eliminate the call without
powerful interprocedural analysis to prove that the errno is not
checked. However, if the conditions under which the error occurs
not used, the compiler can still not eliminate the call without
powerful interprocedural analysis to prove that the errno is not
checked. However, if the conditions under which the error occurs
With this change, call to log (x) is effectively eliminated, as
in majority of the cases, log won't be called with x out of
range. The branch is totally predictable, so the branch cost
With this change, call to log (x) is effectively eliminated, as
in majority of the cases, log won't be called with x out of
range. The branch is totally predictable, so the branch cost
Note that library functions are not supposed to clear errno to zero without
error. See IEEE Std 1003.1, section 2.3 Error Numbers, and section 7.5:3 of
Note that library functions are not supposed to clear errno to zero without
error. See IEEE Std 1003.1, section 2.3 Error Numbers, and section 7.5:3 of
- bound is -inf, has_lb is set to false. If the
- upper bound is +inf, has_ub is false.
- is_lb_inclusive and is_ub_inclusive are flags
- to indicate if lb and ub value are inclusive
+ bound is -inf, has_lb is set to false. If the
+ upper bound is +inf, has_ub is false.
+ is_lb_inclusive and is_ub_inclusive are flags
+ to indicate if lb and ub value are inclusive
a boolean flag indicating if the lower bound exists,
and LB_INCLUSIVE is a boolean flag indicating if the
lower bound is inclusive or not. UB, HAS_UB, and
a boolean flag indicating if the lower bound exists,
and LB_INCLUSIVE is a boolean flag indicating if the
lower bound is inclusive or not. UB, HAS_UB, and
Returns true if the format is supported. To support other
target formats, function get_no_error_domain needs to be
Returns true if the format is supported. To support other
target formats, function get_no_error_domain needs to be
- enhanced to have range bounds properly computed. Since
- the check is cheap (very small number of candidates
+ enhanced to have range bounds properly computed. Since
+ the check is cheap (very small number of candidates
&& (rfmt == &ieee_double_format || rfmt == &mips_double_format
|| rfmt == &motorola_double_format))
/* For long double, we can not really check XFmode
&& (rfmt == &ieee_double_format || rfmt == &mips_double_format
|| rfmt == &motorola_double_format))
/* For long double, we can not really check XFmode
- which is only defined on intel platforms.
- Candidate pre-selection using builtin function
- code guarantees that we are checking formats
+ which is only defined on intel platforms.
+ Candidate pre-selection using builtin function
+ code guarantees that we are checking formats
&& (rfmt == &ieee_quad_format
|| rfmt == &mips_quad_format
|| rfmt == &ieee_extended_motorola_format
&& (rfmt == &ieee_quad_format
|| rfmt == &mips_quad_format
|| rfmt == &ieee_extended_motorola_format
/* A helper function to help select calls to pow that are suitable for
conditional DCE transformation. It looks for pow calls that can be
guided with simple conditions. Such calls either have constant base
/* A helper function to help select calls to pow that are suitable for
conditional DCE transformation. It looks for pow calls that can be
guided with simple conditions. Such calls either have constant base
the pow call POW_CALL is a candidate. */
/* The maximum integer bit size for base argument of a pow call
the pow call POW_CALL is a candidate. */
/* The maximum integer bit size for base argument of a pow call
TEMP_NAME1/TEMP_NAME2 are names of the temporaries,
CONDS is a vector holding the produced GIMPLE statements,
and NCONDS points to the variable holding the number
TEMP_NAME1/TEMP_NAME2 are names of the temporaries,
CONDS is a vector holding the produced GIMPLE statements,
and NCONDS points to the variable holding the number
out of input domain check. ARG is the call argument
to be runtime checked, DOMAIN holds the valid domain
for the given function, CONDS points to the vector
out of input domain check. ARG is the call argument
to be runtime checked, DOMAIN holds the valid domain
for the given function, CONDS points to the vector
- holding the result GIMPLE statements. *NCONDS is
- the number of logical comparisons. This function
+ holding the result GIMPLE statements. *NCONDS is
+ the number of logical comparisons. This function
produces no more than two logical comparisons, one
for lower bound check, one for upper bound check. */
static void
gen_conditions_for_domain (tree arg, inp_domain domain,
produces no more than two logical comparisons, one
for lower bound check, one for upper bound check. */
static void
gen_conditions_for_domain (tree arg, inp_domain domain,
/* A helper function to generate condition
code for the y argument in call pow (some_const, y).
/* A helper function to generate condition
code for the y argument in call pow (some_const, y).
candidates' base values have a limited range,
the guarded code generated for y are simple:
if (y > max_y)
candidates' base values have a limited range,
the guarded code generated for y are simple:
if (y > max_y)
the max exp value is computed based on the size
of the integer type (i.e. max possible base value).
The resulting input domain for exp argument is thus
the max exp value is computed based on the size
of the integer type (i.e. max possible base value).
The resulting input domain for exp argument is thus
- conservative (smaller than the max value allowed by
- the runtime value of the base). BASE is the integer
- base value, EXPN is the expression for the exponent
- argument, *CONDS is the vector to hold resulting
- statements, and *NCONDS is the number of logical
+ conservative (smaller than the max value allowed by
+ the runtime value of the base). BASE is the integer
+ base value, EXPN is the expression for the exponent
+ argument, *CONDS is the vector to hold resulting
+ statements, and *NCONDS is the number of logical
base_val0 = gimple_assign_rhs1 (base_def);
base_var = SSA_NAME_VAR (base_val0);
int_type = TREE_TYPE (base_var);
bit_sz = TYPE_PRECISION (int_type);
base_val0 = gimple_assign_rhs1 (base_def);
base_var = SSA_NAME_VAR (base_val0);
int_type = TREE_TYPE (base_var);
bit_sz = TYPE_PRECISION (int_type);
-gen_conditions_for_pow (gimple pow_call, VEC (gimple, heap) *conds,
+gen_conditions_for_pow (gimple pow_call, VEC (gimple, heap) *conds,
- gen_conditions_for_pow_cst_base (base, expn, conds, nconds);
+ gen_conditions_for_pow_cst_base (base, expn, conds, nconds);
- gen_conditions_for_pow_int_base (base, expn, conds, nconds);
+ gen_conditions_for_pow_int_base (base, expn, conds, nconds);
resulting region can be conservative (smaller) than the actual
one and rounded to integers. Some of the bounds are documented
in the standard, while other limit constants are computed
resulting region can be conservative (smaller) than the actual
one and rounded to integers. Some of the bounds are documented
in the standard, while other limit constants are computed
- assuming IEEE floating point format (for SF and DF modes).
- Since IEEE only sets minimum requirements for long double format,
- different long double formats exist under different implementations
- (e.g, 64 bit double precision (DF), 80 bit double-extended
- precision (XF), and 128 bit quad precision (QF) ). For simplicity,
- in this implementation, the computed bounds for long double assume
- 64 bit format (DF), and are therefore conservative. Another
+ assuming IEEE floating point format (for SF and DF modes).
+ Since IEEE only sets minimum requirements for long double format,
+ different long double formats exist under different implementations
+ (e.g, 64 bit double precision (DF), 80 bit double-extended
+ precision (XF), and 128 bit quad precision (QF) ). For simplicity,
+ in this implementation, the computed bounds for long double assume
+ 64 bit format (DF), and are therefore conservative. Another
implementation specific, so it may not be suitable to be part of
builtins.c. This needs to be revisited later to see if it can
be leveraged in x87 assembly expansion. */
implementation specific, so it may not be suitable to be part of
builtins.c. This needs to be revisited later to see if it can
be leveraged in x87 assembly expansion. */
return get_domain (0, true, true,
0, false, false);
default:
return get_domain (0, true, true,
0, false, false);
default:
}
/* The function to generate shrink wrap conditions for a partially
dead builtin call whose return value is not used anywhere,
but has to be kept live due to potential error condition.
}
/* The function to generate shrink wrap conditions for a partially
dead builtin call whose return value is not used anywhere,
but has to be kept live due to potential error condition.
- BI_CALL is the builtin call, CONDS is the vector of statements
- for condition code, NCODES is the pointer to the number of
+ BI_CALL is the builtin call, CONDS is the vector of statements
+ for condition code, NCODES is the pointer to the number of
logical conditions. Statements belonging to different logical
condition are separated by NULL tree in the vector. */
static void
logical conditions. Statements belonging to different logical
condition are separated by NULL tree in the vector. */
static void
-gen_shrink_wrap_conditions (gimple bi_call, VEC (gimple, heap) *conds,
+gen_shrink_wrap_conditions (gimple bi_call, VEC (gimple, heap) *conds,
-/* The function to shrink wrap a partially dead builtin call
- whose return value is not used anywhere, but has to be kept
+/* The function to shrink wrap a partially dead builtin call
+ whose return value is not used anywhere, but has to be kept
/* This can happen if the condition generator decides
it is not beneficial to do the transformation. Just
/* This can happen if the condition generator decides
it is not beneficial to do the transformation. Just
/* As we introduced new control-flow we need to insert PHI-nodes
for the call-clobbers of the remaining call. */
mark_sym_for_renaming (gimple_vop (cfun));
/* As we introduced new control-flow we need to insert PHI-nodes
for the call-clobbers of the remaining call. */
mark_sym_for_renaming (gimple_vop (cfun));
/* The limit constants used in the implementation
assume IEEE floating point format. Other formats
can be supported in the future if needed. */
/* The limit constants used in the implementation
assume IEEE floating point format. Other formats
can be supported in the future if needed. */
0, /* properties_provided */
0, /* properties_destroyed */
0, /* todo_flags_start */
0, /* properties_provided */
0, /* properties_destroyed */
0, /* todo_flags_start */