diff options
author | Roger Sayle <roger@eyesopen.com> | 2007-01-19 19:35:22 +0000 |
---|---|---|
committer | Roger Sayle <sayle@gcc.gnu.org> | 2007-01-19 19:35:22 +0000 |
commit | db02da79174dea480aa4217dbe7afd3d3b8364d1 (patch) | |
tree | e158e5c13ab326a2c00f9dd76f5137fb2f592973 /gcc | |
parent | d88c64564e9c9c57bea4c6ce15fd400f589f9de3 (diff) | |
download | gcc-db02da79174dea480aa4217dbe7afd3d3b8364d1.zip gcc-db02da79174dea480aa4217dbe7afd3d3b8364d1.tar.gz gcc-db02da79174dea480aa4217dbe7afd3d3b8364d1.tar.bz2 |
common.opt (fsigned-zeros): New command line option.
* common.opt (fsigned-zeros): New command line option.
* flags.h (HONOR_SIGNED_ZEROS): Control via flag_signed_zeros instead
of flag_unsafe_math_optimizations.
* opts.c (set_fast_math_flags): The -ffast-math command line option
implies -fno-signed-zeros.
(fast_math_flags_set_p): Likewise.
* doc/invoke.texi: Document new -fno-signed-zeros option, and update
the documentation of -ffast-math appropriately. Wrap long lines.
* gcc.dg/pr30172-1.c: Specify the -fno-signed-zeros command line
option instead of -funsafe-math-optimizations.
From-SVN: r120978
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 12 | ||||
-rw-r--r-- | gcc/common.opt | 4 | ||||
-rw-r--r-- | gcc/doc/invoke.texi | 23 | ||||
-rw-r--r-- | gcc/flags.h | 2 | ||||
-rw-r--r-- | gcc/opts.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr30172-1.c | 2 |
7 files changed, 42 insertions, 8 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e536c40..78513d2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2007-01-19 Roger Sayle <roger@eyesopen.com> + + * common.opt (fsigned-zeros): New command line option. + * flags.h (HONOR_SIGNED_ZEROS): Control via flag_signed_zeros instead + of flag_unsafe_math_optimizations. + * opts.c (set_fast_math_flags): The -ffast-math command line option + implies -fno-signed-zeros. + (fast_math_flags_set_p): Likewise. + + * doc/invoke.texi: Document new -fno-signed-zeros option, and update + the documentation of -ffast-math appropriately. Wrap long lines. + 2007-01-19 Steve Ellcey <sje@cup.hp.com> * system.h (ASM_MAKE_LABEL_LINKONCE): Poison. diff --git a/gcc/common.opt b/gcc/common.opt index 109de7b..dfcda94 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -845,6 +845,10 @@ fsignaling-nans Common Report Var(flag_signaling_nans) Disable optimizations observable by IEEE signaling NaNs +fsigned-zeros +Common Report Var(flag_signed_zeros) Init(1) +Disable floating point optimizations that ignore the IEEE signedness of zero + fsingle-precision-constant Common Report Var(flag_single_precision_constant) Convert floating point constants to single precision constants diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 3447ff8..5337288 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -323,7 +323,8 @@ Objective-C and Objective-C++ Dialects}. -fno-default-inline -fno-defer-pop -fmove-loop-invariants @gol -fno-function-cse -fno-guess-branch-probability @gol -fno-inline -fno-math-errno -fno-peephole -fno-peephole2 @gol --funsafe-math-optimizations -funsafe-loop-optimizations -ffinite-math-only @gol +-funsafe-math-optimizations -funsafe-loop-optimizations @gol +-ffinite-math-only -fno-signed-zeros @gol -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol -fomit-frame-pointer -foptimize-register-move @gol -foptimize-sibling-calls -fprefetch-loop-arrays @gol @@ -5631,8 +5632,8 @@ them to store all pertinent intermediate computations into variables. @opindex ffast-math Sets @option{-fno-math-errno}, @option{-funsafe-math-optimizations}, @* @option{-fno-trapping-math}, @option{-ffinite-math-only}, -@option{-fno-rounding-math}, @option{-fno-signaling-nans} -and @option{fcx-limited-range}. +@option{-fno-rounding-math}, @option{-fno-signaling-nans}, +@option{-fno-signed-zeros} and @option{fcx-limited-range}. This option causes the preprocessor macro @code{__FAST_MATH__} to be defined. @@ -5655,9 +5656,9 @@ math functions. The default is @option{-fmath-errno}. -On Darwin systems, the math library never sets @code{errno}. There is therefore -no reason for the compiler to consider the possibility that it might, -and @option{-fno-math-errno} is the default. +On Darwin systems, the math library never sets @code{errno}. There is +therefore no reason for the compiler to consider the possibility that +it might, and @option{-fno-math-errno} is the default. @item -funsafe-math-optimizations @opindex funsafe-math-optimizations @@ -5685,6 +5686,16 @@ an exact implementation of IEEE or ISO rules/specifications. The default is @option{-fno-finite-math-only}. +@item -fno-signed-zeros +@opindex fno-signed-zeros +Allow optimizations for floating point arithmetic that ignore the +signedness of zero. IEEE arithmetic specifies the behavior of +distinct +0.0 and -0.0 values, which then prohibits simplification +of expressions such as x+0.0 or 0.0*x (even with @option{-ffinte-math-only}). +This option implies that the sign of a zero result isn't significant. + +The default is @option{-fsigned-zeros}. + @item -fno-trapping-math @opindex fno-trapping-math Compile code assuming that floating-point operations cannot generate diff --git a/gcc/flags.h b/gcc/flags.h index f5fdd6b..ce9d6d7b 100644 --- a/gcc/flags.h +++ b/gcc/flags.h @@ -281,7 +281,7 @@ extern const char *flag_random_seed; /* Like HONOR_NANS, but true if the given mode distinguishes between positive and negative zero, and the sign of zero is important. */ #define HONOR_SIGNED_ZEROS(MODE) \ - (MODE_HAS_SIGNED_ZEROS (MODE) && !flag_unsafe_math_optimizations) + (MODE_HAS_SIGNED_ZEROS (MODE) && flag_signed_zeros) /* Like HONOR_NANS, but true if given mode supports sign-dependent rounding, and the rounding mode is important. */ @@ -1076,6 +1076,7 @@ set_fast_math_flags (int set) flag_trapping_math = !set; flag_unsafe_math_optimizations = set; flag_finite_math_only = set; + flag_signed_zeros = !set; flag_errno_math = !set; if (set) { @@ -1092,6 +1093,7 @@ fast_math_flags_set_p (void) return (!flag_trapping_math && flag_unsafe_math_optimizations && flag_finite_math_only + && !flag_signed_zeros && !flag_errno_math); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e0178ad..326a76a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2007-01-19 Roger Sayle <roger@eyesopen.com> + + * gcc.dg/pr30172-1.c: Specify the -fno-signed-zeros command line + option instead of -funsafe-math-optimizations. + 2007-01-19 Tomas Bily <tbily@suse.cz> gcc.dg/tree-prof/indir-call-prof.c: New. diff --git a/gcc/testsuite/gcc.dg/pr30172-1.c b/gcc/testsuite/gcc.dg/pr30172-1.c index 14b5fa5..4e029b5 100644 --- a/gcc/testsuite/gcc.dg/pr30172-1.c +++ b/gcc/testsuite/gcc.dg/pr30172-1.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-funsafe-math-optimizations -ffinite-math-only -fdump-tree-gimple" } */ +/* { dg-options "-fno-signed-zeros -ffinite-math-only -fdump-tree-gimple" } */ _Complex double test1 (double x) { return x + 1.i; } _Complex double test2 (double x) { return 1 + x * 1.i; } |