* common.opt (fsigned-zeros): New command line option.
authorsayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 19 Jan 2007 19:35:22 +0000 (19:35 +0000)
committersayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 19 Jan 2007 19:35:22 +0000 (19:35 +0000)
* 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@120978 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/common.opt
gcc/doc/invoke.texi
gcc/flags.h
gcc/opts.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr30172-1.c

index e536c40..78513d2 100644 (file)
@@ -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.
index 109de7b..dfcda94 100644 (file)
@@ -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
index 3447ff8..5337288 100644 (file)
@@ -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
index f5fdd6b..ce9d6d7 100644 (file)
@@ -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.  */
index 788c2ce..6720af1 100644 (file)
@@ -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);
 }
 
index e0178ad..326a76a 100644 (file)
@@ -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.
index 14b5fa5..4e029b5 100644 (file)
@@ -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; }