2
0
mirror of git://gcc.gnu.org/git/gcc.git synced 2025-04-09 23:21:31 +08:00

toplev.c (flag_rounding_math): New global variable.

* toplev.c (flag_rounding_math): New global variable.
	(f_options): Add to the list of language independent options.
	* flags.h (flag_rounding_math): Prototype here.
	(HONOR_SIGN_DEPENDENT_ROUNDING): Use flag_rounding_math instead.
	* common.opt (frounding-math): New common command line option.
	* opts.c (common_handle_option): Handle OPT_frounding_math.
	(set_fast_math_flags): -ffast-math clears flag_rounding_math.

	* doc/invoke.texi: Document this new command line option.

From-SVN: r71032
This commit is contained in:
Roger Sayle 2003-09-03 20:57:31 +00:00 committed by Roger Sayle
parent b689848ffd
commit 039c3d42d5
6 changed files with 60 additions and 6 deletions

@ -1,3 +1,15 @@
2003-09-03 Roger Sayle <roger@eyesopen.com>
* toplev.c (flag_rounding_math): New global variable.
(f_options): Add to the list of language independent options.
* flags.h (flag_rounding_math): Prototype here.
(HONOR_SIGN_DEPENDENT_ROUNDING): Use flag_rounding_math instead.
* common.opt (frounding-math): New common command line option.
* opts.c (common_handle_option): Handle OPT_frounding_math.
(set_fast_math_flags): -ffast-math clears flag_rounding_math.
* doc/invoke.texi: Document this new command line option.
2003-09-03 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
* config/sol2.h (NO_IMPLICIT_EXTERN_C): Update comment.

@ -552,6 +552,10 @@ frerun-loop-opt
Common
Run the loop optimizer twice
frounding-math
Common
Disable optimizations that assume default FP rounding behavior
fsched-interblock
Common
Enable scheduling across basic blocks

@ -280,7 +280,7 @@ in the following sections.
-freduce-all-givs -fregmove -frename-registers @gol
-freorder-blocks -freorder-functions @gol
-frerun-cse-after-loop -frerun-loop-opt @gol
-fschedule-insns -fschedule-insns2 @gol
-frounding-math -fschedule-insns -fschedule-insns2 @gol
-fno-sched-interblock -fno-sched-spec -fsched-spec-load @gol
-fsched-spec-load-dangerous -fsched2-use-superblocks @gol
-fsched2-use-traces -fsignaling-nans @gol
@ -4260,8 +4260,8 @@ them to store all pertinent intermediate computations into variables.
@item -ffast-math
@opindex ffast-math
Sets @option{-fno-math-errno}, @option{-funsafe-math-optimizations}, @*
@option{-fno-trapping-math}, @option{-ffinite-math-only} and @*
@option{-fno-signaling-nans}.
@option{-fno-trapping-math}, @option{-ffinite-math-only},
@option{-fno-rounding-math} and @option{-fno-signaling-nans}.
This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
@ -4325,6 +4325,26 @@ math functions.
The default is @option{-ftrapping-math}.
@item -frounding-math
@opindex frounding-math
Disable transformations and optimizations that assume default floating
point rounding behavior. This is round-to-zero for all floating point
to integer conversions, and round-to-nearest for all other arithmetic
truncations. This option should be specified for programs that change
the FP rounding mode dynamically, or that may be executed with a
non-default rounding mode. This option disables constant folding of
floating point expressions at compile-time (which may be affected by
rounding mode) and arithmetic transformations that are unsafe in the
presence of sign-dependent rounding modes.
The default is @option{-fno-rounding-math}.
This option is experimental and does not currently guarantee to
disable all GCC optimizations that are affected by rounding mode.
Future versions of gcc may provide finer control of this setting
using C99's @code{FENV_ACCESS} pragma. This command line option
will be used to specify the default state for @code{FENV_ACCESS}.
@item -fsignaling-nans
@opindex fsignaling-nans
Compile code assuming that IEEE signaling NaNs may generate user-visible

@ -363,6 +363,11 @@ extern int flag_finite_math_only;
extern int flag_trapping_math;
/* Nonzero means disable transformations that assume default floating
point rounding behavior. */
extern int flag_rounding_math;
/* 0 means straightforward implementation of complex divide acceptable.
1 means wide ranges of inputs must work for complex divide.
2 means C99-like requirements for complex divide (not yet implemented). */
@ -716,6 +721,6 @@ extern const char *flag_random_seed;
/* Like HONOR_NANS, but true if given mode supports sign-dependent rounding,
and the rounding mode is important. */
#define HONOR_SIGN_DEPENDENT_ROUNDING(MODE) \
(MODE_HAS_SIGN_DEPENDENT_ROUNDING (MODE) && !flag_unsafe_math_optimizations)
(MODE_HAS_SIGN_DEPENDENT_ROUNDING (MODE) && flag_rounding_math)
#endif /* ! GCC_FLAGS_H */

@ -1220,8 +1220,12 @@ common_handle_option (size_t scode, const char *arg,
flag_rerun_loop_opt = value;
break;
case OPT_frounding_math:
flag_rounding_math = value;
break;
case OPT_fsched_interblock:
flag_schedule_interblock= value;
flag_schedule_interblock = value;
break;
case OPT_fsched_spec:
@ -1547,7 +1551,10 @@ set_fast_math_flags (int set)
flag_finite_math_only = set;
flag_errno_math = !set;
if (set)
flag_signaling_nans = 0;
{
flag_signaling_nans = 0;
flag_rounding_math = 0;
}
}
/* Return true iff flags are set as if -ffast-math. */

@ -633,6 +633,11 @@ int flag_finite_math_only = 0;
int flag_trapping_math = 1;
/* Nonzero means disable transformations that assume default floating
point rounding behavior. */
int flag_rounding_math = 0;
/* Nonzero means disable transformations observable by signaling NaNs.
This option implies that any operation on an IEEE signaling NaN can
generate a (user-visible) trap. */
@ -1113,6 +1118,7 @@ static const lang_independent_options f_options[] =
{ "guess-branch-probability", &flag_guess_branch_prob, 1 },
{"math-errno", &flag_errno_math, 1 },
{"trapping-math", &flag_trapping_math, 1 },
{"rounding-math", &flag_rounding_math, 1 },
{"unsafe-math-optimizations", &flag_unsafe_math_optimizations, 1 },
{"signaling-nans", &flag_signaling_nans, 1 },
{"bounds-check", &flag_bounds_check, 1 },