33#define SIGNIFICAND_BITS (128 + HOST_BITS_PER_LONG)
34#define EXP_BITS (32 - 6)
35#define MAX_EXP ((1 << (EXP_BITS - 1)) - 1)
36#define SIGSZ (SIGNIFICAND_BITS / HOST_BITS_PER_LONG)
37#define SIG_MSB ((unsigned long)1 << (HOST_BITS_PER_LONG - 1))
59#define REAL_EXP(REAL) \
60 ((int)((REAL)->uexp ^ (unsigned int)(1 << (EXP_BITS - 1))) \
61 - (1 << (EXP_BITS - 1)))
62#define SET_REAL_EXP(REAL, EXP) \
63 ((REAL)->uexp = ((unsigned int)(EXP) & (unsigned int)((1 << EXP_BITS) - 1)))
68#define REAL_VALUE_TYPE struct real_value
74#define REAL_VALUE_TYPE_SIZE (SIGNIFICAND_BITS + 32)
76 (REAL_VALUE_TYPE_SIZE/HOST_BITS_PER_WIDE_INT \
77 + (REAL_VALUE_TYPE_SIZE%HOST_BITS_PER_WIDE_INT ? 1 : 0))
91# define CONST_DOUBLE_FORMAT "ww"
94# define CONST_DOUBLE_FORMAT "ww"
97# define CONST_DOUBLE_FORMAT "www"
100# define CONST_DOUBLE_FORMAT "wwww"
103# define CONST_DOUBLE_FORMAT "wwwww"
106# define CONST_DOUBLE_FORMAT "wwwwww"
108 #error "REAL_WIDTH > 6 not supported"
183#define REAL_MODE_FORMAT(MODE) \
184 (real_format_for_mode[DECIMAL_FLOAT_MODE_P (MODE) \
185 ? (((MODE) - MIN_MODE_DECIMAL_FLOAT) \
187 : GET_MODE_CLASS (MODE) == MODE_FLOAT \
188 ? ((MODE) - MIN_MODE_FLOAT) \
189 : (gcc_unreachable (), 0)])
191#define FLOAT_MODE_FORMAT(MODE) \
192 (REAL_MODE_FORMAT (as_a <scalar_float_mode> (GET_MODE_INNER (MODE))))
197#define MODE_COMPOSITE_P(MODE) \
198 (FLOAT_MODE_P (MODE) \
199 && FLOAT_MODE_FORMAT (MODE)->pnan < FLOAT_MODE_FORMAT (MODE)->p)
202#define MODE_HAS_NANS(MODE) \
203 (FLOAT_MODE_P (MODE) && FLOAT_MODE_FORMAT (MODE)->has_nans)
204#define MODE_HAS_INFINITIES(MODE) \
205 (FLOAT_MODE_P (MODE) && FLOAT_MODE_FORMAT (MODE)->has_inf)
206#define MODE_HAS_SIGNED_ZEROS(MODE) \
207 (FLOAT_MODE_P (MODE) && FLOAT_MODE_FORMAT (MODE)->has_signed_zero)
208#define MODE_HAS_SIGN_DEPENDENT_ROUNDING(MODE) \
209 (FLOAT_MODE_P (MODE) \
210 && FLOAT_MODE_FORMAT (MODE)->has_sign_dependent_rounding)
331 size_t,
int, machine_mode);
335 size_t,
size_t,
int);
394#define REAL_VALUE_ISINF(x) real_isinf (&(x))
397#define REAL_VALUE_ISNAN(x) real_isnan (&(x))
400#define REAL_VALUE_ISSIGNALING_NAN(x) real_issignaling_nan (&(x))
403#define REAL_VALUE_NEGATIVE(x) real_isneg (&(x))
406#define REAL_VALUE_MINUS_ZERO(x) real_isnegzero (&(x))
409#define REAL_VALUE_TO_TARGET_LONG_DOUBLE(IN, OUT) \
410 real_to_target (OUT, &(IN), \
411 float_mode_for_size (TYPE_PRECISION \
412 (long_double_type_node)).require ())
414#define REAL_VALUE_TO_TARGET_DOUBLE(IN, OUT) \
415 real_to_target (OUT, &(IN), float_mode_for_size (64).require ())
418#define REAL_VALUE_TO_TARGET_SINGLE(IN, OUT) \
419 ((OUT) = real_to_target (NULL, &(IN), float_mode_for_size (32).require ()))
424#define REAL_VALUE_TO_TARGET_DECIMAL128(IN, OUT) \
425 real_to_target (OUT, &(IN), decimal_float_mode_for_size (128).require ())
427#define REAL_VALUE_TO_TARGET_DECIMAL64(IN, OUT) \
428 real_to_target (OUT, &(IN), decimal_float_mode_for_size (64).require ())
431#define REAL_VALUE_TO_TARGET_DECIMAL32(IN, OUT) \
432 ((OUT) = real_to_target (NULL, &(IN), \
433 decimal_float_mode_for_size (32).require ()))
444#define REAL_VALUE_ATOF(s, m) \
445 real_from_string2 (s, m)
447#define CONST_DOUBLE_ATOF(s, m) \
448 const_double_from_real_value (real_from_string2 (s, m), m)
450#define REAL_VALUE_FIX(r) \
451 real_to_integer (&(r))
454#define REAL_VALUE_UNSIGNED_FIX(r) \
455 real_to_integer (&(r))
478#define dconst_e() (*dconst_e_ptr ())
479#define dconst_third() (*dconst_third_ptr ())
480#define dconst_quarter() (*dconst_quarter_ptr ())
481#define dconst_sixth() (*dconst_sixth_ptr ())
482#define dconst_ninth() (*dconst_ninth_ptr ())
483#define dconst_sqrt2() (*dconst_sqrt2_ptr ())
484#define dconst_pi() (*dconst_pi_ptr ())
554#ifndef GENERATOR_FILE
const union tree_node * const_tree
Definition coretypes.h:98
#define GTY(x)
Definition coretypes.h:41
union tree_node * tree
Definition coretypes.h:97
poly_int< N, C > r
Definition poly-int.h:774
bool real_isdenormal(const REAL_VALUE_TYPE *r, machine_mode mode)
Definition real.h:292
bool HONOR_SIGNED_ZEROS(machine_mode)
Definition real.cc:5544
REAL_VALUE_TYPE real_value_truncate(format_helper, REAL_VALUE_TYPE)
Definition real.cc:2847
const struct real_format mips_single_format
Definition real.cc:3112
bool real_isinteger(const REAL_VALUE_TYPE *, format_helper)
Definition real.cc:5304
bool HONOR_INFINITIES(machine_mode)
Definition real.cc:5523
const struct real_format ibm_extended_format
Definition real.cc:3932
bool real_powi(REAL_VALUE_TYPE *, format_helper, const REAL_VALUE_TYPE *, HOST_WIDE_INT)
Definition real.cc:5094
char test_real_width[sizeof(REAL_VALUE_TYPE)<=REAL_WIDTH *sizeof(HOST_WIDE_INT) ? 1 :-1]
bool HONOR_NANS(machine_mode)
Definition real.cc:5482
bool real_compare(int, const REAL_VALUE_TYPE *, const REAL_VALUE_TYPE *)
Definition real.cc:1147
bool real_arithmetic(REAL_VALUE_TYPE *, int, const REAL_VALUE_TYPE *, const REAL_VALUE_TYPE *)
Definition real.cc:1032
int real_exponent(const REAL_VALUE_TYPE *)
Definition real.cc:1191
void real_convert(REAL_VALUE_TYPE *, format_helper, const REAL_VALUE_TYPE *)
Definition real.cc:2823
REAL_VALUE_TYPE dconstm0
Definition emit-rtl.cc:109
const struct real_format vax_g_format
Definition real.cc:4591
const struct real_format real_internal_format
Definition real.cc:5064
#define EXP_BITS
Definition real.h:34
bool HONOR_SNANS(machine_mode)
Definition real.cc:5502
#define REAL_MODE_FORMAT(MODE)
Definition real.h:183
void real_to_hexadecimal(char *, const REAL_VALUE_TYPE *, size_t, size_t, int)
Definition real.cc:1931
bool real_less(const REAL_VALUE_TYPE *, const REAL_VALUE_TYPE *)
Definition real.cc:1141
REAL_VALUE_TYPE dconst1
Definition emit-rtl.cc:107
const struct real_format ieee_extended_intel_128_format
Definition real.cc:3817
REAL_VALUE_TYPE dconstm1
Definition emit-rtl.cc:110
void real_copysign(REAL_VALUE_TYPE *, const REAL_VALUE_TYPE *)
Definition real.cc:5295
void real_from_integer(REAL_VALUE_TYPE *, format_helper, const wide_int_ref &, signop)
Definition real.cc:2224
int significand_size(format_helper)
Definition real.cc:2910
const REAL_VALUE_TYPE * dconst_ninth_ptr(void)
const REAL_VALUE_TYPE * dconst_e_ptr(void)
Definition real.cc:2465
const struct real_format arm_bfloat_half_format
Definition real.cc:5016
const struct real_format mips_double_format
Definition real.cc:3403
bool real_nan(REAL_VALUE_TYPE *, const char *, int, format_helper)
Definition real.cc:2553
void real_2expN(REAL_VALUE_TYPE *, int, format_helper)
Definition real.cc:2675
long real_to_target(long *, const REAL_VALUE_TYPE *, format_helper)
Definition real.cc:2879
void real_ldexp(REAL_VALUE_TYPE *, const REAL_VALUE_TYPE *, int)
Definition real.cc:1210
REAL_VALUE_TYPE dconstninf
Definition emit-rtl.cc:113
const struct real_format mips_quad_format
Definition real.cc:4243
REAL_VALUE_TYPE real_value_negate(const REAL_VALUE_TYPE *)
Definition real.cc:1115
const struct real_format spu_single_format
Definition real.cc:3169
const struct real_format ieee_single_format
Definition real.cc:3089
void real_to_decimal(char *, const REAL_VALUE_TYPE *, size_t, size_t, int)
Definition real.cc:1910
bool real_isneg(const REAL_VALUE_TYPE *)
Definition real.cc:1280
bool HONOR_SIGN_DEPENDENT_ROUNDING(machine_mode)
Definition real.cc:5565
bool real_issignaling_nan(const REAL_VALUE_TYPE *)
Definition real.cc:1264
void real_round(REAL_VALUE_TYPE *, format_helper, const REAL_VALUE_TYPE *)
Definition real.cc:5192
const struct real_format motorola_single_format
Definition real.cc:3135
tree build_real(tree, REAL_VALUE_TYPE)
Definition tree.cc:2368
const struct real_format decimal_quad_format
Definition real.cc:4717
REAL_VALUE_TYPE dconst0
Definition emit-rtl.cc:106
bool real_isfinite(const REAL_VALUE_TYPE *)
Definition real.cc:1272
REAL_VALUE_TYPE dconstinf
Definition emit-rtl.cc:112
const struct real_format decimal_single_format
Definition real.cc:4669
bool real_isnan(const REAL_VALUE_TYPE *)
Definition real.cc:1258
bool real_isinf(const REAL_VALUE_TYPE *)
Definition real.cc:1242
void real_to_decimal_for_mode(char *, const REAL_VALUE_TYPE *, size_t, size_t, int, machine_mode)
Definition real.cc:1606
bool real_isnegzero(const REAL_VALUE_TYPE *)
Definition real.cc:1304
bool real_can_shorten_arithmetic(machine_mode, machine_mode)
Definition real.cc:1395
const struct real_format ieee_quad_format
Definition real.cc:4220
const REAL_VALUE_TYPE * dconst_third_ptr(void)
bool exact_real_truncate(format_helper, const REAL_VALUE_TYPE *)
Definition real.cc:2857
void real_from_string3(REAL_VALUE_TYPE *, const char *, format_helper)
Definition real.cc:2209
const REAL_VALUE_TYPE * dconst_sqrt2_ptr(void)
Definition real.cc:2524
unsigned int real_hash(const REAL_VALUE_TYPE *)
Definition real.cc:2932
REAL_VALUE_TYPE real_value_abs(const REAL_VALUE_TYPE *)
Definition real.cc:1123
const REAL_VALUE_TYPE * dconst_quarter_ptr(void)
void build_sinatan_real(REAL_VALUE_TYPE *, tree)
Definition real.cc:5586
REAL_VALUE_TYPE real_value_from_int_cst(const_tree, const_tree)
Definition tree.cc:2424
void real_from_target(REAL_VALUE_TYPE *, const long *, format_helper)
Definition real.cc:2900
#define REAL_EXP(REAL)
Definition real.h:59
const struct real_format ieee_extended_intel_96_round_53_format
Definition real.cc:3842
#define REAL_VALUE_TYPE
Definition real.h:68
void real_roundeven(REAL_VALUE_TYPE *, format_helper, const REAL_VALUE_TYPE *)
Definition real.cc:5267
const struct real_format ieee_double_format
Definition real.cc:3380
const struct real_format decimal_double_format
Definition real.cc:4693
void real_trunc(REAL_VALUE_TYPE *, format_helper, const REAL_VALUE_TYPE *)
Definition real.cc:5144
void get_max_float(const struct real_format *, char *, size_t, bool)
Definition real.cc:5436
bool real_nextafter(REAL_VALUE_TYPE *, format_helper, const REAL_VALUE_TYPE *, const REAL_VALUE_TYPE *)
Definition real.cc:5334
const struct real_format motorola_double_format
Definition real.cc:3426
void real_maxval(REAL_VALUE_TYPE *, int, machine_mode)
Definition real.cc:2640
const struct real_format ieee_extended_motorola_format
Definition real.cc:3771
const REAL_VALUE_TYPE * dconst_sixth_ptr(void)
bool real_equal(const REAL_VALUE_TYPE *, const REAL_VALUE_TYPE *)
Definition real.cc:1133
const struct real_format ieee_extended_intel_96_format
Definition real.cc:3794
void real_floor(REAL_VALUE_TYPE *, format_helper, const REAL_VALUE_TYPE *)
Definition real.cc:5156
const struct real_format mips_extended_format
Definition real.cc:3955
const struct real_format ieee_half_format
Definition real.cc:4964
REAL_VALUE_TYPE real_from_string2(const char *, format_helper)
Definition real.cc:2195
void real_ceil(REAL_VALUE_TYPE *, format_helper, const REAL_VALUE_TYPE *)
Definition real.cc:5174
REAL_VALUE_TYPE dconst2
Definition emit-rtl.cc:108
int real_from_string(REAL_VALUE_TYPE *, const char *)
Definition real.cc:2006
HOST_WIDE_INT real_to_integer(const REAL_VALUE_TYPE *)
Definition real.cc:1422
bool real_iszero(const REAL_VALUE_TYPE *)
Definition real.cc:1288
const struct real_format * real_format_for_mode[NUM_MODE_FLOAT+NUM_MODE_DECIMAL_FLOAT]
const struct real_format vax_f_format
Definition real.cc:4545
bool real_identical(const REAL_VALUE_TYPE *, const REAL_VALUE_TYPE *)
Definition real.cc:1312
const struct real_format vax_d_format
Definition real.cc:4568
rtx const_double_from_real_value(REAL_VALUE_TYPE, machine_mode)
Definition emit-rtl.cc:573
bool exact_real_inverse(format_helper, REAL_VALUE_TYPE *)
Definition real.cc:1357
tree build_real_truncate(tree, REAL_VALUE_TYPE)
Definition tree.cc:2415
real_value_class
Definition real.h:26
@ rvc_nan
Definition real.h:30
@ rvc_inf
Definition real.h:29
@ rvc_normal
Definition real.h:28
@ rvc_zero
Definition real.h:27
const REAL_VALUE_TYPE * dconst_pi_ptr(void)
Definition real.cc:2485
#define SIGSZ
Definition real.h:36
void real_inf(REAL_VALUE_TYPE *, bool sign=false)
Definition real.cc:2542
#define REAL_WIDTH
Definition real.h:75
const struct real_format arm_half_format
Definition real.cc:4990
REAL_VALUE_TYPE dconsthalf
Definition emit-rtl.cc:111
signop
Definition signop.h:28
unsigned int cl
Definition real.h:43
unsigned int signalling
Definition real.h:49
unsigned int sign
Definition real.h:47
unsigned int decimal
Definition real.h:45
unsigned int uexp
Definition real.h:54
unsigned long sig[SIGSZ]
Definition real.h:56
unsigned int canonical
Definition real.h:52
Definition gengtype.h:252