GCC Middle and Back End API Reference
|
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "tm.h"
#include "rtl.h"
#include "tree.h"
#include "realmpfr.h"
#include "dfp.h"
Macros | |
#define | CLASS2(A, B) |
#define | M_LOG10_2 0.30102999566398119521 |
#define | CACHED_FRACTION(NAME, N) |
Returns a cached REAL_VALUE_TYPE corresponding to 1/n, for various n.
#define CLASS2 | ( | A, | |
B ) |
real.cc - software floating point emulation. Copyright (C) 1993-2024 Free Software Foundation, Inc. Contributed by Stephen L. Moshier (moshier@world.std.com). Re-written by Richard Henderson <rth@redhat.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 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/>.
The floating point model used internally is not exactly IEEE 754 compliant, and close to the description in the ISO C99 standard, section 5.2.4.2.2 Characteristics of floating types. Specifically x = s * b^e * \sum_{k=1}^p f_k * b^{-k} where s = sign (+- 1) b = base or radix, here always 2 e = exponent p = precision (the number of base-b digits in the significand) f_k = the digits of the significand. We differ from typical IEEE 754 encodings in that the entire significand is fractional. Normalized significands are in the range [0.5, 1.0). A requirement of the model is that P be larger than the largest supported target floating-point type by at least 2 bits. This gives us proper rounding when we truncate to the target type. In addition, E must be large enough to hold the smallest supported denormal number in a normalized form. Both of these requirements are easily satisfied. The largest target significand is 113 bits; we store at least 160. The smallest denormal number fits in 17 exponent bits; we store 26.
Used to classify two numbers simultaneously.
Referenced by do_add(), do_compare(), do_divide(), and do_multiply().
#define M_LOG10_2 0.30102999566398119521 |
Render R as a decimal floating point constant. Emit DIGITS significant digits in the result, bounded by BUF_SIZE. If DIGITS is 0, choose the maximum for the representation. If CROP_TRAILING_ZEROS, strip trailing zeros. If MODE is VOIDmode, round to nearest value. Otherwise, round to a string that, when parsed back in mode MODE, yields the same value.
Referenced by decimal_integer_string(), and real_to_decimal_for_mode().
|
inlinestatic |
Add the significands of A and B, placing the result in R. Return true if there was carry out of the most significant word.
References a, b, i, r, and SIGSZ.
Referenced by do_add(), real_nan(), real_nextafter(), and round_for_format().
void build_sinatan_real | ( | REAL_VALUE_TYPE * | r, |
tree | type ) |
Fills r with the largest value such that 1 + r*r won't overflow. This is used in both sin (atan (x)) and cos (atan(x)) optimizations.
References dconst1, mpfr_from_real(), NULL, r, real_from_mpfr(), real_maxval(), REAL_MODE_FORMAT, REAL_VALUE_TYPE, and TYPE_MODE.
|
static |
Clear bits 0..N-1 of the significand of R.
References HOST_BITS_PER_LONG, i, and r.
Referenced by do_fix_trunc(), real_maxval(), real_nextafter(), real_roundeven(), and round_for_format().
|
inlinestatic |
Clear bit N of the significand of R.
References HOST_BITS_PER_LONG, and r.
Referenced by real_maxval(), and real_nextafter().
|
inlinestatic |
Return true if A is nonzero.
Referenced by real_from_string(), and real_to_decimal_for_mode().
|
inlinestatic |
Compare significands. Return tri-state vs zero.
References a, b, i, and SIGSZ.
Referenced by div_significands(), do_compare(), real_to_decimal_for_mode(), and rtd_divmod().
const REAL_VALUE_TYPE * dconst_e_ptr | ( | void | ) |
Returns the special REAL_VALUE_TYPE corresponding to 'e'.
References NULL_TREE, real_from_mpfr(), REAL_VALUE_TYPE, rvc_zero, and SIGNIFICAND_BITS.
const REAL_VALUE_TYPE * dconst_pi_ptr | ( | void | ) |
Returns the special REAL_VALUE_TYPE corresponding to 'pi'.
References NULL_TREE, real_from_mpfr(), REAL_VALUE_TYPE, rvc_zero, and SIGNIFICAND_BITS.
const REAL_VALUE_TYPE * dconst_sqrt2_ptr | ( | void | ) |
Returns the special REAL_VALUE_TYPE corresponding to sqrt(2).
References REAL_VALUE_TYPE, and rvc_zero.
DEBUG_FUNCTION void debug | ( | const REAL_VALUE_TYPE & | r | ) |
References r, and real_to_hexadecimal().
|
static |
Convert a real with an integral value to decimal float.
References decimal_integer_string(), decimal_real_from_string(), and r.
Referenced by real_from_integer().
|
static |
Render R, an integral value, as a floating point constant with no specified exponent.
References gcc_assert, M_LOG10_2, real_format::p, r, real_digit(), REAL_EXP, REAL_VALUE_TYPE, rtd_divmod(), rvc_zero, and times_pten().
Referenced by decimal_from_integer().
|
static |
Decode arm_bfloat types.
References exp(), real_format::has_denorm, real_format::has_inf, real_format::has_nans, real_format::has_signed_zero, HOST_BITS_PER_LONG, normalize(), real_format::qnan_msb_set, r, rvc_inf, rvc_nan, rvc_normal, SET_REAL_EXP, SIG_MSB, and SIGSZ.
|
static |
Decode a double precision DFP value in BUF into a real R.
References decode_decimal64(), and r.
|
static |
Decode a quad precision DFP value in BUF into a real R.
References decode_decimal128(), and r.
|
static |
Decode a single precision DFP value in BUF into a real R.
References decode_decimal32(), and r.
|
static |
References decode_ieee_double(), do_add(), ieee_double_format, mips_double_format, real_format::qnan_msb_set, r, REAL_VALUE_TYPE, rvc_inf, rvc_nan, and rvc_zero.
|
static |
References exp(), FLOAT_WORDS_BIG_ENDIAN, real_format::has_denorm, real_format::has_inf, real_format::has_nans, real_format::has_signed_zero, HOST_BITS_PER_LONG, normalize(), real_format::qnan_msb_set, r, rvc_inf, rvc_nan, rvc_normal, SET_REAL_EXP, SIG_MSB, and SIGSZ.
Referenced by decode_ibm_extended().
|
static |
As above, we have a helper function which converts from 12-byte little-endian Intel format to internal format. Functions below adjust for the other possible formats.
References real_format::emin, exp(), real_format::has_denorm, real_format::has_inf, real_format::has_nans, real_format::has_signed_zero, HOST_BITS_PER_LONG, normalize(), real_format::qnan_msb_set, r, rvc_inf, rvc_nan, rvc_normal, SET_REAL_EXP, and SIGSZ.
Referenced by decode_ieee_extended_intel_96(), and decode_ieee_extended_motorola().
|
static |
Convert from the internal format to the 16-byte Intel format for an IEEE extended real.
References decode_ieee_extended_intel_96(), and r.
|
static |
Convert from the internal format to the 12-byte Intel format for an IEEE extended real.
References decode_ieee_extended(), FLOAT_WORDS_BIG_ENDIAN, and r.
Referenced by decode_ieee_extended_intel_128().
|
static |
Convert from the internal format to the 12-byte Motorola format for an IEEE extended real.
References decode_ieee_extended(), and r.
|
static |
Decode half-precision floats. This routine is used both for the IEEE ARM alternative encodings.
References exp(), real_format::has_denorm, real_format::has_inf, real_format::has_nans, real_format::has_signed_zero, HOST_BITS_PER_LONG, normalize(), real_format::qnan_msb_set, r, rvc_inf, rvc_nan, rvc_normal, SET_REAL_EXP, SIG_MSB, and SIGSZ.
|
static |
References exp(), FLOAT_WORDS_BIG_ENDIAN, real_format::has_denorm, real_format::has_inf, real_format::has_nans, real_format::has_signed_zero, HOST_BITS_PER_LONG, lshift_significand(), normalize(), real_format::qnan_msb_set, r, rvc_inf, rvc_nan, rvc_normal, SET_REAL_EXP, SIG_MSB, SIGNIFICAND_BITS, and SIGSZ.
|
static |
|
static |
References r.
|
static |
References exp(), FLOAT_WORDS_BIG_ENDIAN, HOST_BITS_PER_LONG, lshift_significand(), r, rvc_normal, SET_REAL_EXP, SIG_MSB, and SIGSZ.
|
static |
References exp(), HOST_BITS_PER_LONG, r, rvc_normal, SET_REAL_EXP, SIG_MSB, and SIGSZ.
|
static |
References exp(), FLOAT_WORDS_BIG_ENDIAN, HOST_BITS_PER_LONG, lshift_significand(), r, rvc_normal, SET_REAL_EXP, SIG_MSB, and SIGSZ.
|
inlinestatic |
Divide the significands of A and B, placing the result in R. Return true if the division was inexact.
References a, b, cmp_significands(), i, lshift_significand_1(), r, REAL_VALUE_TYPE, set_significand_bit(), SIG_MSB, SIGNIFICAND_BITS, SIGSZ, and sub_significands().
Referenced by do_divide().
|
static |
Calculate R = A + (SUBTRACT_P ? -B : B). Return true if the result may be inexact due to a loss of precision.
References a, add_significands(), b, CLASS2, exp(), gcc_unreachable, get_canonical_qnan(), get_inf(), get_zero(), MAX_EXP, neg_significand(), normalize(), r, REAL_EXP, REAL_VALUE_TYPE, rvc_inf, rvc_nan, rvc_normal, rvc_zero, SET_REAL_EXP, SIG_MSB, SIGNIFICAND_BITS, SIGSZ, sticky_rshift_significand(), and sub_significands().
Referenced by decode_ibm_extended(), do_multiply(), encode_ibm_extended(), gimplify_scan_omp_clauses(), real_arithmetic(), real_ceil(), real_floor(), real_round(), real_roundeven(), and vect_check_gather_scatter().
|
static |
Return a tri-state comparison of A vs B. Return NAN_RESULT if one of the two operands is a NaN.
References a, b, CLASS2, cmp_significands(), decimal_do_compare(), gcc_unreachable, REAL_EXP, rvc_inf, rvc_nan, rvc_normal, and rvc_zero.
Referenced by real_arithmetic(), real_compare(), real_equal(), real_less(), real_nextafter(), and real_to_decimal_for_mode().
|
static |
Calculate R = A / B. Return true if the result may be inexact.
References a, b, CLASS2, div_significands(), exp(), gcc_unreachable, get_canonical_qnan(), get_inf(), get_zero(), MAX_EXP, normalize(), r, REAL_EXP, REAL_VALUE_TYPE, rvc_inf, rvc_nan, rvc_normal, rvc_zero, and SET_REAL_EXP.
Referenced by exact_real_inverse(), real_arithmetic(), real_powi(), real_to_decimal_for_mode(), ten_to_mptwo(), and times_pten().
|
static |
Return A truncated to an integral value toward zero.
References a, clear_significand_below(), decimal_do_fix_trunc(), gcc_unreachable, get_zero(), r, REAL_EXP, rvc_inf, rvc_nan, rvc_normal, rvc_zero, and SIGNIFICAND_BITS.
Referenced by real_arithmetic(), real_ceil(), real_floor(), real_round(), real_to_decimal_for_mode(), and real_trunc().
|
static |
Calculate R = A * B. Return true if the result may be inexact.
References a, b, CLASS2, do_add(), exp(), gcc_unreachable, get_canonical_qnan(), get_inf(), get_zero(), HOST_BITS_PER_LONG, i, MAX_EXP, normalize(), r, REAL_EXP, REAL_VALUE_TYPE, rvc_inf, rvc_nan, rvc_normal, rvc_zero, SET_REAL_EXP, and SIGSZ.
Referenced by real_arithmetic(), real_powi(), real_to_decimal_for_mode(), ten_to_ptwo(), and times_pten().
|
static |
Encode arm_bfloat types.
References real_format::canonical_nan_lsbs_set, exp(), gcc_unreachable, real_format::has_inf, real_format::has_nans, HOST_BITS_PER_LONG, real_format::qnan_msb_set, r, REAL_EXP, real_isdenormal(), rvc_inf, rvc_nan, rvc_normal, rvc_zero, and SIGSZ.
|
static |
Encode real R into a double precision DFP value in BUF.
References encode_decimal64(), and r.
|
static |
Encode real R into a quad precision DFP value in BUF.
References encode_decimal128(), and r.
|
static |
Encode real R into a single precision DFP value in BUF.
References encode_decimal32(), and r.
|
static |
IBM 128-bit extended precision format: a pair of IEEE double precision numbers whose sum is equal to the extended precision value. The number with greater magnitude is first. This format has the same magnitude range as an IEEE double precision value, but effectively 106 bits of significand precision. Infinity and NaN are represented by their IEEE double precision value stored in the first number, the second number is +0.0 or -0.0 for Infinity and don't-care for NaN.
References do_add(), encode_ieee_double(), ieee_double_format, mips_double_format, normalize(), real_format::qnan_msb_set, r, REAL_VALUE_TYPE, round_for_format(), and rvc_normal.
|
static |
IEEE double-precision format.
References real_format::canonical_nan_lsbs_set, exp(), FLOAT_WORDS_BIG_ENDIAN, gcc_unreachable, real_format::has_inf, real_format::has_nans, HOST_BITS_PER_LONG, real_format::qnan_msb_set, r, REAL_EXP, real_isdenormal(), rvc_inf, rvc_nan, rvc_normal, rvc_zero, and SIGSZ.
Referenced by encode_ibm_extended().
|
static |
IEEE extended real format. This comes in three flavors: Intel's as a 12 byte image, Intel's as a 16 byte image, and Motorola's. Intel 12- and 16-byte images may be big- or little endian; Motorola's is always big endian.
Helper subroutine which converts from the internal format to the 12-byte little-endian Intel format. Functions below adjust this for the other possible formats.
References real_format::canonical_nan_lsbs_set, exp(), gcc_assert, gcc_unreachable, real_format::has_inf, real_format::has_nans, HOST_BITS_PER_LONG, real_format::qnan_msb_set, r, REAL_EXP, real_isdenormal(), rvc_inf, rvc_nan, rvc_normal, rvc_zero, and SIGSZ.
Referenced by encode_ieee_extended_intel_96(), and encode_ieee_extended_motorola().
|
static |
Convert from the internal format to the 16-byte Intel format for an IEEE extended real.
References encode_ieee_extended_intel_96(), and r.
|
static |
Convert from the internal format to the 12-byte Intel format for an IEEE extended real.
References encode_ieee_extended(), FLOAT_WORDS_BIG_ENDIAN, and r.
Referenced by encode_ieee_extended_intel_128().
|
static |
Convert from the internal format to the 12-byte Motorola format for an IEEE extended real.
References encode_ieee_extended(), r, and rvc_inf.
|
static |
Encode half-precision floats. This routine is used both for the IEEE ARM alternative encodings.
References real_format::canonical_nan_lsbs_set, exp(), gcc_unreachable, real_format::has_inf, real_format::has_nans, HOST_BITS_PER_LONG, real_format::qnan_msb_set, r, REAL_EXP, real_isdenormal(), rvc_inf, rvc_nan, rvc_normal, rvc_zero, and SIGSZ.
|
static |
IEEE quad precision format.
References real_format::canonical_nan_lsbs_set, exp(), FLOAT_WORDS_BIG_ENDIAN, gcc_unreachable, real_format::has_inf, real_format::has_nans, HOST_BITS_PER_LONG, real_format::qnan_msb_set, r, REAL_EXP, real_isdenormal(), REAL_VALUE_TYPE, rshift_significand(), rvc_inf, rvc_nan, rvc_normal, rvc_zero, and SIGNIFICAND_BITS.
|
static |
IEEE single-precision format.
References real_format::canonical_nan_lsbs_set, exp(), gcc_unreachable, real_format::has_inf, real_format::has_nans, HOST_BITS_PER_LONG, real_format::qnan_msb_set, r, REAL_EXP, real_isdenormal(), rvc_inf, rvc_nan, rvc_normal, rvc_zero, and SIGSZ.
|
static |
A synthetic "format" for internal arithmetic. It's the size of the internal significand minus the two bits needed for proper rounding. The encode and decode routines exist only to satisfy our paranoia harness.
References r.
|
static |
References FLOAT_WORDS_BIG_ENDIAN, gcc_unreachable, HOST_BITS_PER_LONG, r, REAL_EXP, rvc_inf, rvc_nan, rvc_normal, rvc_zero, and SIGSZ.
|
static |
Descriptions of VAX floating point formats can be found beginning at http://h71000.www7.hp.com/doc/73FINAL/4515/4515pro_013.html#f_floating_point_format The thing to remember is that they're almost IEEE, except for word order, exponent bias, and the lack of infinities, nans, and denormals. We don't implement the H_floating format here, simply because neither the VAX or Alpha ports use it.
References exp(), gcc_unreachable, HOST_BITS_PER_LONG, r, REAL_EXP, rvc_inf, rvc_nan, rvc_normal, rvc_zero, and SIGSZ.
|
static |
References FLOAT_WORDS_BIG_ENDIAN, gcc_unreachable, HOST_BITS_PER_LONG, r, REAL_EXP, rvc_inf, rvc_nan, rvc_normal, rvc_zero, and SIGSZ.
bool exact_real_inverse | ( | format_helper | fmt, |
REAL_VALUE_TYPE * | r ) |
Try to change R into its exact multiplicative inverse in format FMT. Return true if successful.
References do_divide(), i, r, real_convert(), real_digit(), REAL_VALUE_TYPE, rvc_normal, SIG_MSB, and SIGSZ.
Referenced by exact_inverse().
bool exact_real_truncate | ( | format_helper | fmt, |
const REAL_VALUE_TYPE * | a ) |
Return true if truncating to FMT is exact.
References a, real_format::emin, real_convert(), REAL_EXP, real_identical(), and REAL_VALUE_TYPE.
Referenced by compress_float_constant(), fold_convert_const_real_from_real(), simplify_const_unary_operation(), and strip_float_extensions().
|
inlinestatic |
Initialize R with the canonical quiet NaN.
Referenced by do_add(), do_divide(), do_multiply(), real_from_string(), real_nan(), and real_nextafter().
|
inlinestatic |
Referenced by real_from_string(), and real_nan().
|
inlinestatic |
Referenced by do_add(), do_divide(), do_multiply(), normalize(), real_from_string(), real_inf(), real_ldexp(), real_nextafter(), and round_for_format().
void get_max_float | ( | const struct real_format * | fmt, |
char * | buf, | ||
size_t | len, | ||
bool | norm_max ) |
Write into BUF the maximum representable finite floating-point number, (1 - b**-p) * b**emax for a given FP format FMT as a hex float string. LEN is the size of BUF, and the buffer must be large enough to contain the resulting string. If NORM_MAX, instead write the maximum representable finite normalized floating-point number, defined to be such that all choices of digits for that exponent are representable in the format (this only makes a difference for IBM long double).
References real_format::b, real_format::emax, gcc_assert, i, real_format::p, and real_format::pnan.
Referenced by fold_builtin_interclass_mathfn(), and real_max_representable().
|
inlinestatic |
Initialize R with a positive zero.
References r.
Referenced by do_add(), do_divide(), do_fix_trunc(), do_multiply(), normalize(), real_from_integer(), real_from_string(), real_ldexp(), real_nan(), real_nextafter(), and round_for_format().
References GET_MODE, and HONOR_INFINITIES().
bool HONOR_INFINITIES | ( | const_tree | t | ) |
References element_mode(), and HONOR_INFINITIES().
bool HONOR_INFINITIES | ( | machine_mode | m | ) |
As for HONOR_NANS, but true if the mode can represent infinity and the treatment of infinite values is important.
References MODE_HAS_INFINITIES.
Referenced by frange_val_max(), frange_val_min(), HONOR_INFINITIES(), HONOR_INFINITIES(), omp_reduction_init_op(), frange::set(), tree_expr_finite_p(), tree_expr_infinite_p(), and tree_expr_maybe_infinite_p().
References GET_MODE, and HONOR_NANS().
bool HONOR_NANS | ( | const_tree | t | ) |
References element_mode(), and HONOR_NANS().
bool HONOR_NANS | ( | machine_mode | m | ) |
True if mode M has a NaN representation and the treatment of NaN operands is important.
References MODE_HAS_NANS.
Referenced by ipa_predicate::add_clause(), bitwise_inverted_equal_p(), build_gt(), build_lt(), combine_comparisons(), cond_stmts_equal_p(), convert_mode_scalar(), do_compare_rtx_and_jump(), eliminate_using_constants(), emit_store_flag(), emit_store_flag_force(), expand_builtin_issignaling(), expand_complex_multiplication(), fold_binary_loc(), fold_cond_expr_with_comparison(), fold_ternary_loc(), fold_truth_not_expr(), gen_one_condition(), frange_storage::get_frange(), gimple_bitwise_inverted_equal_p(), gimple_equal_p(), gimple_expand_builtin_pow(), gimple_simplify_phiopt(), HONOR_NANS(), HONOR_NANS(), HONOR_SNANS(), ifcombine_ifandif(), insert_predicates_for_cond(), frange::internal_singleton_p(), inverse_conditions_p(), may_trap_p_1(), merge_truthop_with_opposite_arm(), minmax_from_comparison(), minmax_replacement(), noce_try_minmax(), noce_try_move(), frange::normalize_kind(), optimize_spaceship(), parloops_is_simple_reduction(), parse_predicate(), fold_using_range::relation_fold_and_or(), reversed_comparison_code_parts(), frange::set(), set_cond_stmt_execution_predicate(), frange::set_nan(), frange::set_varying(), avail_exprs_stack::simplify_binary_operation(), simplify_context::simplify_binary_operation_1(), simplify_const_binary_operation(), simplify_const_relational_operation(), simplify_if_then_else(), simplify_context::simplify_ternary_operation(), spaceship_replacement(), split_comparison(), tree_expr_finite_p(), tree_expr_maybe_nan_p(), tree_expr_nan_p(), ubsan_instrument_float_cast(), frange::update_nan(), valid_lattice_transition(), vect_build_slp_tree_1(), vectorizable_condition(), and frange::verify_range().
References GET_MODE, and HONOR_SIGN_DEPENDENT_ROUNDING().
bool HONOR_SIGN_DEPENDENT_ROUNDING | ( | const_tree | t | ) |
References element_mode(), and HONOR_SIGN_DEPENDENT_ROUNDING().
bool HONOR_SIGN_DEPENDENT_ROUNDING | ( | machine_mode | m | ) |
Like HONOR_NANS, but true if given mode supports sign-dependent rounding, and the rounding mode is important.
References MODE_HAS_SIGN_DEPENDENT_ROUNDING.
Referenced by fold_convert_const(), fold_convert_const_real_from_real(), fold_negate_expr_1(), fold_real_zero_addition_p(), HONOR_SIGN_DEPENDENT_ROUNDING(), HONOR_SIGN_DEPENDENT_ROUNDING(), negate_expr_p(), simplify_context::simplify_binary_operation_1(), simplify_const_unary_operation(), simplify_context::simplify_unary_operation_1(), vect_reduction_update_partial_vector_usage(), vectorize_fold_left_reduction(), and visit_nary_op().
References GET_MODE, and HONOR_SIGNED_ZEROS().
bool HONOR_SIGNED_ZEROS | ( | const_tree | t | ) |
References element_mode(), and HONOR_SIGNED_ZEROS().
bool HONOR_SIGNED_ZEROS | ( | machine_mode | m | ) |
Like HONOR_NANS, but true if the given mode distinguishes between positive and negative zero, and the sign of zero is important.
References MODE_HAS_SIGNED_ZEROS.
Referenced by loop_cand::analyze_induction_var(), associate_equivalences_with_edges(), frange::contains_p(), eliminate_using_constants(), expand_abs_nojump(), expand_builtin_signbit(), expand_unop(), frange::flush_denormals_to_zero(), fold_binary_loc(), fold_cond_expr_with_comparison(), fold_negate_expr_1(), fold_real_zero_addition_p(), fold_ternary_loc(), frange_add_zeros(), gimple_expand_builtin_pow(), operand_compare::hash_operand(), HONOR_SIGNED_ZEROS(), HONOR_SIGNED_ZEROS(), implicit_set_cond_p(), frange::intersect(), minmax_from_comparison(), minmax_replacement(), negate_expr_p(), neutral_op_for_reduction(), noce_try_abs(), noce_try_minmax(), noce_try_move(), operand_compare::operand_equal_p(), reassociate_bb(), record_edge_info(), record_equality(), frange::set(), frange::set_zero(), simplify_context::simplify_binary_operation_1(), simplify_if_then_else(), simplify_context::simplify_ternary_operation(), simplify_context::simplify_unary_operation_1(), tree_call_nonnegative_warnv_p(), tree_expr_maybe_real_minus_zero_p(), try_special_add_to_ops(), frange::union_(), value_replacement(), and vectorize_fold_left_reduction().
References GET_MODE, and HONOR_SNANS().
bool HONOR_SNANS | ( | const_tree | t | ) |
References element_mode(), and HONOR_SNANS().
bool HONOR_SNANS | ( | machine_mode | m | ) |
Like HONOR_NANs, but true if we honor signaling NaNs (or sNaNs).
References HONOR_NANS().
Referenced by loop_cand::analyze_induction_var(), const_binop(), const_unop(), convert_expand_mult_copysign(), do_compare_rtx_and_jump(), eliminate_using_constants(), emit_store_flag(), emit_store_flag_force(), fold_binary_loc(), fold_convert_const_real_from_real(), fold_real_zero_addition_p(), gimple_expand_builtin_pow(), HONOR_SNANS(), HONOR_SNANS(), may_trap_p_1(), reassociate_bb(), simplify_context::simplify_binary_operation_1(), simplify_const_binary_operation(), simplify_const_relational_operation(), simplify_const_unary_operation(), tree_expr_maybe_signaling_nan_p(), tree_expr_signaling_nan_p(), and try_special_add_to_ops().
|
static |
Return true (including 0) if integer part of R is even, else return false. The function is not valid for rvc_inf and rvc_nan classes.
References gcc_assert, HOST_BITS_PER_LONG, r, REAL_EXP, rvc_inf, rvc_nan, rvc_zero, and SIGNIFICAND_BITS.
Referenced by real_roundeven().
|
static |
Return true if R is halfway between two integers, else return false.
References HOST_BITS_PER_LONG, i, r, REAL_EXP, rvc_normal, and SIGNIFICAND_BITS.
Referenced by real_roundeven().
|
static |
Left-shift the significand of A by N bits; put the result in the significand of R.
References a, HOST_BITS_PER_LONG, i, r, and SIGSZ.
Referenced by decode_ieee_quad(), decode_vax_d(), decode_vax_g(), normalize(), and real_nan().
|
inlinestatic |
Likewise, but N is specialized to 1.
References a, HOST_BITS_PER_LONG, i, r, and SIGSZ.
Referenced by div_significands(), real_nan(), and rtd_divmod().
|
inlinestatic |
|
static |
Adjust the exponent and significand of R such that the most significant bit is set. We underflow to zero and overflow to infinity here, without denormals. (The intermediate representation exponent is large enough to handle target denormals normalized.)
References exp(), get_inf(), get_zero(), HOST_BITS_PER_LONG, i, lshift_significand(), MAX_EXP, r, REAL_EXP, rvc_zero, SET_REAL_EXP, and SIGSZ.
Referenced by decode_arm_bfloat_half(), decode_ieee_double(), decode_ieee_extended(), decode_ieee_half(), decode_ieee_quad(), decode_ieee_single(), do_add(), do_divide(), do_multiply(), encode_ibm_extended(), make_range_step(), noce_emit_store_flag(), noce_try_addcc(), noce_try_store_flag_constants(), predicate::normalize(), predicate::normalize(), real_convert(), real_from_integer(), real_from_string(), real_nextafter(), and rtd_divmod().
void real_2expN | ( | REAL_VALUE_TYPE * | r, |
int | n, | ||
format_helper | fmt ) |
Fills R with 2**N.
References format_helper::decimal_p(), decimal_real_convert(), MAX_EXP, r, rvc_inf, rvc_normal, SET_REAL_EXP, SIG_MSB, and SIGSZ.
Referenced by check_real_for_fixed_mode(), expand_fix(), expand_float(), fixed_convert_from_real(), fixed_from_string(), fixed_to_decimal(), and real_convert_from_fixed().
bool real_arithmetic | ( | REAL_VALUE_TYPE * | r, |
int | icode, | ||
const REAL_VALUE_TYPE * | op0, | ||
const REAL_VALUE_TYPE * | op1 ) |
Perform the binary or unary operation described by CODE. For a unary operation, leave OP1 NULL. This function returns true if the result may be inexact due to loss of precision.
References decimal_real_arithmetic(), do_add(), do_compare(), do_divide(), do_fix_trunc(), do_multiply(), gcc_unreachable, r, and rvc_nan.
Referenced by check_real_for_fixed_mode(), const_binop(), expand_pow_as_sqrts(), fixed_convert_from_real(), fixed_from_string(), fixed_to_decimal(), float_widen_lhs_range(), fold_builtin_modf(), cfn_sincos::fold_range(), frange_arithmetic(), gimple_expand_builtin_pow(), omp_reduction_init_op(), real_convert_from_fixed(), real_value_abs(), real_value_negate(), representable_as_half_series_p(), simplify_context::simplify_binary_operation_1(), simplify_const_binary_operation(), simplify_const_unary_operation(), and ubsan_instrument_float_cast().
bool real_can_shorten_arithmetic | ( | machine_mode | imode, |
machine_mode | tmode ) |
Return true if arithmetic on values in IMODE that were promoted from values in TMODE is equivalent to direct arithmetic on values in TMODE.
References real_format::b, real_format::emax, real_format::emin, real_format::has_inf, real_format::has_nans, real_format::has_sign_dependent_rounding, real_format::has_signed_zero, MODE_COMPOSITE_P, real_format::p, REAL_MODE_FORMAT, and real_format::round_towards_zero.
void real_ceil | ( | REAL_VALUE_TYPE * | r, |
format_helper | fmt, | ||
const REAL_VALUE_TYPE * | x ) |
Round X to the smallest integer not less then argument, i.e. round up, placing the result in R in format FMT.
References dconst1, do_add(), do_fix_trunc(), r, real_convert(), real_identical(), and REAL_VALUE_TYPE.
Referenced by expand_pow_as_sqrts(), fold_const_call_ss(), and fold_const_call_ss().
bool real_compare | ( | int | icode, |
const REAL_VALUE_TYPE * | op0, | ||
const REAL_VALUE_TYPE * | op1 ) |
Compare reals by tree_code.
References do_compare(), gcc_unreachable, real_equal(), real_less(), and rvc_nan.
Referenced by check_real_for_fixed_mode(), frange::contains_p(), contains_zero_p(), decimal_real_arithmetic(), float_binary_op_range_finish(), fold_const_call_ss(), fold_const_call_sss(), operator_abs::fold_range(), operator_ge::fold_range(), operator_gt::fold_range(), operator_le::fold_range(), fold_relational_const(), frange::set(), and ubsan_instrument_float_cast().
void real_convert | ( | REAL_VALUE_TYPE * | r, |
format_helper | fmt, | ||
const REAL_VALUE_TYPE * | a ) |
Extend or truncate to a new format.
References a, real_format::b, decimal_real_convert(), normalize(), r, round_for_format(), rvc_nan, and rvc_normal.
Referenced by const_binop(), do_mpc_ckconv(), do_mpc_ckconv(), do_mpfr_ckconv(), do_mpfr_ckconv(), exact_real_inverse(), exact_real_truncate(), fold_const_nextafter(), fold_convert_const_real_from_real(), frange_arithmetic(), frange_mpfr_arg1(), frange_nextafter(), gimple_expand_builtin_pow(), frange::internal_singleton_p(), real_ceil(), real_convert_from_fixed(), real_floor(), real_from_integer(), real_from_string2(), real_from_string3(), real_nextafter(), real_powi(), real_round(), real_roundeven(), real_to_decimal_for_mode(), real_trunc(), real_value_truncate(), simplify_context::simplify_binary_operation_1(), simplify_const_binary_operation(), simplify_const_unary_operation(), and ubsan_instrument_float_cast().
void real_copysign | ( | REAL_VALUE_TYPE * | r, |
const REAL_VALUE_TYPE * | x ) |
Set the sign of R to the sign of X.
References r.
Referenced by fold_const_call_sss(), and simplify_const_binary_operation().
|
static |
Returns N.
References gcc_assert, real_from_integer(), REAL_VALUE_TYPE, rvc_zero, and UNSIGNED.
Referenced by decimal_integer_string(), exact_real_inverse(), real_to_decimal_for_mode(), ten_to_mptwo(), and times_pten().
bool real_equal | ( | const REAL_VALUE_TYPE * | op0, |
const REAL_VALUE_TYPE * | op1 ) |
Return whether OP0 == OP1.
References do_compare().
Referenced by associate_equivalences_with_edges(), check_pow(), const_binop(), estimate_num_insns(), expand_mult(), fold_const_builtin_load_exponent(), fold_const_pow(), frange_arithmetic(), gen_conditions_for_pow_cst_base(), gimple_expand_builtin_pow(), implicit_set_cond_p(), optimize_recip_sqrt(), real_compare(), real_maybe_zerop(), real_minus_onep(), real_onep(), real_zerop(), record_equality(), representable_as_half_series_p(), operator_mult::rv_fold(), simplify_context::simplify_binary_operation_1(), simplify_const_binary_operation(), simplify_const_relational_operation(), and vect_recog_pow_pattern().
int real_exponent | ( | const REAL_VALUE_TYPE * | r | ) |
Return floor log2(R).
References gcc_unreachable, r, REAL_EXP, rvc_inf, rvc_nan, rvc_normal, and rvc_zero.
void real_floor | ( | REAL_VALUE_TYPE * | r, |
format_helper | fmt, | ||
const REAL_VALUE_TYPE * | x ) |
Round X to the largest integer not greater in value, i.e. round down, placing the result in R in format FMT.
References dconstm1, do_add(), do_fix_trunc(), r, real_convert(), real_identical(), and REAL_VALUE_TYPE.
Referenced by expand_pow_as_sqrts(), fold_const_call_ss(), and fold_const_call_ss().
void real_from_integer | ( | REAL_VALUE_TYPE * | r, |
format_helper | fmt, | ||
const wide_int_ref & | val_in, | ||
signop | sgn ) |
Initialize R from the wide_int VAL_IN. Round it to format FMT if FMT is nonnull.
References wi::clz(), decimal_from_integer(), format_helper::decimal_p(), generic_wide_int< storage >::elt(), wide_int_storage::from(), gcc_assert, get_zero(), HOST_BITS_PER_LONG, HOST_BITS_PER_WIDE_INT, i, wi::lrshift(), wi::neg_p(), normalize(), r, real_convert(), rvc_normal, SET_REAL_EXP, SIGNIFICAND_BITS, and SIGSZ.
Referenced by acceptable_pow_call(), build_real_from_wide(), check_pow(), decrement_power(), expand_pow_as_sqrts(), fixed_to_decimal(), fold_const_logb(), fold_const_pow(), gen_conditions_for_pow_cst_base(), gimple_expand_builtin_pow(), init_emit_once(), real_convert_from_fixed(), real_digit(), real_isinteger(), real_value_from_int_cst(), simplify_const_unary_operation(), ten_to_ptwo(), and tree_call_nonnegative_warnv_p().
int real_from_string | ( | REAL_VALUE_TYPE * | r, |
const char * | str ) |
Initialize R from a decimal or hexadecimal string. The string is assumed to have been syntax checked already. Return -1 if the value underflows, +1 if overflows, and 0 otherwise.
References cmp_significand_0(), exp(), gcc_assert, get_canonical_qnan(), get_canonical_snan(), get_inf(), get_zero(), HOST_BITS_PER_LONG, MAX_EXP, normalize(), NULL, NULL_TREE, r, real_from_mpfr(), rvc_normal, SET_REAL_EXP, SIGNIFICAND_BITS, and startswith().
Referenced by check_real_for_fixed_mode(), decimal_real_to_integer(), decimal_real_to_integer(), fixed_from_string(), real_from_mpfr(), real_from_string2(), real_from_string3(), real_max_representable(), and real_to_decimal_for_mode().
REAL_VALUE_TYPE real_from_string2 | ( | const char * | s, |
format_helper | fmt ) |
Legacy. Similar, but return the result directly.
References r, real_convert(), real_from_string(), and REAL_VALUE_TYPE.
void real_from_string3 | ( | REAL_VALUE_TYPE * | r, |
const char * | s, | ||
format_helper | fmt ) |
Initialize R from string S and desired format FMT.
References format_helper::decimal_p(), decimal_real_from_string(), r, real_convert(), and real_from_string().
Referenced by decimal_to_binary(), fold_builtin_fpclassify(), and fold_builtin_interclass_mathfn().
void real_from_target | ( | REAL_VALUE_TYPE * | r, |
const long * | buf, | ||
format_helper | fmt ) |
Read R from the given target format. Read the words of the result in target word order in BUF. There are always 32 bits in each long, no matter the size of the host long.
References real_format::decode, and r.
Referenced by native_decode_rtx(), native_interpret_real(), simplify_const_binary_operation(), simplify_const_unary_operation(), vect_build_all_ones_mask(), and vect_build_zero_merge_argument().
unsigned int real_hash | ( | const REAL_VALUE_TYPE * | r | ) |
Return a hash value for the given real value.
??? The "unsigned int" return value is intended to be hashval_t, but I didn't want to pull hashtab.h into real.h.
References gcc_unreachable, HOST_BITS_PER_LONG, i, r, REAL_EXP, rvc_inf, rvc_nan, rvc_normal, rvc_zero, and SIGSZ.
Referenced by const_hash_1(), const_rtx_hash_1(), cselib_hash_rtx(), const_double_hasher::hash(), operand_compare::hash_operand(), and hash_rtx().
bool real_identical | ( | const REAL_VALUE_TYPE * | a, |
const REAL_VALUE_TYPE * | b ) |
Compare two floating-point objects for bitwise identity.
References a, b, gcc_unreachable, i, REAL_EXP, rvc_inf, rvc_nan, rvc_normal, rvc_zero, and SIGSZ.
Referenced by acceptable_pow_call(), compare_constant(), const_binop(), do_mpc_ckconv(), do_mpc_ckconv(), do_mpfr_ckconv(), do_mpfr_ckconv(), const_double_hasher::equal(), ipa_icf::sem_variable::equals(), exact_real_truncate(), expand_complex_multiplication(), expand_pow_as_sqrts(), fold_const_pow(), frange_arithmetic(), frange_mpfr_arg1(), frange_val_is_max(), frange_val_is_min(), gimple_expand_builtin_pow(), frange::internal_singleton_p(), frange::known_isinf(), operand_compare::operand_equal_p(), frange::operator==(), real_ceil(), real_floor(), real_isinteger(), real_isinteger(), real_to_decimal_for_mode(), simple_cst_equal(), simplify_const_binary_operation(), some_nonzerop(), and tree_call_nonnegative_warnv_p().
void real_inf | ( | REAL_VALUE_TYPE * | r, |
bool | sign ) |
Fills R with Inf with SIGN.
Referenced by init_emit_once(), and foperator_div::rv_fold().
|
inlinestatic |
Determine whether a floating-point value X is a denormal. R is expected to be in denormal form, so this function is only meaningful after a call to round_for_format.
References r, rvc_normal, SIG_MSB, and SIGSZ.
Referenced by encode_arm_bfloat_half(), encode_ieee_double(), encode_ieee_extended(), encode_ieee_half(), encode_ieee_quad(), encode_ieee_single(), frange::flush_denormals_to_zero(), frange_arithmetic(), frange_nextafter(), frange::known_isdenormal_or_zero(), and frange::known_isnormal().
bool real_isfinite | ( | const REAL_VALUE_TYPE * | r | ) |
Determine whether a floating-point value X is finite.
References r, rvc_inf, and rvc_nan.
Referenced by do_mpc_arg1(), do_mpc_arg2(), do_mpc_arg2(), do_mpc_ckconv(), do_mpc_ckconv(), do_mpfr_arg1(), do_mpfr_arg2(), do_mpfr_arg2(), do_mpfr_arg3(), do_mpfr_ckconv(), do_mpfr_ckconv(), do_mpfr_lgamma_r(), do_mpfr_remquo(), do_mpfr_sincos(), float_widen_lhs_range(), fold_const_call_ss(), fold_const_conversion(), cfn_sincos::fold_range(), frange_mpfr_arg1(), cfn_sqrt::op1_range(), and tree_expr_finite_p().
bool real_isinf | ( | const REAL_VALUE_TYPE * | r | ) |
Determine whether a floating-point value X is infinite.
Referenced by build_gt(), build_lt(), float_binary_op_range_finish(), float_widen_lhs_range(), fold_const_builtin_load_exponent(), fold_const_call_cc(), fold_const_call_ss(), cfn_isinf::fold_range(), frange_arithmetic(), frange::internal_singleton_p(), frange::known_isfinite(), frange::known_isinf(), frange::maybe_isinf(), foperator_div::op1_range(), operator_mult::op1_range(), foperator_div::op2_range(), vrange_printer::print_real_value(), real_isinf(), foperator_div::rv_fold(), operator_minus::rv_fold(), operator_mult::rv_fold(), operator_plus::rv_fold(), singleton_inf_p(), tree_expr_infinite_p(), tree_expr_maybe_infinite_p(), and ubsan_instrument_float_cast().
bool real_isinf | ( | const REAL_VALUE_TYPE * | r, |
bool | sign ) |
Determine whether a floating-point value X is infinite with SIGN.
References r, and real_isinf().
bool real_isinteger | ( | const REAL_VALUE_TYPE * | c, |
format_helper | fmt ) |
Check whether the real constant value given is an integer. Returns false for signaling NaN.
References real_identical(), real_trunc(), and REAL_VALUE_TYPE.
Referenced by do_mpfr_lgamma_r(), integer_valued_real_single_p(), and optimize_pow_to_exp().
bool real_isinteger | ( | const REAL_VALUE_TYPE * | c, |
HOST_WIDE_INT * | int_out ) |
Check whether C is an integer that fits in a HOST_WIDE_INT, storing it in *INT_OUT if so.
References real_from_integer(), real_identical(), real_to_integer(), REAL_VALUE_TYPE, and SIGNED.
bool real_isnan | ( | const REAL_VALUE_TYPE * | r | ) |
Determine whether a floating-point value X is a NaN.
Referenced by frange::contains_p(), fold_const_call_ss(), fold_relational_const(), range_query::get_tree_range(), vrange_printer::print_real_value(), real_issignaling_nan(), foperator_div::rv_fold(), operator_minus::rv_fold(), operator_mult::rv_fold(), operator_plus::rv_fold(), frange::set(), tree_expr_maybe_nan_p(), tree_expr_nan_p(), and frange::verify_range().
bool real_isneg | ( | const REAL_VALUE_TYPE * | r | ) |
Determine whether a floating-point value X is negative.
References r.
Referenced by attempt_builtin_copysign(), frange::combine_zeros(), const_with_all_bytes_same(), do_mpfr_lgamma_r(), expand_copysign(), frange::flush_denormals_to_zero(), fold_const_call_ss(), cfn_constant_float_p::fold_range(), cfn_sincos::fold_range(), frange_arithmetic(), range_query::get_tree_range(), frange::known_isnormal(), operator_mult::rv_fold(), signbit_known_p(), and singleton_inf_p().
bool real_isnegzero | ( | const REAL_VALUE_TYPE * | r | ) |
Determine whether a floating-point value X is minus zero.
Referenced by find_range().
bool real_issignaling_nan | ( | const REAL_VALUE_TYPE * | r | ) |
Determine whether a floating-point value X is a signaling NaN.
References r, and real_isnan().
Referenced by fold_const_call_ss(), tree_expr_maybe_signaling_nan_p(), and tree_expr_signaling_nan_p().
bool real_iszero | ( | const REAL_VALUE_TYPE * | r | ) |
Determine whether a floating-point value X is plus or minus zero.
Referenced by frange::combine_zeros(), frange::contains_p(), find_range(), operator_abs::fold_range(), operator_equal::fold_range(), operator_not_equal::fold_range(), frange_add_zeros(), frange_arithmetic(), frange_nextafter(), frange::known_isdenormal_or_zero(), frange::known_isnormal(), real_iszero(), frange::set(), frange::verify_range(), frange::zero_p(), and zero_p().
bool real_iszero | ( | const REAL_VALUE_TYPE * | r, |
bool | sign ) |
Determine whether a floating-point value X is zero with SIGN.
References r, and real_iszero().
void real_ldexp | ( | REAL_VALUE_TYPE * | r, |
const REAL_VALUE_TYPE * | op0, | ||
int | exp ) |
R = OP0 * 2**EXP.
References exp(), gcc_unreachable, get_inf(), get_zero(), MAX_EXP, r, REAL_EXP, rvc_inf, rvc_nan, rvc_normal, rvc_zero, and SET_REAL_EXP.
Referenced by fold_const_builtin_load_exponent().
bool real_less | ( | const REAL_VALUE_TYPE * | op0, |
const REAL_VALUE_TYPE * | op1 ) |
Return whether OP0 < OP1.
References do_compare().
Referenced by check_pow(), find_range(), fold_convert_const_int_from_real(), cfn_sincos::fold_range(), cfn_sqrt::fold_range(), operator_lt::fold_range(), frange_arithmetic(), frange_mpfr_arg1(), gen_conditions_for_pow_cst_base(), frange::intersect(), cfn_sincos::op1_range(), cfn_sqrt::op1_range(), real_compare(), frange::set(), simplify_const_relational_operation(), simplify_const_unary_operation(), frange::union_(), and frange::verify_range().
void real_maxval | ( | REAL_VALUE_TYPE * | r, |
int | sign, | ||
machine_mode | mode ) |
Fills R with the largest finite value representable in mode MODE. If SIGN is nonzero, R is set to the most negative finite value.
References real_format::b, clear_significand_below(), clear_significand_bit(), decimal_real_maxval(), real_format::emax, gcc_assert, real_format::p, real_format::pnan, r, REAL_MODE_FORMAT, rvc_normal, SET_REAL_EXP, SIGNIFICAND_BITS, and SIGSZ.
Referenced by build_sinatan_real(), and omp_reduction_init_op().
bool real_nan | ( | REAL_VALUE_TYPE * | r, |
const char * | str, | ||
int | quiet, | ||
format_helper | fmt ) |
Fills R with a NaN whose significand is described by STR. If QUIET, we force a QNaN, else we force an SNaN. The string, if not empty, is parsed as a number and placed in the significand. Return true if the string was successfully parsed.
References add_significands(), gcc_unreachable, get_canonical_qnan(), get_canonical_snan(), get_zero(), lshift_significand(), lshift_significand_1(), real_format::pnan, r, REAL_VALUE_TYPE, rvc_nan, SIGNIFICAND_BITS, and SIGSZ.
Referenced by fold_const_builtin_nan(), and real_from_mpfr().
bool real_nextafter | ( | REAL_VALUE_TYPE * | r, |
format_helper | fmt, | ||
const REAL_VALUE_TYPE * | x, | ||
const REAL_VALUE_TYPE * | y ) |
Calculate nextafter (X, Y) or nexttoward (X, Y). Return true if underflow or overflow needs to be raised.
References add_significands(), clear_significand_below(), clear_significand_bit(), do_compare(), real_format::emax, real_format::emin, gcc_assert, get_canonical_qnan(), get_inf(), get_zero(), i, normalize(), real_format::p, r, real_convert(), REAL_EXP, REAL_VALUE_TYPE, rvc_inf, rvc_normal, rvc_zero, SET_REAL_EXP, set_significand_bit(), SIG_MSB, SIGNIFICAND_BITS, SIGSZ, sub_significands(), and y.
Referenced by fold_const_nextafter(), frange_arithmetic(), and frange_nextafter().
bool real_powi | ( | REAL_VALUE_TYPE * | r, |
format_helper | fmt, | ||
const REAL_VALUE_TYPE * | x, | ||
HOST_WIDE_INT | n ) |
Calculate X raised to the integer exponent N in format FMT and store the result in R. Return true if the result may be inexact due to loss of precision. The algorithm is the classic "left-to-right binary method" described in section 4.6.3 of Donald Knuth's "Seminumerical Algorithms", "The Art of Computer Programming", Volume 2.
References dconst1, do_divide(), do_multiply(), HOST_BITS_PER_WIDE_INT, HOST_WIDE_INT_1U, i, r, real_convert(), and REAL_VALUE_TYPE.
Referenced by fold_const_call_sss(), and fold_const_pow().
void real_round | ( | REAL_VALUE_TYPE * | r, |
format_helper | fmt, | ||
const REAL_VALUE_TYPE * | x ) |
Round X to the nearest integer, but round halfway cases away from zero.
References dconsthalf, do_add(), do_fix_trunc(), r, and real_convert().
Referenced by fold_const_call_ss(), fold_const_call_ss(), gimple_expand_builtin_pow(), and real_roundeven().
void real_roundeven | ( | REAL_VALUE_TYPE * | r, |
format_helper | fmt, | ||
const REAL_VALUE_TYPE * | x ) |
Round X to nearest integer, rounding halfway cases towards even.
References clear_significand_below(), dconsthalf, dconstm1, do_add(), is_even(), is_halfway_below(), r, real_convert(), REAL_EXP, real_round(), and SIGNIFICAND_BITS.
Referenced by fold_const_call_ss().
void real_to_decimal | ( | char * | str, |
const REAL_VALUE_TYPE * | r_orig, | ||
size_t | buf_size, | ||
size_t | digits, | ||
int | crop_trailing_zeros ) |
Likewise, except always uses round-to-nearest.
References real_to_decimal_for_mode().
Referenced by decimal_from_binary(), decimal_to_binary(), dump_generic_node(), dump_real(), expand_pow_as_sqrts(), fixed_to_decimal(), print_real_cst(), rtx_writer::print_rtx(), and print_value().
void real_to_decimal_for_mode | ( | char * | str, |
const REAL_VALUE_TYPE * | r_orig, | ||
size_t | buf_size, | ||
size_t | digits, | ||
int | crop_trailing_zeros, | ||
machine_mode | mode ) |
Render R as a decimal floating point constant, rounded so as to be parsed back to the same value when interpreted in mode MODE.
References cmp_significand_0(), cmp_significands(), decimal_real_to_decimal(), do_compare(), do_divide(), do_fix_trunc(), do_multiply(), floor_log2(), gcc_assert, gcc_unreachable, last, M_LOG10_2, NULL, real_format::p, r, real_convert(), real_digit(), REAL_EXP, real_from_string(), real_identical(), REAL_MODE_FORMAT, REAL_VALUE_TYPE, real_format::round_towards_zero, round_up, rtd_divmod(), rvc_inf, rvc_nan, rvc_normal, rvc_zero, SET_REAL_EXP, SIGNIFICAND_BITS, ten_to_mptwo(), and ten_to_ptwo().
Referenced by vrange_printer::print_real_value(), and real_to_decimal().
void real_to_hexadecimal | ( | char * | str, |
const REAL_VALUE_TYPE * | r, | ||
size_t | buf_size, | ||
size_t | digits, | ||
int | crop_trailing_zeros ) |
Render R as a hexadecimal floating point constant. Emit DIGITS significant digits in the result, bounded by BUF_SIZE. If DIGITS is 0, choose the maximum for the representation. If CROP_TRAILING_ZEROS, strip trailing zeros.
References exp(), gcc_assert, gcc_unreachable, HOST_BITS_PER_LONG, i, real_format::p, r, REAL_EXP, rvc_inf, rvc_nan, rvc_normal, rvc_zero, SIGNIFICAND_BITS, and SIGSZ.
Referenced by debug(), mpfr_from_real(), vrange_printer::print_real_value(), and rtx_writer::print_rtx().
HOST_WIDE_INT real_to_integer | ( | const REAL_VALUE_TYPE * | r | ) |
Render R as an integer.
References decimal_real_to_integer(), gcc_assert, gcc_unreachable, HOST_BITS_PER_LONG, HOST_BITS_PER_WIDE_INT, HOST_WIDE_INT_1U, i, r, REAL_EXP, rvc_inf, rvc_nan, rvc_normal, rvc_zero, and SIGSZ.
Referenced by acceptable_pow_call(), decimal_real_to_integer(), decimal_real_to_integer(), decrement_power(), expand_pow_as_sqrts(), expr_expected_value_1(), fixed_convert_from_real(), fixed_from_string(), fold_const_conversion(), fold_const_pow(), fold_convert_const(), fold_convert_const_int_from_real(), get_upper_bound_based_on_builtin_expr_with_prob(), gimple_expand_builtin_pow(), real_isinteger(), simplify_const_unary_operation(), and tree_call_nonnegative_warnv_p().
wide_int real_to_integer | ( | const REAL_VALUE_TYPE * | r, |
bool * | fail, | ||
int | precision ) |
Likewise, but producing a wide-int of PRECISION. If the value cannot be represented in precision, *FAIL is set to TRUE.
References decimal_real_to_integer(), exp(), wide_int_storage::from(), wide_int_storage::from_array(), gcc_assert, gcc_unreachable, HOST_BITS_PER_LONG, HOST_BITS_PER_WIDE_INT, i, wi::lrshift(), r, REAL_EXP, rvc_inf, rvc_nan, rvc_normal, rvc_zero, wi::set_bit_in_zero(), SIGSZ, UNLIKELY, UNSIGNED, WIDE_INT_MAX_INL_ELTS, and wi::zero().
long real_to_target | ( | long * | buf, |
const REAL_VALUE_TYPE * | r_orig, | ||
format_helper | fmt ) |
Write R to the given target format. Place the words of the result in target word order in BUF. There are always 32 bits in each long, no matter the size of the host long. Legacy: return word 0 for implementing REAL_VALUE_TO_TARGET_SINGLE.
References real_format::encode, r, REAL_VALUE_TYPE, and round_for_format().
Referenced by assemble_real(), insert_float(), native_encode_real(), native_encode_rtx(), simplify_const_binary_operation(), and simplify_const_unary_operation().
void real_trunc | ( | REAL_VALUE_TYPE * | r, |
format_helper | fmt, | ||
const REAL_VALUE_TYPE * | x ) |
Round X to the nearest integer not larger in absolute value, i.e. towards zero, placing the result in R in format FMT.
References do_fix_trunc(), r, and real_convert().
Referenced by fold_builtin_modf(), fold_const_call_ss(), fold_convert_const_int_from_real(), and real_isinteger().
REAL_VALUE_TYPE real_value_abs | ( | const REAL_VALUE_TYPE * | op0 | ) |
References NULL, r, real_arithmetic(), and REAL_VALUE_TYPE.
Referenced by expand_pow_as_sqrts(), operator_abs::fold_range(), and simplify_const_unary_operation().
REAL_VALUE_TYPE real_value_negate | ( | const REAL_VALUE_TYPE * | op0 | ) |
References NULL, r, real_arithmetic(), and REAL_VALUE_TYPE.
Referenced by check_real_for_fixed_mode(), fold_abs_const(), fold_const_call_ssss(), fold_negate_const(), operator_negate::fold_range(), operator_abs::op1_range(), real_from_mpfr(), real_min_representable(), and simplify_const_unary_operation().
REAL_VALUE_TYPE real_value_truncate | ( | format_helper | fmt, |
REAL_VALUE_TYPE | a ) |
Legacy. Likewise, except return the struct directly.
References a, r, real_convert(), and REAL_VALUE_TYPE.
Referenced by build_real_truncate(), fold_const_builtin_load_exponent(), gimple_expand_builtin_pow(), and simplify_const_unary_operation().
|
static |
References add_significands(), real_format::b, clear_significand_below(), decimal_real_convert(), decimal_round_for_format(), real_format::emax, real_format::emin, gcc_unreachable, get_inf(), get_zero(), real_format::has_denorm, real_format::has_signed_zero, HOST_BITS_PER_LONG, i, real_format::p, r, REAL_EXP, REAL_MODE_FORMAT, REAL_VALUE_TYPE, real_format::round_towards_zero, round_up, rvc_inf, rvc_nan, rvc_normal, rvc_zero, SET_REAL_EXP, set_significand_bit(), SIG_MSB, SIGNIFICAND_BITS, SIGSZ, sticky_rshift_significand(), and test_significand_bit().
Referenced by encode_ibm_extended(), real_convert(), and real_to_target().
|
static |
Right-shift the significand of A by N bits; put the result in the significand of R.
References a, HOST_BITS_PER_LONG, i, r, and SIGSZ.
Referenced by encode_ieee_quad().
|
static |
A subroutine of real_to_decimal. Compute the quotient and remainder of NUM / DEN. Return the quotient and place the remainder in NUM. It is expected that NUM / DEN are close enough that the quotient is small.
References cmp_significands(), lshift_significand_1(), normalize(), REAL_EXP, SET_REAL_EXP, SIG_MSB, SIGSZ, and sub_significands().
Referenced by decimal_integer_string(), and real_to_decimal_for_mode().
|
inlinestatic |
Set bit N of the significand of R.
References HOST_BITS_PER_LONG, and r.
Referenced by div_significands(), real_nextafter(), and round_for_format().
int significand_size | ( | format_helper | fmt | ) |
Return the number of bits of the largest binary value that the significand of FMT will hold.
??? Legacy. Should get access to real_format directly.
References real_format::b, NULL, and real_format::p.
Referenced by format_helper::can_represent_integral_type_p(), exact_int_to_float_conversion_p(), and expand_float().
|
static |
Right-shift the significand of A by N bits; put the result in the significand of R. If any one bits are shifted out, return true.
References a, HOST_BITS_PER_LONG, i, r, and SIGSZ.
Referenced by do_add(), and round_for_format().
|
inlinestatic |
Subtract the significands of A and B, placing the result in R. CARRY is true if there's a borrow incoming to the least significant word. Return true if there was borrow out of the most significant word.
References a, b, i, r, and SIGSZ.
Referenced by div_significands(), do_add(), real_nextafter(), and rtd_divmod().
|
static |
Returns 10**(-2**N).
References do_divide(), EXP_BITS, gcc_assert, real_digit(), REAL_VALUE_TYPE, rvc_zero, and ten_to_ptwo().
Referenced by real_to_decimal_for_mode().
|
static |
Returns 10**2**N.
References do_multiply(), EXP_BITS, gcc_assert, HOST_BITS_PER_WIDE_INT, i, real_from_integer(), REAL_VALUE_TYPE, rvc_zero, ten_to_ptwo(), and UNSIGNED.
Referenced by real_to_decimal_for_mode(), ten_to_mptwo(), ten_to_ptwo(), and times_pten().
|
inlinestatic |
Test bit N of the significand of R.
References HOST_BITS_PER_LONG, and r.
Referenced by round_for_format().
|
static |
Multiply R by 10**EXP.
References do_divide(), do_multiply(), exp(), i, r, real_digit(), REAL_VALUE_TYPE, and ten_to_ptwo().
Referenced by decimal_integer_string().
const struct real_format arm_bfloat_half_format |
ARM Bfloat half-precision format. This format resembles a truncated (16-bit) version of the 32-bit IEEE 754 single-precision floating-point format.
Referenced by build_common_tree_nodes(), convert_mode_scalar(), expand_fix(), and gen_trunc_conv_libfunc().
const struct real_format arm_half_format |
ARM's alternative half-precision format, similar to IEEE but with no reserved exponent value for NaNs and infinities; rather, it just extends the range of exponents by one.
const struct real_format decimal_double_format |
Double precision decimal floating point (IEEE 754).
Referenced by decimal_round_for_format().
const struct real_format decimal_quad_format |
Quad precision decimal floating point (IEEE 754).
Referenced by decimal_round_for_format().
const struct real_format decimal_single_format |
Single precision decimal floating point (IEEE 754).
Referenced by decimal_round_for_format().
const struct real_format ibm_extended_format |
Referenced by convert_mode_scalar(), and gen_trunc_conv_libfunc().
const struct real_format ieee_double_format |
Referenced by check_target_format(), decode_ibm_extended(), encode_ibm_extended(), and glibc_linux_libm_function_max_error().
const struct real_format ieee_extended_intel_128_format |
Referenced by check_target_format(), and glibc_linux_libm_function_max_error().
const struct real_format ieee_extended_intel_96_format |
Referenced by check_target_format(), and glibc_linux_libm_function_max_error().
const struct real_format ieee_extended_intel_96_round_53_format |
The following caters to i386 systems that set the rounding precision to 53 bits instead of 64, e.g. FreeBSD.
Referenced by check_target_format().
const struct real_format ieee_extended_motorola_format |
Referenced by check_target_format(), and glibc_linux_libm_function_max_error().
const struct real_format ieee_half_format |
Half-precision format, as specified in IEEE 754R.
Referenced by convert_mode_scalar(), and gen_trunc_conv_libfunc().
const struct real_format ieee_quad_format |
Referenced by check_target_format(), convert_mode_scalar(), gen_trunc_conv_libfunc(), and glibc_linux_libm_function_max_error().
const struct real_format ieee_single_format |
Target formats defined in real.cc.
Referenced by check_target_format(), convert_mode_scalar(), expand_fix(), and glibc_linux_libm_function_max_error().
const struct real_format mips_double_format |
Referenced by check_target_format(), decode_ibm_extended(), encode_ibm_extended(), and glibc_linux_libm_function_max_error().
const struct real_format mips_extended_format |
const struct real_format mips_quad_format |
Referenced by check_target_format(), and glibc_linux_libm_function_max_error().
const struct real_format mips_single_format |
Referenced by check_target_format(), and glibc_linux_libm_function_max_error().
const struct real_format motorola_double_format |
Referenced by check_target_format(), and glibc_linux_libm_function_max_error().
const struct real_format motorola_single_format |
Referenced by check_target_format(), and glibc_linux_libm_function_max_error().
const struct real_format real_internal_format |
const struct real_format spu_single_format |
SPU Single Precision (Extended-Range Mode) format is the same as IEEE single precision with the following differences: - Infinities are not supported. Instead MAX_FLOAT or MIN_FLOAT are generated. - NaNs are not supported. - The range of non-zero numbers in binary is (001)[1.]000...000 to (255)[1.]111...111. - Denormals can be represented, but are treated as +0.0 when used as an operand and are never generated as a result. - -0.0 can be represented, but a zero result is always +0.0. - the only supported rounding mode is trunction (towards zero).
const struct real_format vax_d_format |
const struct real_format vax_f_format |
const struct real_format vax_g_format |