GCC Middle and Back End API Reference
|
Functions | |
static void | get_zero (REAL_VALUE_TYPE *, int) |
static void | get_canonical_qnan (REAL_VALUE_TYPE *, int) |
static void | get_canonical_snan (REAL_VALUE_TYPE *, int) |
static void | get_inf (REAL_VALUE_TYPE *, int) |
static bool | sticky_rshift_significand (REAL_VALUE_TYPE *, const REAL_VALUE_TYPE *, unsigned int) |
static void | rshift_significand (REAL_VALUE_TYPE *, const REAL_VALUE_TYPE *, unsigned int) |
static void | lshift_significand (REAL_VALUE_TYPE *, const REAL_VALUE_TYPE *, unsigned int) |
static void | lshift_significand_1 (REAL_VALUE_TYPE *, const REAL_VALUE_TYPE *) |
static bool | add_significands (REAL_VALUE_TYPE *r, const REAL_VALUE_TYPE *, const REAL_VALUE_TYPE *) |
static bool | sub_significands (REAL_VALUE_TYPE *, const REAL_VALUE_TYPE *, const REAL_VALUE_TYPE *, int) |
static void | neg_significand (REAL_VALUE_TYPE *, const REAL_VALUE_TYPE *) |
static int | cmp_significands (const REAL_VALUE_TYPE *, const REAL_VALUE_TYPE *) |
static int | cmp_significand_0 (const REAL_VALUE_TYPE *) |
static void | set_significand_bit (REAL_VALUE_TYPE *, unsigned int) |
static void | clear_significand_bit (REAL_VALUE_TYPE *, unsigned int) |
static bool | test_significand_bit (REAL_VALUE_TYPE *, unsigned int) |
static void | clear_significand_below (REAL_VALUE_TYPE *, unsigned int) |
static bool | div_significands (REAL_VALUE_TYPE *, const REAL_VALUE_TYPE *, const REAL_VALUE_TYPE *) |
static void | normalize (REAL_VALUE_TYPE *) |
static bool | do_add (REAL_VALUE_TYPE *, const REAL_VALUE_TYPE *, const REAL_VALUE_TYPE *, int) |
static bool | do_multiply (REAL_VALUE_TYPE *, const REAL_VALUE_TYPE *, const REAL_VALUE_TYPE *) |
static bool | do_divide (REAL_VALUE_TYPE *, const REAL_VALUE_TYPE *, const REAL_VALUE_TYPE *) |
static int | do_compare (const REAL_VALUE_TYPE *, const REAL_VALUE_TYPE *, int) |
static void | do_fix_trunc (REAL_VALUE_TYPE *, const REAL_VALUE_TYPE *) |
static unsigned long | rtd_divmod (REAL_VALUE_TYPE *, REAL_VALUE_TYPE *) |
static void | decimal_from_integer (REAL_VALUE_TYPE *) |
static void | decimal_integer_string (char *, const REAL_VALUE_TYPE *, size_t) |
static const REAL_VALUE_TYPE * | ten_to_ptwo (int) |
static const REAL_VALUE_TYPE * | ten_to_mptwo (int) |
static const REAL_VALUE_TYPE * | real_digit (int) |
static void | times_pten (REAL_VALUE_TYPE *, int) |
static void | round_for_format (const struct real_format *, REAL_VALUE_TYPE *) |
static void | get_zero () |
static void | get_canonical_qnan () |
static void | get_canonical_snan () |
static void | get_inf () |
static void | lshift_significand_1 () |
static void | neg_significand () |
static int | cmp_significands () |
static int | cmp_significand_0 () |
static void | set_significand_bit () |
static void | clear_significand_bit () |
static bool | test_significand_bit () |
static void | clear_significand_below () |
static void | normalize () |
static void | do_fix_trunc () |
bool | real_arithmetic (REAL_VALUE_TYPE *r, int icode, const REAL_VALUE_TYPE *op0, const REAL_VALUE_TYPE *op1) |
REAL_VALUE_TYPE | real_value_negate () |
REAL_VALUE_TYPE | real_value_abs () |
bool | real_compare (int icode, const REAL_VALUE_TYPE *op0, const REAL_VALUE_TYPE *op1) |
int | real_exponent () |
void | real_ldexp () |
bool | real_isinf () |
bool | real_isnan () |
bool | real_isfinite () |
bool | real_isneg () |
bool | real_isnegzero () |
bool | real_identical () |
bool | exact_real_inverse () |
bool | real_can_shorten_arithmetic () |
HOST_WIDE_INT | real_to_integer () |
void | real_to_integer2 (HOST_WIDE_INT *plow, HOST_WIDE_INT *phigh, const REAL_VALUE_TYPE *r) |
static unsigned long | rtd_divmod () |
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, enum machine_mode mode) |
void | real_to_decimal (char *str, const REAL_VALUE_TYPE *r_orig, size_t buf_size, size_t digits, int crop_trailing_zeros) |
void | real_to_hexadecimal (char *str, const REAL_VALUE_TYPE *r, size_t buf_size, size_t digits, int crop_trailing_zeros) |
int | real_from_string () |
REAL_VALUE_TYPE | real_from_string2 () |
void | real_from_string3 () |
void | real_from_integer (REAL_VALUE_TYPE *r, enum machine_mode mode, unsigned HOST_WIDE_INT low, HOST_WIDE_INT high, int unsigned_p) |
static void | decimal_from_integer () |
static const REAL_VALUE_TYPE * | ten_to_ptwo () |
static const REAL_VALUE_TYPE * | ten_to_mptwo () |
static const REAL_VALUE_TYPE * | real_digit () |
static void | times_pten () |
const REAL_VALUE_TYPE * | dconst_e_ptr () |
const REAL_VALUE_TYPE * | dconst_third_ptr () |
const REAL_VALUE_TYPE * | dconst_sqrt2_ptr () |
void | real_inf () |
bool | real_nan (REAL_VALUE_TYPE *r, const char *str, int quiet, enum machine_mode mode) |
void | real_maxval () |
void | real_2expN () |
static void | round_for_format () |
void | real_convert (REAL_VALUE_TYPE *r, enum machine_mode mode, const REAL_VALUE_TYPE *a) |
REAL_VALUE_TYPE | real_value_truncate () |
bool | exact_real_truncate () |
long | real_to_target_fmt (long *buf, const REAL_VALUE_TYPE *r_orig, const struct real_format *fmt) |
long | real_to_target () |
void | real_from_target_fmt (REAL_VALUE_TYPE *r, const long *buf, const struct real_format *fmt) |
void | real_from_target () |
int | significand_size () |
unsigned int | real_hash () |
static void | encode_ieee_single (const struct real_format *fmt, long *, const REAL_VALUE_TYPE *) |
static void | decode_ieee_single (const struct real_format *, REAL_VALUE_TYPE *, const long *) |
static void | encode_ieee_double (const struct real_format *fmt, long *, const REAL_VALUE_TYPE *) |
static void | decode_ieee_double (const struct real_format *, REAL_VALUE_TYPE *, const long *) |
static void | encode_ieee_extended (const struct real_format *fmt, long *buf, const REAL_VALUE_TYPE *r) |
static void | encode_ieee_extended_motorola (const struct real_format *fmt, long *buf, const REAL_VALUE_TYPE *r) |
static void | encode_ieee_extended_intel_96 (const struct real_format *fmt, long *buf, const REAL_VALUE_TYPE *r) |
static void | encode_ieee_extended_intel_128 (const struct real_format *fmt, long *buf, const REAL_VALUE_TYPE *r) |
static void | decode_ieee_extended (const struct real_format *fmt, REAL_VALUE_TYPE *r, const long *buf) |
static void | decode_ieee_extended_motorola (const struct real_format *fmt, REAL_VALUE_TYPE *r, const long *buf) |
static void | decode_ieee_extended_intel_96 (const struct real_format *fmt, REAL_VALUE_TYPE *r, const long *buf) |
static void | decode_ieee_extended_intel_128 (const struct real_format *fmt, REAL_VALUE_TYPE *r, const long *buf) |
static void | encode_ibm_extended (const struct real_format *fmt, long *, const REAL_VALUE_TYPE *) |
static void | decode_ibm_extended (const struct real_format *, REAL_VALUE_TYPE *, const long *) |
static void | encode_ieee_quad (const struct real_format *fmt, long *, const REAL_VALUE_TYPE *) |
static void | decode_ieee_quad (const struct real_format *, REAL_VALUE_TYPE *, const long *) |
static void | encode_vax_f (const struct real_format *fmt, long *, const REAL_VALUE_TYPE *) |
static void | decode_vax_f (const struct real_format *, REAL_VALUE_TYPE *, const long *) |
static void | encode_vax_d (const struct real_format *fmt, long *, const REAL_VALUE_TYPE *) |
static void | decode_vax_d (const struct real_format *, REAL_VALUE_TYPE *, const long *) |
static void | encode_vax_g (const struct real_format *fmt, long *, const REAL_VALUE_TYPE *) |
static void | decode_vax_g (const struct real_format *, REAL_VALUE_TYPE *, const long *) |
static void | encode_decimal_single (const struct real_format *fmt, long *buf, const REAL_VALUE_TYPE *r) |
static void | decode_decimal_single (const struct real_format *fmt, REAL_VALUE_TYPE *r, const long *buf) |
static void | encode_decimal_double (const struct real_format *fmt, long *buf, const REAL_VALUE_TYPE *r) |
static void | decode_decimal_double (const struct real_format *fmt, REAL_VALUE_TYPE *r, const long *buf) |
static void | encode_decimal_quad (const struct real_format *fmt, long *buf, const REAL_VALUE_TYPE *r) |
static void | decode_decimal_quad (const struct real_format *fmt, REAL_VALUE_TYPE *r, const long *buf) |
static void | encode_ieee_half (const struct real_format *fmt, long *buf, const REAL_VALUE_TYPE *r) |
static void | decode_ieee_half (const struct real_format *fmt, REAL_VALUE_TYPE *r, const long *buf) |
static void | encode_internal (const struct real_format *fmt, long *, const REAL_VALUE_TYPE *) |
static void | decode_internal (const struct real_format *, REAL_VALUE_TYPE *, const long *) |
bool | real_sqrt (REAL_VALUE_TYPE *r, enum machine_mode mode, const REAL_VALUE_TYPE *x) |
bool | real_powi (REAL_VALUE_TYPE *r, enum machine_mode mode, const REAL_VALUE_TYPE *x, HOST_WIDE_INT n) |
void | real_trunc (REAL_VALUE_TYPE *r, enum machine_mode mode, const REAL_VALUE_TYPE *x) |
void | real_floor (REAL_VALUE_TYPE *r, enum machine_mode mode, const REAL_VALUE_TYPE *x) |
void | real_ceil (REAL_VALUE_TYPE *r, enum machine_mode mode, const REAL_VALUE_TYPE *x) |
void | real_round (REAL_VALUE_TYPE *r, enum machine_mode mode, const REAL_VALUE_TYPE *x) |
void | real_copysign () |
bool | real_isinteger () |
void | get_max_float () |
Variables | |
struct real_format | ieee_single_format |
struct real_format | mips_single_format |
struct real_format | motorola_single_format |
struct real_format | spu_single_format |
struct real_format | ieee_double_format |
struct real_format | mips_double_format |
struct real_format | motorola_double_format |
struct real_format | ieee_extended_motorola_format |
struct real_format | ieee_extended_intel_96_format |
struct real_format | ieee_extended_intel_128_format |
struct real_format | ieee_extended_intel_96_round_53_format |
struct real_format | ibm_extended_format |
struct real_format | mips_extended_format |
struct real_format | ieee_quad_format |
struct real_format | mips_quad_format |
struct real_format | vax_f_format |
struct real_format | vax_d_format |
struct real_format | vax_g_format |
struct real_format | decimal_single_format |
struct real_format | decimal_double_format |
struct real_format | decimal_quad_format |
struct real_format | ieee_half_format |
struct real_format | arm_half_format |
struct real_format | real_internal_format |
|
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.
Referenced by do_add(), real_nan(), and round_for_format().
|
static |
Referenced by do_fix_trunc(), real_maxval(), and round_for_format().
|
static |
Clear bits 0..N-1 of the significand of R.
References HOST_BITS_PER_LONG.
|
static |
Referenced by real_maxval().
|
inlinestatic |
Clear bit N of the significand of R.
References HOST_BITS_PER_LONG.
|
static |
Referenced by real_from_string(), and real_to_decimal_for_mode().
|
inlinestatic |
Return true if A is nonzero.
|
static |
Referenced by div_significands(), do_compare(), real_to_decimal_for_mode(), and rtd_divmod().
|
inlinestatic |
Compare significands. Return tri-state vs zero.
const REAL_VALUE_TYPE* dconst_e_ptr | ( | void | ) |
Returns the special REAL_VALUE_TYPE corresponding to 'e'.
References real_from_mpfr(), and rvc_zero.
const REAL_VALUE_TYPE* dconst_sqrt2_ptr | ( | void | ) |
Returns the special REAL_VALUE_TYPE corresponding to sqrt(2).
References real_from_mpfr(), and rvc_zero.
const REAL_VALUE_TYPE* dconst_third_ptr | ( | void | ) |
Returns the special REAL_VALUE_TYPE corresponding to 1/3.
References dconst1, real_arithmetic(), real_digit(), and rvc_zero.
Referenced by fold_builtin_cbrt().
|
static |
Referenced by real_from_integer().
|
static |
Convert a real with an integral value to decimal float.
References decimal_integer_string(), and decimal_real_from_string().
|
static |
Render R, an integral value, as a floating point constant with no specified exponent.
References real_format::p, real_digit(), rtd_divmod(), rvc_zero, and times_pten().
Referenced by decimal_from_integer().
|
static |
Decode a double precision DFP value in BUF into a real R.
References decode_decimal64().
|
static |
Decode a quad precision DFP value in BUF into a real R.
References decode_decimal128().
|
static |
Decode a single precision DFP value in BUF into a real R.
References decode_decimal32().
|
static |
References decode_ieee_double(), do_add(), mips_double_format, real_format::qnan_msb_set, rvc_inf, rvc_nan, and rvc_zero.
|
static |
References exp(), real_format::has_denorm, real_format::has_inf, real_format::has_nans, real_format::has_signed_zero, HOST_BITS_PER_LONG, memset(), normalize(), real_format::qnan_msb_set, rvc_inf, rvc_nan, and rvc_normal.
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, memset(), normalize(), real_format::qnan_msb_set, rvc_inf, rvc_nan, and rvc_normal.
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().
|
static |
Convert from the internal format to the 12-byte Intel format for an IEEE extended real.
References decode_ieee_extended().
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().
|
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, memset(), normalize(), real_format::qnan_msb_set, rvc_inf, rvc_nan, and rvc_normal.
|
static |
|
static |
|
static |
References memcpy().
|
static |
References exp(), HOST_BITS_PER_LONG, lshift_significand(), memset(), and rvc_normal.
|
static |
References exp(), HOST_BITS_PER_LONG, memset(), and rvc_normal.
|
static |
References exp(), HOST_BITS_PER_LONG, lshift_significand(), memset(), and rvc_normal.
|
inlinestatic |
Divide the significands of A and B, placing the result in R. Return true if the division was inexact.
References cmp_significands(), lshift_significand_1(), memset(), set_significand_bit(), 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 add_significands(), exp(), get_canonical_qnan(), get_inf(), get_zero(), neg_significand(), normalize(), rvc_inf, rvc_nan, rvc_normal, rvc_zero, 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_from_string(), real_round(), real_sqrt(), and vect_check_gather().
|
static |
Return a tri-state comparison of A vs B. Return NAN_RESULT if one of the two operands is a NaN.
References cmp_significands(), decimal_do_compare(), rvc_inf, rvc_nan, rvc_normal, and rvc_zero.
Referenced by real_arithmetic(), real_compare(), and real_to_decimal_for_mode().
|
static |
Calculate R = A / B. Return true if the result may be inexact.
References div_significands(), exp(), get_canonical_qnan(), get_inf(), get_zero(), normalize(), rvc_inf, rvc_nan, rvc_normal, and rvc_zero.
Referenced by exact_real_inverse(), real_arithmetic(), real_powi(), real_to_decimal_for_mode(), ten_to_mptwo(), and times_pten().
|
static |
Referenced by real_arithmetic(), real_ceil(), real_floor(), real_round(), real_to_decimal_for_mode(), and real_trunc().
|
static |
Return A truncated to an integral value toward zero.
References clear_significand_below(), decimal_do_fix_trunc(), get_zero(), rvc_inf, rvc_nan, rvc_normal, and rvc_zero.
|
static |
Calculate R = A * B. Return true if the result may be inexact.
References do_add(), exp(), get_canonical_qnan(), get_inf(), get_zero(), HOST_BITS_PER_LONG, memset(), normalize(), rvc_inf, rvc_nan, rvc_normal, and rvc_zero.
Referenced by real_arithmetic(), real_from_string(), real_powi(), real_sqrt(), real_to_decimal_for_mode(), ten_to_ptwo(), and times_pten().
|
static |
Encode real R into a double precision DFP value in BUF.
References encode_decimal64().
|
static |
Encode real R into a quad precision DFP value in BUF.
References encode_decimal128().
|
static |
Encode real R into a single precision DFP value in BUF.
References encode_decimal32().
|
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(), mips_double_format, normalize(), real_format::qnan_msb_set, round_for_format(), and rvc_normal.
|
static |
IEEE double-precision format.
References real_format::canonical_nan_lsbs_set, exp(), real_format::has_inf, real_format::has_nans, HOST_BITS_PER_LONG, real_format::qnan_msb_set, rvc_inf, rvc_nan, rvc_normal, and rvc_zero.
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(), real_format::has_inf, real_format::has_nans, HOST_BITS_PER_LONG, real_format::qnan_msb_set, rvc_inf, rvc_nan, rvc_normal, and rvc_zero.
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().
|
static |
Convert from the internal format to the 12-byte Intel format for an IEEE extended real.
References encode_ieee_extended().
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().
|
static |
Encode half-precision floats. This routine is used both for the IEEE ARM alternative encodings.
References real_format::canonical_nan_lsbs_set, exp(), real_format::has_inf, real_format::has_nans, HOST_BITS_PER_LONG, real_format::qnan_msb_set, rvc_inf, rvc_nan, rvc_normal, and rvc_zero.
|
static |
IEEE quad precision format.
References real_format::canonical_nan_lsbs_set, exp(), real_format::has_inf, real_format::has_nans, HOST_BITS_PER_LONG, real_format::qnan_msb_set, rshift_significand(), rvc_inf, rvc_nan, rvc_normal, and rvc_zero.
|
static |
IEEE single-precision format.
References real_format::canonical_nan_lsbs_set, exp(), real_format::has_inf, real_format::has_nans, HOST_BITS_PER_LONG, real_format::qnan_msb_set, rvc_inf, rvc_nan, rvc_normal, and rvc_zero.
|
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 memcpy().
|
static |
References HOST_BITS_PER_LONG, rvc_inf, rvc_nan, rvc_normal, and rvc_zero.
|
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(), HOST_BITS_PER_LONG, rvc_inf, rvc_nan, rvc_normal, and rvc_zero.
|
static |
References HOST_BITS_PER_LONG, rvc_inf, rvc_nan, rvc_normal, and rvc_zero.
bool exact_real_inverse | ( | ) |
Try to change R into its exact multiplicative inverse in machine mode MODE. Return true if successful.
References do_divide(), real_convert(), real_digit(), and rvc_normal.
Referenced by exact_inverse().
bool exact_real_truncate | ( | ) |
Return true if truncating to MODE is exact.
References real_format::emin, real_convert(), and real_identical().
Referenced by compress_float_constant(), and strip_float_extensions().
|
static |
Referenced by do_add(), do_divide(), do_multiply(), real_from_string(), real_nan(), and real_sqrt().
|
inlinestatic |
|
static |
Referenced by real_from_string(), and real_nan().
|
static |
Referenced by do_add(), do_divide(), do_multiply(), normalize(), real_from_string(), real_inf(), real_ldexp(), and round_for_format().
void get_max_float | ( | ) |
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.
References real_format::emax, real_format::p, real_format::pnan, and strlen().
Referenced by fold_builtin_interclass_mathfn().
|
static |
Referenced by do_add(), do_divide(), do_fix_trunc(), do_multiply(), normalize(), real_from_integer(), real_from_string(), real_ldexp(), real_nan(), and round_for_format().
|
inlinestatic |
Initialize R with a positive zero.
References memset().
|
static |
Left-shift the significand of A by N bits; put the result in the significand of R.
References HOST_BITS_PER_LONG.
Referenced by decode_ieee_quad(), decode_vax_d(), decode_vax_g(), normalize(), and real_nan().
|
static |
Referenced by div_significands(), real_nan(), and rtd_divmod().
|
inlinestatic |
Likewise, but N is specialized to 1.
References HOST_BITS_PER_LONG.
|
static |
Referenced by do_add().
|
inlinestatic |
Negate the significand A, placing the result in R.
|
static |
Referenced by 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_try_addcc(), noce_try_store_flag_constants(), real_convert(), real_from_integer(), real_from_string(), rtd_divmod(), sreal_add(), sreal_div(), sreal_init(), sreal_mul(), and sreal_sub().
|
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, lshift_significand(), rvc_zero, and shift.
void real_2expN | ( | ) |
Fills R with 2**N.
References decimal_real_convert(), memset(), rvc_inf, and rvc_normal.
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(), memset(), and rvc_nan.
Referenced by check_real_for_fixed_mode(), const_binop(), dconst_third_ptr(), distribute_real_division(), fixed_convert_from_real(), fixed_from_string(), fixed_to_decimal(), fold_binary_loc(), fold_builtin_cbrt(), fold_builtin_modf(), gimple_expand_builtin_pow(), omp_reduction_init(), real_convert_from_fixed(), real_value_abs(), real_value_negate(), simplify_const_binary_operation(), and simplify_const_unary_operation().
bool real_can_shorten_arithmetic | ( | ) |
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, real_format::p, and real_format::round_towards_zero.
Referenced by convert_to_real().
void real_ceil | ( | REAL_VALUE_TYPE * | r, |
enum machine_mode | mode, | ||
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 mode MODE.
References dconst1, do_add(), do_fix_trunc(), real_convert(), and real_identical().
Referenced by fold_builtin_ceil(), and fold_builtin_int_roundingfn().
bool real_compare | ( | int | , |
const REAL_VALUE_TYPE * | , | ||
const REAL_VALUE_TYPE * | |||
) |
Compare reals by tree_code.
References do_compare(), and rvc_nan.
Referenced by check_real_for_fixed_mode(), decimal_real_arithmetic(), do_mpfr_arg1(), do_mpfr_bessel_n(), fold_builtin_classify(), and fold_relational_const().
void real_convert | ( | REAL_VALUE_TYPE * | r, |
enum machine_mode | mode, | ||
const REAL_VALUE_TYPE * | a | ||
) |
Extend or truncate to a new mode.
References real_format::b, decimal_real_convert(), normalize(), round_for_format(), and rvc_normal.
Referenced by const_binop(), do_mpc_ckconv(), do_mpfr_ckconv(), exact_real_inverse(), exact_real_truncate(), fold_convert_const_real_from_real(), fold_mathfn_compare(), gimple_expand_builtin_pow(), real_ceil(), real_convert_from_fixed(), real_floor(), real_from_integer(), real_from_string2(), real_from_string3(), real_powi(), real_round(), real_sqrt(), real_to_decimal_for_mode(), real_trunc(), real_value_truncate(), simplify_const_binary_operation(), and simplify_const_unary_operation().
void real_copysign | ( | ) |
Set the sign of R to the sign of X.
Referenced by fold_builtin_copysign().
|
static |
|
static |
Returns N.
References real_from_integer(), and rvc_zero.
int real_exponent | ( | ) |
Return floor log2(R).
References rvc_inf, rvc_nan, rvc_normal, and rvc_zero.
Referenced by real_sqrt().
void real_floor | ( | REAL_VALUE_TYPE * | r, |
enum machine_mode | mode, | ||
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 mode MODE.
References dconstm1, do_add(), do_fix_trunc(), real_convert(), and real_identical().
Referenced by fold_builtin_floor(), and fold_builtin_int_roundingfn().
void real_from_integer | ( | REAL_VALUE_TYPE * | r, |
enum machine_mode | mode, | ||
unsigned HOST_WIDE_INT | low, | ||
HOST_WIDE_INT | high, | ||
int | unsigned_p | ||
) |
Initialize R from the integer pair HIGH+LOW.
References decimal_from_integer(), get_zero(), HOST_BITS_PER_LONG, HOST_BITS_PER_WIDE_INT, memset(), normalize(), real_convert(), and rvc_normal.
Referenced by acceptable_pow_call(), check_pow(), decrement_power(), fixed_to_decimal(), fold_builtin_logarithm(), fold_builtin_pow(), gen_conditions_for_pow_cst_base(), gimple_expand_builtin_pow(), gimple_val_nonnegative_real_p(), real_convert_from_fixed(), real_digit(), real_value_from_int_cst(), simplify_const_unary_operation(), ten_to_ptwo(), and tree_call_nonnegative_warnv_p().
int real_from_string | ( | ) |
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(), do_add(), do_multiply(), exp(), get_canonical_qnan(), get_canonical_snan(), get_inf(), get_zero(), HOST_BITS_PER_LONG, normalize(), real_digit(), rvc_normal, rvc_zero, ten_to_ptwo(), and times_pten().
Referenced by check_real_for_fixed_mode(), decimal_real_to_integer(), decimal_real_to_integer2(), fixed_from_string(), fold_builtin_fpclassify(), fold_builtin_interclass_mathfn(), real_from_mpfr(), real_from_string2(), real_from_string3(), and real_to_decimal_for_mode().
REAL_VALUE_TYPE real_from_string2 | ( | ) |
Legacy. Similar, but return the result directly.
References real_convert(), and real_from_string().
void real_from_string3 | ( | ) |
Initialize R from string S and desired MODE.
References decimal_real_from_string(), real_convert(), and real_from_string().
Referenced by decimal_to_binary().
void real_from_target | ( | ) |
Similar, but look up the format from MODE.
References real_format::decode.
Referenced by native_interpret_real(), simplify_const_binary_operation(), simplify_const_unary_operation(), simplify_immed_subreg(), and vectorizable_load().
void real_from_target_fmt | ( | REAL_VALUE_TYPE * | r, |
const long * | buf, | ||
const struct real_format * | 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.
unsigned int real_hash | ( | ) |
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 HOST_BITS_PER_LONG, rvc_inf, rvc_nan, rvc_normal, and rvc_zero.
Referenced by const_double_htab_hash(), const_hash_1(), const_rtx_hash_1(), cselib_hash_rtx(), hash_rtx_cb(), and iterative_hash_expr().
bool real_identical | ( | ) |
Compare two floating-point objects for bitwise identity.
References rvc_inf, rvc_nan, rvc_normal, and rvc_zero.
Referenced by acceptable_pow_call(), const_binop(), const_double_htab_eq(), do_mpc_ckconv(), do_mpfr_ckconv(), exact_real_truncate(), fold_builtin_pow(), gimple_expand_builtin_pow(), gimple_val_nonnegative_real_p(), real_ceil(), real_floor(), real_isinteger(), real_sqrt(), real_to_decimal_for_mode(), simplify_const_binary_operation(), and tree_call_nonnegative_warnv_p().
void real_inf | ( | ) |
Fills R with +Inf.
References get_inf().
Referenced by build_complex_cproj(), fold_builtin_fpclassify(), fold_builtin_inf(), fold_builtin_logb(), omp_reduction_init(), and real_from_mpfr().
bool real_isfinite | ( | ) |
Determine whether a floating-point value X is finite.
References rvc_inf, and rvc_nan.
Referenced by do_mpc_arg1(), do_mpc_arg2(), do_mpc_ckconv(), do_mpfr_arg1(), do_mpfr_arg2(), do_mpfr_arg3(), do_mpfr_bessel_n(), do_mpfr_ckconv(), do_mpfr_lgamma_r(), do_mpfr_remquo(), do_mpfr_sincos(), fold_builtin_classify(), fold_builtin_int_roundingfn(), fold_builtin_load_exponent(), and real_sqrt().
bool real_isinf | ( | ) |
Determine whether a floating-point value X is infinite.
References rvc_inf.
Referenced by fold_builtin_classify(), fold_builtin_cproj(), fold_builtin_load_exponent(), and fold_builtin_logb().
bool real_isinteger | ( | ) |
Check whether the real constant value given is an integer.
References real_identical(), and real_trunc().
Referenced by do_mpfr_lgamma_r(), and integer_valued_real_p().
bool real_isnan | ( | ) |
Determine whether a floating-point value X is a NaN.
References rvc_nan.
Referenced by fold_builtin_classify(), fold_builtin_fmin_fmax(), fold_relational_const(), and simplify_const_unary_operation().
bool real_isneg | ( | ) |
Determine whether a floating-point value X is negative.
Referenced by do_mpfr_lgamma_r(), expand_copysign(), fold_builtin_logb(), and real_sqrt().
bool real_isnegzero | ( | ) |
Determine whether a floating-point value X is minus zero.
References rvc_zero.
Referenced by real_sqrt().
void real_ldexp | ( | ) |
R = OP0 * 2**EXP.
References get_inf(), get_zero(), rvc_inf, rvc_nan, rvc_normal, and rvc_zero.
Referenced by fold_builtin_load_exponent(), and real_sqrt().
void real_maxval | ( | ) |
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, memset(), real_format::p, real_format::pnan, and rvc_normal.
Referenced by fold_inf_compare(), and omp_reduction_init().
bool real_nan | ( | REAL_VALUE_TYPE * | r, |
const char * | str, | ||
int | quiet, | ||
enum machine_mode | mode | ||
) |
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(), get_canonical_qnan(), get_canonical_snan(), get_zero(), lshift_significand(), lshift_significand_1(), memset(), real_format::pnan, and rvc_nan.
Referenced by fold_builtin_nan(), real_from_mpfr(), and reg_to_stack().
bool real_powi | ( | REAL_VALUE_TYPE * | r, |
enum machine_mode | mode, | ||
const REAL_VALUE_TYPE * | x, | ||
HOST_WIDE_INT | n | ||
) |
Calculate X raised to the integer exponent N in mode MODE 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, and real_convert().
Referenced by fold_builtin_pow(), and fold_builtin_powi().
void real_round | ( | REAL_VALUE_TYPE * | r, |
enum machine_mode | mode, | ||
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(), and real_convert().
Referenced by fold_builtin_int_roundingfn(), fold_builtin_round(), and gimple_expand_builtin_pow().
bool real_sqrt | ( | REAL_VALUE_TYPE * | r, |
enum machine_mode | mode, | ||
const REAL_VALUE_TYPE * | x | ||
) |
Calculate the square root of X in mode MODE, and store the result in R. Return TRUE if the operation does not raise an exception. For details see "High Precision Division and Square Root", Alan H. Karp and Peter Markstein, HP Lab Report 93-93-42, June 1993. http://www.hpl.hp.com/techreports/93/HPL-93-42.pdf.
References dconst1, dconsthalf, do_add(), do_multiply(), exp(), get_canonical_qnan(), real_convert(), real_exponent(), real_identical(), real_isfinite(), real_isneg(), real_isnegzero(), and real_ldexp().
Referenced by simplify_const_unary_operation().
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(), dump_generic_node(), dump_real(), fixed_to_decimal(), print_node(), print_node_brief(), print_rtx(), and print_value().
void real_to_decimal_for_mode | ( | char * | , |
const REAL_VALUE_TYPE * | , | ||
size_t | , | ||
size_t | , | ||
int | , | ||
enum | machine_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(), first, floor_log2(), last, real_format::p, real_convert(), real_digit(), real_from_string(), real_identical(), real_format::round_towards_zero, rtd_divmod(), rvc_inf, rvc_nan, rvc_normal, rvc_zero, ten_to_mptwo(), and ten_to_ptwo().
Referenced by 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(), first, HOST_BITS_PER_LONG, real_format::p, rvc_inf, rvc_nan, rvc_normal, rvc_zero, and strlen().
Referenced by mpfr_from_real(), and print_rtx().
HOST_WIDE_INT real_to_integer | ( | ) |
Render R as an integer.
References decimal_real_to_integer(), HOST_BITS_PER_LONG, HOST_BITS_PER_WIDE_INT, HOST_WIDE_INT, rvc_inf, rvc_nan, rvc_normal, and rvc_zero.
Referenced by acceptable_pow_call(), decimal_real_to_integer(), decrement_power(), fold_builtin_pow(), gimple_expand_builtin_pow(), gimple_val_nonnegative_real_p(), and tree_call_nonnegative_warnv_p().
void real_to_integer2 | ( | HOST_WIDE_INT * | plow, |
HOST_WIDE_INT * | phigh, | ||
const REAL_VALUE_TYPE * | r | ||
) |
Likewise, but to an integer pair, HI+LOW.
References decimal_real_to_integer2(), exp(), HOST_BITS_PER_LONG, HOST_BITS_PER_WIDE_INT, HOST_WIDE_INT, rshift_significand(), rvc_inf, rvc_nan, rvc_normal, and rvc_zero.
Referenced by decimal_real_to_integer2(), fixed_convert_from_real(), fixed_from_string(), fold_builtin_int_roundingfn(), and fold_convert_const_int_from_real().
long real_to_target | ( | ) |
Similar, but look up the format from MODE.
References real_to_target_fmt().
Referenced by assemble_real(), insert_float(), native_encode_real(), simplify_const_binary_operation(), simplify_const_unary_operation(), and simplify_immed_subreg().
long real_to_target_fmt | ( | long * | buf, |
const REAL_VALUE_TYPE * | r_orig, | ||
const struct real_format * | 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, and round_for_format().
Referenced by real_to_target().
void real_trunc | ( | REAL_VALUE_TYPE * | r, |
enum machine_mode | mode, | ||
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 mode MODE.
References do_fix_trunc(), and real_convert().
Referenced by fold_builtin_modf(), fold_builtin_trunc(), fold_convert_const_int_from_real(), and real_isinteger().
REAL_VALUE_TYPE real_value_abs | ( | ) |
References real_arithmetic().
Referenced by simplify_const_unary_operation().
REAL_VALUE_TYPE real_value_negate | ( | ) |
References real_arithmetic().
Referenced by check_real_for_fixed_mode(), fold_abs_const(), fold_comparison(), fold_negate_const(), real_from_mpfr(), and simplify_const_unary_operation().
REAL_VALUE_TYPE real_value_truncate | ( | ) |
Legacy. Likewise, except return the struct directly.
References real_convert().
Referenced by fold_builtin_cabs(), fold_builtin_cbrt(), fold_builtin_hypot(), fold_builtin_load_exponent(), fold_builtin_logarithm(), fold_builtin_pow(), fold_builtin_sqrt(), gimple_expand_builtin_pow(), simplify_const_unary_operation(), and strip_float_extensions().
|
static |
Referenced by encode_ibm_extended(), real_convert(), and real_to_target_fmt().
|
static |
References add_significands(), real_format::b, clear_significand_below(), decimal_real_convert(), decimal_round_for_format(), real_format::emax, real_format::emin, get_inf(), get_zero(), real_format::has_denorm, real_format::has_signed_zero, HOST_BITS_PER_LONG, real_format::p, real_format::round_towards_zero, rvc_inf, rvc_nan, rvc_normal, rvc_zero, set_significand_bit(), sticky_rshift_significand(), and test_significand_bit().
|
static |
Right-shift the significand of A by N bits; put the result in the significand of R.
References HOST_BITS_PER_LONG.
Referenced by encode_ieee_quad(), and real_to_integer2().
|
static |
Referenced by decimal_integer_string(), and real_to_decimal_for_mode().
|
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(), and sub_significands().
|
static |
Referenced by div_significands(), and round_for_format().
|
inlinestatic |
Set bit N of the significand of R.
References HOST_BITS_PER_LONG.
int significand_size | ( | ) |
Return the number of bits of the largest binary value that the significand of MODE will hold.
??? Legacy. Should get access to real_format directly.
References real_format::b, and real_format::p.
Referenced by combine_conversions(), expand_float(), and simplify_unary_operation_1().
|
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 HOST_BITS_PER_LONG.
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.
Referenced by div_significands(), do_add(), and rtd_divmod().
|
static |
Referenced by real_to_decimal_for_mode().
|
static |
Returns 10**(-2**N).
References do_divide(), real_digit(), rvc_zero, and ten_to_ptwo().
|
static |
Referenced by real_from_string(), real_to_decimal_for_mode(), ten_to_mptwo(), ten_to_ptwo(), and times_pten().
|
static |
Returns 10**2**N.
References do_multiply(), HOST_BITS_PER_WIDE_INT, HOST_WIDE_INT, real_from_integer(), rvc_zero, and ten_to_ptwo().
|
static |
Referenced by round_for_format().
|
inlinestatic |
Test bit N of the significand of R.
References HOST_BITS_PER_LONG.
|
static |
Referenced by decimal_integer_string(), and real_from_string().
|
static |
Multiply R by 10**EXP.
References do_divide(), do_multiply(), exp(), real_digit(), and ten_to_ptwo().
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.
struct real_format decimal_double_format |
Double precision decimal floating point (IEEE 754).
Referenced by decimal_round_for_format().
struct real_format decimal_quad_format |
Quad precision decimal floating point (IEEE 754).
Referenced by decimal_round_for_format().
struct real_format decimal_single_format |
Single precision decimal floating point (IEEE 754).
Referenced by decimal_round_for_format().
struct real_format ibm_extended_format |
struct real_format ieee_double_format |
Referenced by check_target_format().
struct real_format ieee_extended_intel_128_format |
Referenced by check_target_format().
struct real_format ieee_extended_intel_96_format |
Referenced by check_target_format().
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().
struct real_format ieee_extended_motorola_format |
Referenced by check_target_format().
struct real_format ieee_half_format |
Half-precision format, as specified in IEEE 754R.
struct real_format ieee_quad_format |
Referenced by check_target_format().
struct real_format ieee_single_format |
Target formats defined in real.c.
Referenced by check_target_format().
struct real_format mips_double_format |
Referenced by check_target_format(), decode_ibm_extended(), and encode_ibm_extended().
struct real_format mips_extended_format |
struct real_format mips_quad_format |
Referenced by check_target_format().
struct real_format mips_single_format |
Referenced by check_target_format().
struct real_format motorola_double_format |
Referenced by check_target_format().
struct real_format motorola_single_format |
Referenced by check_target_format().
struct real_format real_internal_format |
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).
struct real_format vax_d_format |
struct real_format vax_f_format |
struct real_format vax_g_format |