(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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@71032
138bc75d-0d04-0410-961f-
82ee72b054a4
+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.
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
-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
@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.
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
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). */
/* 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 */
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:
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. */
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. */
{ "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 },