GCC Middle and Back End API Reference
real.c File 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

Function Documentation

static bool add_significands ( REAL_VALUE_TYPE *  r,
const REAL_VALUE_TYPE *  a,
const REAL_VALUE_TYPE *  b 
)
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 void clear_significand_below ( REAL_VALUE_TYPE *  ,
unsigned  int 
)
static
static void clear_significand_below ( )
static
Clear bits 0..N-1 of the significand of R.   

References HOST_BITS_PER_LONG.

static void clear_significand_bit ( REAL_VALUE_TYPE *  ,
unsigned  int 
)
static

Referenced by real_maxval().

static void clear_significand_bit ( )
inlinestatic
Clear bit N of the significand of R.   

References HOST_BITS_PER_LONG.

static int cmp_significand_0 ( const REAL_VALUE_TYPE *  )
static
static int cmp_significand_0 ( )
inlinestatic
Return true if A is nonzero.   
static int cmp_significands ( const REAL_VALUE_TYPE *  ,
const REAL_VALUE_TYPE *   
)
static
static int cmp_significands ( )
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 void decimal_from_integer ( REAL_VALUE_TYPE *  )
static

Referenced by real_from_integer().

static void decimal_from_integer ( )
static
Convert a real with an integral value to decimal float.   

References decimal_integer_string(), and decimal_real_from_string().

static void decimal_integer_string ( char *  str,
const REAL_VALUE_TYPE *  r_orig,
size_t  buf_size 
)
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 void decode_decimal_double ( const struct real_format fmt,
REAL_VALUE_TYPE *  r,
const long *  buf 
)
static
Decode a double precision DFP value in BUF into a real R.   

References decode_decimal64().

static void decode_decimal_quad ( const struct real_format fmt,
REAL_VALUE_TYPE *  r,
const long *  buf 
)
static
Decode a quad precision DFP value in BUF into a real R.   

References decode_decimal128().

static void decode_decimal_single ( const struct real_format fmt,
REAL_VALUE_TYPE *  r,
const long *  buf 
)
static
Decode a single precision DFP value in BUF into a real R.   

References decode_decimal32().

static void decode_ibm_extended ( const struct real_format fmt,
REAL_VALUE_TYPE *  r,
const long *  buf 
)
static
static void decode_ieee_double ( const struct real_format fmt,
REAL_VALUE_TYPE *  r,
const long *  buf 
)
static
static void decode_ieee_extended ( const struct real_format fmt,
REAL_VALUE_TYPE *  r,
const long *  buf 
)
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 void decode_ieee_extended_intel_128 ( const struct real_format fmt,
REAL_VALUE_TYPE *  r,
const long *  buf 
)
static
Convert from the internal format to the 16-byte Intel format for
   an IEEE extended real.   

References decode_ieee_extended_intel_96().

static void decode_ieee_extended_intel_96 ( const struct real_format fmt,
REAL_VALUE_TYPE *  r,
const long *  buf 
)
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 void decode_ieee_extended_motorola ( const struct real_format fmt,
REAL_VALUE_TYPE *  r,
const long *  buf 
)
static
Convert from the internal format to the 12-byte Motorola format
   for an IEEE extended real.   

References decode_ieee_extended().

static void decode_ieee_half ( const struct real_format fmt,
REAL_VALUE_TYPE *  r,
const long *  buf 
)
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 void decode_ieee_quad ( const struct real_format fmt,
REAL_VALUE_TYPE *  r,
const long *  buf 
)
static
static void decode_ieee_single ( const struct real_format fmt,
REAL_VALUE_TYPE *  r,
const long *  buf 
)
static
static void decode_internal ( const struct real_format fmt,
REAL_VALUE_TYPE *  r,
const long *  buf 
)
static

References memcpy().

static void decode_vax_d ( const struct real_format fmt,
REAL_VALUE_TYPE *  r,
const long *  buf 
)
static
static void decode_vax_f ( const struct real_format fmt,
REAL_VALUE_TYPE *  r,
const long *  buf 
)
static
static void decode_vax_g ( const struct real_format fmt,
REAL_VALUE_TYPE *  r,
const long *  buf 
)
static
static bool div_significands ( REAL_VALUE_TYPE *  r,
const REAL_VALUE_TYPE *  a,
const REAL_VALUE_TYPE *  b 
)
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 bool do_add ( REAL_VALUE_TYPE *  r,
const REAL_VALUE_TYPE *  a,
const REAL_VALUE_TYPE *  b,
int  subtract_p 
)
static
static int do_compare ( const REAL_VALUE_TYPE *  a,
const REAL_VALUE_TYPE *  b,
int  nan_result 
)
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 bool do_divide ( REAL_VALUE_TYPE *  r,
const REAL_VALUE_TYPE *  a,
const REAL_VALUE_TYPE *  b 
)
static
static void do_fix_trunc ( REAL_VALUE_TYPE *  ,
const REAL_VALUE_TYPE *   
)
static
static void do_fix_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 bool do_multiply ( REAL_VALUE_TYPE *  r,
const REAL_VALUE_TYPE *  a,
const REAL_VALUE_TYPE *  b 
)
static
static void encode_decimal_double ( const struct real_format fmt,
long *  buf,
const REAL_VALUE_TYPE *  r 
)
static
Encode real R into a double precision DFP value in BUF.   

References encode_decimal64().

static void encode_decimal_quad ( const struct real_format fmt,
long *  buf,
const REAL_VALUE_TYPE *  r 
)
static
Encode real R into a quad precision DFP value in BUF.   

References encode_decimal128().

static void encode_decimal_single ( const struct real_format fmt,
long *  buf,
const REAL_VALUE_TYPE *  r 
)
static
Encode real R into a single precision DFP value in BUF.   

References encode_decimal32().

static void encode_ibm_extended ( const struct real_format fmt,
long *  buf,
const REAL_VALUE_TYPE *  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(), mips_double_format, normalize(), real_format::qnan_msb_set, round_for_format(), and rvc_normal.

static void encode_ieee_double ( const struct real_format fmt,
long *  buf,
const REAL_VALUE_TYPE *  r 
)
static
static void encode_ieee_extended ( const struct real_format fmt,
long *  buf,
const REAL_VALUE_TYPE *  r 
)
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 void encode_ieee_extended_intel_128 ( const struct real_format fmt,
long *  buf,
const REAL_VALUE_TYPE *  r 
)
static
Convert from the internal format to the 16-byte Intel format for
   an IEEE extended real.   

References encode_ieee_extended_intel_96().

static void encode_ieee_extended_intel_96 ( const struct real_format fmt,
long *  buf,
const REAL_VALUE_TYPE *  r 
)
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 void encode_ieee_extended_motorola ( const struct real_format fmt,
long *  buf,
const REAL_VALUE_TYPE *  r 
)
static
Convert from the internal format to the 12-byte Motorola format
   for an IEEE extended real.   

References encode_ieee_extended().

static void encode_ieee_half ( const struct real_format fmt,
long *  buf,
const REAL_VALUE_TYPE *  r 
)
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 void encode_ieee_quad ( const struct real_format fmt,
long *  buf,
const REAL_VALUE_TYPE *  r 
)
static
static void encode_ieee_single ( const struct real_format fmt,
long *  buf,
const REAL_VALUE_TYPE *  r 
)
static
static void encode_internal ( const struct real_format fmt,
long *  buf,
const REAL_VALUE_TYPE *  r 
)
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 void encode_vax_d ( const struct real_format fmt,
long *  buf,
const REAL_VALUE_TYPE *  r 
)
static
static void encode_vax_f ( const struct real_format fmt,
long *  buf,
const REAL_VALUE_TYPE *  r 
)
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 void encode_vax_g ( const struct real_format fmt,
long *  buf,
const REAL_VALUE_TYPE *  r 
)
static
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 void get_canonical_qnan ( REAL_VALUE_TYPE *  ,
int   
)
static
static void get_canonical_qnan ( )
inlinestatic
Initialize R with the canonical quiet NaN.   

References memset(), and rvc_nan.

static void get_canonical_snan ( REAL_VALUE_TYPE *  ,
int   
)
static

Referenced by real_from_string(), and real_nan().

static void get_canonical_snan ( )
inlinestatic

References memset(), and rvc_nan.

static void get_inf ( REAL_VALUE_TYPE *  ,
int   
)
static
static void get_inf ( )
inlinestatic

References memset(), and rvc_inf.

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 void get_zero ( REAL_VALUE_TYPE *  ,
int   
)
static
static void get_zero ( )
inlinestatic
Initialize R with a positive zero.   

References memset().

static void lshift_significand ( REAL_VALUE_TYPE *  r,
const REAL_VALUE_TYPE *  a,
unsigned int  n 
)
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 void lshift_significand_1 ( REAL_VALUE_TYPE *  ,
const REAL_VALUE_TYPE *   
)
static
static void lshift_significand_1 ( )
inlinestatic
Likewise, but N is specialized to 1.   

References HOST_BITS_PER_LONG.

static void neg_significand ( REAL_VALUE_TYPE *  ,
const REAL_VALUE_TYPE *   
)
static

Referenced by do_add().

static void neg_significand ( )
inlinestatic
Negate the significand A, placing the result in R.   
static void normalize ( )
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.

bool real_arithmetic ( REAL_VALUE_TYPE *  r,
int  icode,
const REAL_VALUE_TYPE *  op0,
const REAL_VALUE_TYPE *  op1 
)
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 *   
)
void real_copysign ( )
Set the sign of R to the sign of X.   

Referenced by fold_builtin_copysign().

static const REAL_VALUE_TYPE* real_digit ( int  )
static
static const REAL_VALUE_TYPE* real_digit ( )
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().

int real_from_string ( )
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 ( )
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_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 
)
void real_to_decimal_for_mode ( char *  ,
const REAL_VALUE_TYPE *  ,
size_t  ,
size_t  ,
int  ,
enum  machine_mode 
)
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().

long real_to_target ( )
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 ( )
static void round_for_format ( const struct real_format ,
REAL_VALUE_TYPE *   
)
static
static void rshift_significand ( REAL_VALUE_TYPE *  r,
const REAL_VALUE_TYPE *  a,
unsigned int  n 
)
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 unsigned long rtd_divmod ( REAL_VALUE_TYPE *  ,
REAL_VALUE_TYPE *   
)
static
static unsigned long rtd_divmod ( )
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 void set_significand_bit ( REAL_VALUE_TYPE *  ,
unsigned  int 
)
static
static void set_significand_bit ( )
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 bool sticky_rshift_significand ( REAL_VALUE_TYPE *  r,
const REAL_VALUE_TYPE *  a,
unsigned int  n 
)
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().

static bool sub_significands ( REAL_VALUE_TYPE *  r,
const REAL_VALUE_TYPE *  a,
const REAL_VALUE_TYPE *  b,
int  carry 
)
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 const REAL_VALUE_TYPE* ten_to_mptwo ( int  )
static
static const REAL_VALUE_TYPE* ten_to_mptwo ( )
static
Returns 10**(-2**N).   

References do_divide(), real_digit(), rvc_zero, and ten_to_ptwo().

static const REAL_VALUE_TYPE* ten_to_ptwo ( int  )
static
static const REAL_VALUE_TYPE* ten_to_ptwo ( )
static
static bool test_significand_bit ( REAL_VALUE_TYPE *  ,
unsigned  int 
)
static

Referenced by round_for_format().

static bool test_significand_bit ( )
inlinestatic
Test bit N of the significand of R.   

References HOST_BITS_PER_LONG.

static void times_pten ( REAL_VALUE_TYPE *  ,
int   
)
static
static void times_pten ( )
static
Multiply R by 10**EXP.   

References do_divide(), do_multiply(), exp(), real_digit(), and ten_to_ptwo().


Variable Documentation

struct real_format arm_half_format
Initial value:
{
2,
11,
11,
-13,
17,
15,
15,
false,
true,
false,
false,
true,
true,
false,
false
}
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
Initial value:
{
10,
16,
16,
-382,
385,
63,
63,
false,
true,
true,
true,
true,
true,
true,
false
}
Double precision decimal floating point (IEEE 754).  

Referenced by decimal_round_for_format().

struct real_format decimal_quad_format
Initial value:
{
10,
34,
34,
-6142,
6145,
127,
127,
false,
true,
true,
true,
true,
true,
true,
false
}
Quad precision decimal floating point (IEEE 754).  

Referenced by decimal_round_for_format().

struct real_format decimal_single_format
Initial value:
{
10,
7,
7,
-94,
97,
31,
31,
false,
true,
true,
true,
true,
true,
true,
false
}
Single precision decimal floating point (IEEE 754).  

Referenced by decimal_round_for_format().

struct real_format ibm_extended_format
Initial value:
{
2,
53 + 53,
53,
-1021 + 53,
1024,
127,
-1,
false,
true,
true,
true,
true,
true,
true,
false
}
struct real_format ieee_double_format
Initial value:
{
2,
53,
53,
-1021,
1024,
63,
63,
false,
true,
true,
true,
true,
true,
true,
false
}

Referenced by check_target_format().

struct real_format ieee_extended_intel_128_format
Initial value:
{
2,
64,
64,
-16381,
16384,
79,
79,
false,
true,
true,
true,
true,
true,
true,
false
}

Referenced by check_target_format().

struct real_format ieee_extended_intel_96_format
Initial value:
{
2,
64,
64,
-16381,
16384,
79,
79,
false,
true,
true,
true,
true,
true,
true,
false
}

Referenced by check_target_format().

struct real_format ieee_extended_intel_96_round_53_format
Initial value:
{
2,
53,
53,
-16381,
16384,
79,
79,
false,
true,
true,
true,
true,
true,
true,
false
}
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
Initial value:
{
2,
64,
64,
-16382,
16384,
95,
95,
false,
true,
true,
true,
true,
true,
true,
true
}

Referenced by check_target_format().

struct real_format ieee_half_format
Initial value:
{
2,
11,
11,
-13,
16,
15,
15,
false,
true,
true,
true,
true,
true,
true,
false
}
Half-precision format, as specified in IEEE 754R.   
struct real_format ieee_quad_format
Initial value:
{
2,
113,
113,
-16381,
16384,
127,
127,
false,
true,
true,
true,
true,
true,
true,
false
}

Referenced by check_target_format().

struct real_format ieee_single_format
Initial value:
{
2,
24,
24,
-125,
128,
31,
31,
false,
true,
true,
true,
true,
true,
true,
false
}
Target formats defined in real.c.   

Referenced by check_target_format().

struct real_format mips_double_format
Initial value:
{
2,
53,
53,
-1021,
1024,
63,
63,
false,
true,
true,
true,
true,
true,
false,
true
}

Referenced by check_target_format(), decode_ibm_extended(), and encode_ibm_extended().

struct real_format mips_extended_format
Initial value:
{
2,
53 + 53,
53,
-1021 + 53,
1024,
127,
-1,
false,
true,
true,
true,
true,
true,
false,
true
}
struct real_format mips_quad_format
Initial value:
{
2,
113,
113,
-16381,
16384,
127,
127,
false,
true,
true,
true,
true,
true,
false,
true
}

Referenced by check_target_format().

struct real_format mips_single_format
Initial value:
{
2,
24,
24,
-125,
128,
31,
31,
false,
true,
true,
true,
true,
true,
false,
true
}

Referenced by check_target_format().

struct real_format motorola_double_format
Initial value:
{
2,
53,
53,
-1021,
1024,
63,
63,
false,
true,
true,
true,
true,
true,
true,
true
}

Referenced by check_target_format().

struct real_format motorola_single_format
Initial value:
{
2,
24,
24,
-125,
128,
31,
31,
false,
true,
true,
true,
true,
true,
true,
true
}

Referenced by check_target_format().

struct real_format real_internal_format
Initial value:
{
2,
SIGNIFICAND_BITS - 2,
SIGNIFICAND_BITS - 2,
-MAX_EXP,
MAX_EXP,
-1,
-1,
false,
false,
true,
true,
false,
true,
true,
false
}
struct real_format spu_single_format
Initial value:
{
2,
24,
24,
-125,
129,
31,
31,
true,
false,
false,
false,
true,
true,
false,
false
}
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
Initial value:
{
2,
56,
56,
-127,
127,
15,
15,
false,
false,
false,
false,
false,
false,
false,
false
}
struct real_format vax_f_format
Initial value:
{
2,
24,
24,
-127,
127,
15,
15,
false,
false,
false,
false,
false,
false,
false,
false
}
struct real_format vax_g_format
Initial value:
{
2,
53,
53,
-1023,
1023,
15,
15,
false,
false,
false,
false,
false,
false,
false,
false
}