re PR middle-end/18902 (Naive (default) complex division algorithm)
authorRichard Henderson <rth@redhat.com>
Thu, 24 Feb 2005 09:24:17 +0000 (01:24 -0800)
committerRichard Henderson <rth@gcc.gnu.org>
Thu, 24 Feb 2005 09:24:17 +0000 (01:24 -0800)
        PR middle-end/18902
        * c-opts.c (c_common_post_options): Set flag_complex_method to 2
        for c99.
        * common.opt (fcx-limited-range): New.
        * opts.c (set_fast_math_flags): Set flag_cx_limited_range.
        * toplev.c (flag_complex_method): Initialize to 1.
        (process_options): Set flag_complex_method to 0 if
        flag_cx_limited_range.
        * doc/invoke.texi (-fcx-limited-range): New.

From-SVN: r95493

gcc/ChangeLog
gcc/c-opts.c
gcc/common.opt
gcc/doc/invoke.texi
gcc/opts.c
gcc/toplev.c

index 99c91c271c73c4865d61bc7512e039f588a449f3..d154fe04c0c9694f7bec77d31c43fc88d974dd06 100644 (file)
@@ -1,3 +1,15 @@
+2005-02-24  Richard Henderson  <rth@redhat.com>
+
+       PR middle-end/18902
+       * c-opts.c (c_common_post_options): Set flag_complex_method to 2
+       for c99.
+       * common.opt (fcx-limited-range): New.
+       * opts.c (set_fast_math_flags): Set flag_cx_limited_range.
+       * toplev.c (flag_complex_method): Initialize to 1.
+       (process_options): Set flag_complex_method to 0 if
+       flag_cx_limited_range.
+       * doc/invoke.texi (-fcx-limited-range): New.
+
 2005-02-24  Kazu Hirata  <kazu@cs.umass.edu>
 
        * cse.c (delete_trivially_dead_insns): Speed up by using
index 36c3f5bd68e9866795069b5a15bf8a0c1caa99f6..575ff4d485b72cc0754097f1be94ff36309f0510 100644 (file)
@@ -978,6 +978,11 @@ c_common_post_options (const char **pfilename)
   if (warn_missing_format_attribute && !warn_format)
     warning ("-Wmissing-format-attribute ignored without -Wformat");
 
+  /* C99 requires special handling of complex multiplication and division;
+     -ffast-math and -fcx-limited-range are handled in process_options.  */
+  if (flag_isoc99)
+    flag_complex_method = 2;
+
   if (flag_preprocess_only)
     {
       /* Open the output now.  We must do so even if flag_no_output is
index 10d157ede7d3b630750e7709d5094daf2687e004..f94643d509edeb87036923ecafb22e6dd60d7024 100644 (file)
@@ -310,6 +310,10 @@ fcse-skip-blocks
 Common Report Var(flag_cse_skip_blocks)
 When running CSE, follow conditional jumps
 
+fcx-limited-range
+Common Report Var(flag_cx_limited_range)
+Omit range reduction step when performing complex division
+
 fdata-sections
 Common Report Var(flag_data_sections)
 Place data items into their own section
index 6f13ecac5eeb9c0a418f8435457f5b0830eb6e50..8cf5ed9493f609929f0031aa48d20942d2ad9cd8 100644 (file)
@@ -285,8 +285,8 @@ Objective-C and Objective-C++ Dialects}.
 -fbounds-check -fmudflap -fmudflapth -fmudflapir @gol
 -fbranch-probabilities -fprofile-values -fvpt -fbranch-target-load-optimize @gol
 -fbranch-target-load-optimize2 -fbtr-bb-exclusive @gol
--fcaller-saves  -fcprop-registers @gol
--fcse-follow-jumps  -fcse-skip-blocks  -fdata-sections @gol
+-fcaller-saves  -fcprop-registers  -fcse-follow-jumps @gol
+-fcse-follow-jumps  -fcse-skip-blocks  -fcx-limited-range  -fdata-sections @gol
 -fdelayed-branch  -fdelete-null-pointer-checks @gol
 -fexpensive-optimizations  -ffast-math  -ffloat-store @gol
 -fforce-addr  -fforce-mem  -ffunction-sections @gol
@@ -5072,7 +5072,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} and @option{-fno-signaling-nans}.
+@option{-fno-rounding-math}, @option{-fno-signaling-nans}
+and @option{fcx-limited-range}.
 
 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
 
@@ -5176,6 +5177,17 @@ disable all GCC optimizations that affect signaling NaN behavior.
 Treat floating point constant as single precision constant instead of
 implicitly converting it to double precision constant.
 
+@item -fcx-limited-range
+@itemx -fno-cx-limited-range
+@opindex fcx-limited-range
+@opindex fno-cx-limited-range
+When enabled, this option states that a range reduction step is not
+needed when performing complex division.  The default is
+@option{-fno-cx-limited-range}, but is enabled by @option{-ffast-math}.
+
+This option controls the default setting of the ISO C99 
+@code{CX_LIMITED_RANGE} pragma.  Nevertheless, the option applies to
+all languages.
 
 @end table
 
index 8af263a8498c9bd516163e1af9ca83b4b90302c2..fcb8f6d5c1a674b5959e826d5a0f88fd31d07b7c 100644 (file)
@@ -1097,6 +1097,7 @@ set_fast_math_flags (int set)
     {
       flag_signaling_nans = 0;
       flag_rounding_math = 0;
+      flag_cx_limited_range = 1;
     }
 }
 
index ae564f05f1084b7d58b65538781ea7e087dbd8d3..e7947eba2ebc33cfdeac1926352d41561d5853ba 100644 (file)
@@ -269,7 +269,7 @@ int flag_pcc_struct_return = DEFAULT_PCC_STRUCT_RETURN;
    1 means wide ranges of inputs must work for complex divide.
    2 means C99-like requirements for complex multiply and divide.  */
 
-int flag_complex_method = 0;
+int flag_complex_method = 1;
 
 /* Nonzero means that we don't want inlining by virtue of -fno-inline,
    not just because the tree inliner turned us off.  */
@@ -1948,6 +1948,10 @@ process_options (void)
   /* The presence of IEEE signaling NaNs, implies all math can trap.  */
   if (flag_signaling_nans)
     flag_trapping_math = 1;
+
+  /* With -fcx-limited-range, we do cheap and quick complex arithmetic.  */
+  if (flag_cx_limited_range)
+    flag_complex_method = 0;
 }
 
 /* Initialize the compiler back end.  */