comparison gcc/real.h @ 63:b7f97abdc517 gcc-4.6-20100522

update gcc from gcc-4.5.0 to gcc-4.6
author ryoma <e075725@ie.u-ryukyu.ac.jp>
date Mon, 24 May 2010 12:47:05 +0900
parents 77e2b8dfacca
children 04ced10e8804
comparison
equal deleted inserted replaced
56:3c8a44c06a95 63:b7f97abdc517
1 /* Definitions of floating-point access for GNU compiler. 1 /* Definitions of floating-point access for GNU compiler.
2 Copyright (C) 1989, 1991, 1994, 1996, 1997, 1998, 1999, 2 Copyright (C) 1989, 1991, 1994, 1996, 1997, 1998, 1999,
3 2000, 2002, 2003, 2004, 2005, 2007, 2008 Free Software Foundation, Inc. 3 2000, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010
4 Free Software Foundation, Inc.
4 5
5 This file is part of GCC. 6 This file is part of GCC.
6 7
7 GCC is free software; you can redistribute it and/or modify it under 8 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free 9 the terms of the GNU General Public License as published by the Free
19 <http://www.gnu.org/licenses/>. */ 20 <http://www.gnu.org/licenses/>. */
20 21
21 #ifndef GCC_REAL_H 22 #ifndef GCC_REAL_H
22 #define GCC_REAL_H 23 #define GCC_REAL_H
23 24
24 #ifndef GENERATOR_FILE
25 #include <gmp.h>
26 #include <mpfr.h>
27 #include <mpc.h>
28 extern tree do_mpc_arg2 (tree, tree, tree, int, int (*)(mpc_ptr, mpc_srcptr, mpc_srcptr, mpc_rnd_t));
29 #endif
30 #include "machmode.h" 25 #include "machmode.h"
31 26
32 /* An expanded form of the represented number. */ 27 /* An expanded form of the represented number. */
33 28
34 /* Enumerate the special cases of numbers that we encounter. */ 29 /* Enumerate the special cases of numbers that we encounter. */
197 (FLOAT_MODE_P (MODE) && FLOAT_MODE_FORMAT (MODE)->has_signed_zero) 192 (FLOAT_MODE_P (MODE) && FLOAT_MODE_FORMAT (MODE)->has_signed_zero)
198 #define MODE_HAS_SIGN_DEPENDENT_ROUNDING(MODE) \ 193 #define MODE_HAS_SIGN_DEPENDENT_ROUNDING(MODE) \
199 (FLOAT_MODE_P (MODE) \ 194 (FLOAT_MODE_P (MODE) \
200 && FLOAT_MODE_FORMAT (MODE)->has_sign_dependent_rounding) 195 && FLOAT_MODE_FORMAT (MODE)->has_sign_dependent_rounding)
201 196
197 /* True if the given mode has a NaN representation and the treatment of
198 NaN operands is important. Certain optimizations, such as folding
199 x * 0 into 0, are not correct for NaN operands, and are normally
200 disabled for modes with NaNs. The user can ask for them to be
201 done anyway using the -funsafe-math-optimizations switch. */
202 #define HONOR_NANS(MODE) \
203 (MODE_HAS_NANS (MODE) && !flag_finite_math_only)
204
205 /* Like HONOR_NANs, but true if we honor signaling NaNs (or sNaNs). */
206 #define HONOR_SNANS(MODE) (flag_signaling_nans && HONOR_NANS (MODE))
207
208 /* As for HONOR_NANS, but true if the mode can represent infinity and
209 the treatment of infinite values is important. */
210 #define HONOR_INFINITIES(MODE) \
211 (MODE_HAS_INFINITIES (MODE) && !flag_finite_math_only)
212
213 /* Like HONOR_NANS, but true if the given mode distinguishes between
214 positive and negative zero, and the sign of zero is important. */
215 #define HONOR_SIGNED_ZEROS(MODE) \
216 (MODE_HAS_SIGNED_ZEROS (MODE) && flag_signed_zeros)
217
218 /* Like HONOR_NANS, but true if given mode supports sign-dependent rounding,
219 and the rounding mode is important. */
220 #define HONOR_SIGN_DEPENDENT_ROUNDING(MODE) \
221 (MODE_HAS_SIGN_DEPENDENT_ROUNDING (MODE) && flag_rounding_math)
202 222
203 /* Declare functions in real.c. */ 223 /* Declare functions in real.c. */
204 224
205 /* Binary or unary arithmetic on tree_code. */ 225 /* Binary or unary arithmetic on tree_code. */
206 extern bool real_arithmetic (REAL_VALUE_TYPE *, int, const REAL_VALUE_TYPE *, 226 extern bool real_arithmetic (REAL_VALUE_TYPE *, int, const REAL_VALUE_TYPE *,
366 REAL_VALUE_TYPE); 386 REAL_VALUE_TYPE);
367 387
368 #define REAL_VALUE_TO_INT(plow, phigh, r) \ 388 #define REAL_VALUE_TO_INT(plow, phigh, r) \
369 real_to_integer2 (plow, phigh, &(r)) 389 real_to_integer2 (plow, phigh, &(r))
370 390
371 extern REAL_VALUE_TYPE real_arithmetic2 (int, const REAL_VALUE_TYPE *, 391 extern REAL_VALUE_TYPE real_value_negate (const REAL_VALUE_TYPE *);
372 const REAL_VALUE_TYPE *); 392 extern REAL_VALUE_TYPE real_value_abs (const REAL_VALUE_TYPE *);
373
374 #define REAL_VALUE_NEGATE(X) \
375 real_arithmetic2 (NEGATE_EXPR, &(X), NULL)
376
377 #define REAL_VALUE_ABS(X) \
378 real_arithmetic2 (ABS_EXPR, &(X), NULL)
379 393
380 extern int significand_size (enum machine_mode); 394 extern int significand_size (enum machine_mode);
381 395
382 extern REAL_VALUE_TYPE real_from_string2 (const char *, enum machine_mode); 396 extern REAL_VALUE_TYPE real_from_string2 (const char *, enum machine_mode);
383 397
468 const REAL_VALUE_TYPE *); 482 const REAL_VALUE_TYPE *);
469 483
470 /* Set the sign of R to the sign of X. */ 484 /* Set the sign of R to the sign of X. */
471 extern void real_copysign (REAL_VALUE_TYPE *, const REAL_VALUE_TYPE *); 485 extern void real_copysign (REAL_VALUE_TYPE *, const REAL_VALUE_TYPE *);
472 486
473 #ifndef GENERATOR_FILE
474 /* Convert between MPFR and REAL_VALUE_TYPE. The caller is
475 responsible for initializing and clearing the MPFR parameter. */
476
477 extern void real_from_mpfr (REAL_VALUE_TYPE *, mpfr_srcptr, tree, mp_rnd_t);
478 extern void mpfr_from_real (mpfr_ptr, const REAL_VALUE_TYPE *, mp_rnd_t);
479 #endif
480
481 /* Check whether the real constant value given is an integer. */ 487 /* Check whether the real constant value given is an integer. */
482 extern bool real_isinteger (const REAL_VALUE_TYPE *c, enum machine_mode mode); 488 extern bool real_isinteger (const REAL_VALUE_TYPE *c, enum machine_mode mode);
483 489
484 /* Write into BUF the maximum representable finite floating-point 490 /* Write into BUF the maximum representable finite floating-point
485 number, (1 - b**-p) * b**emax for a given FP format FMT as a hex 491 number, (1 - b**-p) * b**emax for a given FP format FMT as a hex