GCC Middle and Back End API Reference
dfp.c File Reference

Functions

static void decimal_from_decnumber ()
void decimal_real_from_string ()
static void decimal_to_decnumber ()
void encode_decimal32 (const struct real_format *fmt, long *buf, const REAL_VALUE_TYPE *r)
void decode_decimal32 (const struct real_format *fmt, REAL_VALUE_TYPE *r, const long *buf)
void encode_decimal64 (const struct real_format *fmt, long *buf, const REAL_VALUE_TYPE *r)
void decode_decimal64 (const struct real_format *fmt, REAL_VALUE_TYPE *r, const long *buf)
void encode_decimal128 (const struct real_format *fmt, long *buf, const REAL_VALUE_TYPE *r)
void decode_decimal128 (const struct real_format *fmt, REAL_VALUE_TYPE *r, const long *buf)
static void decimal_to_binary (REAL_VALUE_TYPE *to, const REAL_VALUE_TYPE *from, enum machine_mode mode)
static void decimal_from_binary ()
int decimal_do_compare (const REAL_VALUE_TYPE *a, const REAL_VALUE_TYPE *b, int nan_result)
void decimal_round_for_format ()
void decimal_real_convert (REAL_VALUE_TYPE *r, enum machine_mode mode, const REAL_VALUE_TYPE *a)
void decimal_real_to_decimal (char *str, const REAL_VALUE_TYPE *r_orig, size_t buf_size, size_t digits, int crop_trailing_zeros)
static bool decimal_do_add (REAL_VALUE_TYPE *r, const REAL_VALUE_TYPE *op0, const REAL_VALUE_TYPE *op1, int subtract_p)
static bool decimal_do_multiply (REAL_VALUE_TYPE *r, const REAL_VALUE_TYPE *op0, const REAL_VALUE_TYPE *op1)
static bool decimal_do_divide (REAL_VALUE_TYPE *r, const REAL_VALUE_TYPE *op0, const REAL_VALUE_TYPE *op1)
void decimal_do_fix_trunc ()
HOST_WIDE_INT decimal_real_to_integer ()
void decimal_real_to_integer2 (HOST_WIDE_INT *plow, HOST_WIDE_INT *phigh, const REAL_VALUE_TYPE *r)
bool decimal_real_arithmetic (REAL_VALUE_TYPE *r, enum tree_code code, const REAL_VALUE_TYPE *op0, const REAL_VALUE_TYPE *op1)
void decimal_real_maxval ()

Function Documentation

static bool decimal_do_add ( REAL_VALUE_TYPE *  r,
const REAL_VALUE_TYPE *  op0,
const REAL_VALUE_TYPE *  op1,
int  subtract_p 
)
static
int decimal_do_compare ( const REAL_VALUE_TYPE *  a,
const REAL_VALUE_TYPE *  b,
int  nan_result 
)
Helper function to real.c:do_compare() to handle decimal internal
   representation including when one of the operands is still in the
   binary internal representation.   

References decimal_from_binary().

Referenced by do_compare().

static bool decimal_do_divide ( REAL_VALUE_TYPE *  r,
const REAL_VALUE_TYPE *  op0,
const REAL_VALUE_TYPE *  op1 
)
static
Compute R = OP0 / OP1.   

References decimal_from_decnumber(), and decimal_to_decnumber().

Referenced by decimal_real_arithmetic().

void decimal_do_fix_trunc ( )
Set R to A truncated to an integral value toward zero (decimal
   floating point).   

References decimal_from_decnumber().

Referenced by decimal_real_arithmetic(), and do_fix_trunc().

static bool decimal_do_multiply ( REAL_VALUE_TYPE *  r,
const REAL_VALUE_TYPE *  op0,
const REAL_VALUE_TYPE *  op1 
)
static
Compute R = OP0 * OP1.   

References decimal_from_decnumber(), and decimal_to_decnumber().

Referenced by decimal_real_arithmetic().

static void decimal_from_binary ( )
static
Helper function to convert from a binary real internal
   representation.   

References decimal_real_from_string(), and real_to_decimal().

Referenced by decimal_do_compare(), decimal_real_arithmetic(), and decimal_real_convert().

static void decimal_from_decnumber ( )
static
Initialize R (a real with the decimal flag set) from DN.  Can
   utilize status passed in via CONTEXT, if a previous operation had
   interesting status.   

References memset(), rvc_inf, rvc_nan, and rvc_normal.

Referenced by decimal_do_add(), decimal_do_divide(), decimal_do_fix_trunc(), decimal_do_multiply(), decimal_real_from_string(), decimal_round_for_format(), decode_decimal128(), decode_decimal32(), and decode_decimal64().

bool decimal_real_arithmetic ( REAL_VALUE_TYPE *  r,
enum tree_code  code,
const REAL_VALUE_TYPE *  op0,
const REAL_VALUE_TYPE *  op1 
)
Perform the decimal floating point operation described by CODE.
   For a unary operation, OP1 will be NULL.  This function returns
   true if the result may be inexact due to loss of precision.   

References real_format::b, decimal_do_add(), decimal_do_divide(), decimal_do_fix_trunc(), decimal_do_multiply(), decimal_from_binary(), real_compare(), and rvc_nan.

Referenced by real_arithmetic().

void decimal_real_convert ( REAL_VALUE_TYPE *  r,
enum machine_mode  mode,
const REAL_VALUE_TYPE *  a 
)
Extend or truncate to a new mode.  Handles conversions between
   binary and decimal types.   

References real_format::b, decimal_from_binary(), and decimal_to_binary().

Referenced by real_2expN(), real_convert(), and round_for_format().

void decimal_real_from_string ( )
Create decimal encoded R from string S.   

References decimal_from_decnumber().

Referenced by decimal_from_binary(), decimal_from_integer(), decimal_real_maxval(), and real_from_string3().

void decimal_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 decimal_real_from_string().

Referenced by real_maxval().

void decimal_real_to_decimal ( char *  str,
const REAL_VALUE_TYPE *  r_orig,
size_t  buf_size,
size_t  digits,
int  crop_trailing_zeros 
)
Render R_ORIG 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.  Currently, not honoring
   DIGITS or CROP_TRAILING_ZEROS.   

Referenced by real_to_decimal_for_mode().

HOST_WIDE_INT decimal_real_to_integer ( )
Render decimal float value R as an integer.   

References real_from_string(), and real_to_integer().

Referenced by real_to_integer().

void decimal_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 real_from_string(), and real_to_integer2().

Referenced by real_to_integer2().

void decimal_round_for_format ( )
Helper to round_for_format, handling decimal float types.   

References decimal_double_format, decimal_from_decnumber(), decimal_quad_format, decimal_single_format, and rvc_normal.

Referenced by round_for_format().

static void decimal_to_binary ( REAL_VALUE_TYPE *  to,
const REAL_VALUE_TYPE *  from,
enum machine_mode  mode 
)
static
Helper function to convert from a binary real internal
   representation.   

References real_from_string3().

Referenced by decimal_real_convert().

static void decimal_to_decnumber ( )
static
void decode_decimal128 ( const struct real_format fmt,
REAL_VALUE_TYPE *  r,
const long *  buf 
)
Decode an IEEE 754 decimal128 type into a real.   

References decimal_from_decnumber(), and memcpy().

Referenced by decode_decimal_quad().

void decode_decimal32 ( const struct real_format fmt,
REAL_VALUE_TYPE *  r,
const long *  buf 
)
Decode an IEEE 754 decimal32 type into a real.   

References decimal_from_decnumber(), and memcpy().

Referenced by decode_decimal_single().

void decode_decimal64 ( const struct real_format fmt,
REAL_VALUE_TYPE *  r,
const long *  buf 
)
Decode an IEEE 754 decimal64 type into a real.   

References decimal_from_decnumber(), and memcpy().

Referenced by decode_decimal_double().

void encode_decimal128 ( const struct real_format fmt,
long *  buf,
const REAL_VALUE_TYPE *  r 
)
Encode a real into an IEEE 754 decimal128 type.   

References decimal_to_decnumber(), and memcpy().

Referenced by encode_decimal_quad().

void encode_decimal32 ( const struct real_format fmt,
long *  buf,
const REAL_VALUE_TYPE *  r 
)
Encode a real into an IEEE 754 decimal32 type.   

References decimal_to_decnumber(), and memcpy().

Referenced by encode_decimal_single().

void encode_decimal64 ( const struct real_format fmt,
long *  buf,
const REAL_VALUE_TYPE *  r 
)
Encode a real into an IEEE 754 decimal64 type.   

References decimal_to_decnumber(), and memcpy().

Referenced by encode_decimal_double().