toplev.c (flag_if_conversion, [...]): New static variables.
authorJan Hubicka <jh@suse.cz>
Mon, 29 Apr 2002 11:39:31 +0000 (13:39 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Mon, 29 Apr 2002 11:39:31 +0000 (11:39 +0000)
* toplev.c (flag_if_conversion, flag_if_conversion2): New static
variables.
(lang_independent_options): Add -fif-conversion, -fif-conversion2
(rest_of_compilation): Do if conversion only when asked for.
(parse_options_and_default_flags): Set new variables to 1 for -O1
* invoke.texi (-fif-conversion, -fif-conversion2): Document.

From-SVN: r52891

gcc/ChangeLog
gcc/doc/invoke.texi
gcc/toplev.c

index c8d4d77d422cab7518f2a1c88c6ec104603f8d31..ac51b904e669928c6b4bdab2468228bd04a221ca 100644 (file)
@@ -1,3 +1,12 @@
+Mon Apr 29 13:36:41 CEST 2002  Jan Hubicka  <jh@suse.cz>
+
+       * toplev.c (flag_if_conversion, flag_if_conversion2): New static
+       variables.
+       (lang_independent_options): Add -fif-conversion, -fif-conversion2
+       (rest_of_compilation): Do if conversion only when asked for.
+       (parse_options_and_default_flags): Set new variables to 1 for -O1
+       * invoke.texi (-fif-conversion, -fif-conversion2): Document.
+
 Mon Apr 29 13:02:50 CEST 2002  Jan Hubicka  <jh@suse.cz>
 
        * i386.c (dbx64_register_map): Fix typo.
index be361e598016ec53ef8eeff9b3bd8e7805e78168..6bfe7dfe6f612c05ec8ca049533db1d7e4874d37 100644 (file)
@@ -267,6 +267,7 @@ in the following sections.
 -fexpensive-optimizations  -ffast-math  -ffloat-store @gol
 -fforce-addr  -fforce-mem  -ffunction-sections @gol
 -fgcse  -fgcse-lm  -fgcse-sm -floop-optimize -fcrossjumping @gol
+-fif-conversion -fif-conversion2 @gol
 -finline-functions  -finline-limit=@var{n}  -fkeep-inline-functions @gol
 -fkeep-static-consts  -fmerge-constants  -fmerge-all-constants @gol
 -fmove-all-movables  -fno-default-inline  -fno-defer-pop @gol
@@ -3522,6 +3523,18 @@ well.
 Perform cross-jumping transformation. This transformation unifies equivalent code and save code size. The
 resulting code may or may not perform better than without cross-jumping.
 
+@item -fif-conversion
+@opindex if-conversion
+Attempt to transform conditional jumps into branch-less equivalents.  This
+include use of conditional moves, min, max, set flags and abs instructions, and
+some tricks doable by standard arithmetics.  The use of conditional execution
+on chips where it is available is controlled by @code{if-conversion2}.
+
+@item -fif-conversion2
+@opindex if-conversion2
+Use conditional execution (where available) to transform conditional jumps into
+branch-less equivalents.
+
 @item -fdelete-null-pointer-checks
 @opindex fdelete-null-pointer-checks
 Use global dataflow analysis to identify and eliminate useless checks
index 42c39c101f47267584053d1be7dae533fc551ffb..01e3276b3e20521cc86d5255822894c411919d4d 100644 (file)
@@ -600,6 +600,14 @@ static int flag_loop_optimize;
 
 static int flag_crossjumping;
 
+/* Nonzero means perform if conversion.  */
+
+static int flag_if_conversion;
+
+/* Nonzero means perform if conversion after reload.  */
+
+static int flag_if_conversion2;
+
 /* Nonzero means to use global dataflow analysis to eliminate
    useless null pointer tests.  */
 
@@ -1016,6 +1024,10 @@ static const lang_independent_options f_options[] =
    N_("Perform the loop optimizations") },
   {"crossjumping", &flag_crossjumping, 1,
    N_("Perform cross-jumping optimization") },
+  {"if-conversion", &flag_if_conversion, 1,
+   N_("Perform conversion of conditional jumps to branchless equivalents") },
+  {"if-conversion2", &flag_if_conversion2, 1,
+   N_("Perform conversion of conditional jumps to conditional execution") },
   {"rerun-cse-after-loop", &flag_rerun_cse_after_loop, 1,
    N_("Run CSE pass after loop optimizations") },
   {"rerun-loop-opt", &flag_rerun_loop_opt, 1,
@@ -2635,7 +2647,7 @@ rest_of_compilation (decl)
 
   timevar_push (TV_JUMP);
 
-  if (optimize > 0)
+  if (flag_delete_null_pointer_checks || flag_if_conversion)
     {
       open_dump_file (DFI_null, decl);
       find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
@@ -2648,7 +2660,8 @@ rest_of_compilation (decl)
        delete_null_pointer_checks (insns);
 
       timevar_push (TV_IFCVT);
-      if_convert (0);
+      if (flag_if_conversion)
+        if_convert (0);
       timevar_pop (TV_IFCVT);
       cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_PRE_LOOP);
       close_dump_file (DFI_null, print_rtl_with_bb, insns);
@@ -2897,7 +2910,8 @@ rest_of_compilation (decl)
 
          timevar_push (TV_IFCVT);
          cleanup_cfg (CLEANUP_EXPENSIVE);
-         if_convert (0);
+         if (flag_if_conversion)
+           if_convert (0);
          timevar_pop(TV_IFCVT);
 
          timevar_pop (TV_JUMP);
@@ -2996,7 +3010,7 @@ rest_of_compilation (decl)
 
   /* Rerun if-conversion, as combine may have simplified things enough to
      now meet sequence length restrictions.  */
-  if (optimize > 0)
+  if (flag_if_conversion)
     {
       timevar_push (TV_IFCVT);
       open_dump_file (DFI_ce, decl);
@@ -3237,7 +3251,7 @@ rest_of_compilation (decl)
       timevar_pop (TV_RENAME_REGISTERS);
     }
 
-  if (optimize > 0)
+  if (flag_if_conversion2)
     {
       timevar_push (TV_IFCVT2);
       open_dump_file (DFI_ce2, decl);
@@ -4593,6 +4607,8 @@ parse_options_and_default_flags (argc, argv)
       flag_cprop_registers = 1;
       flag_loop_optimize = 1;
       flag_crossjumping = 1;
+      flag_if_conversion = 1;
+      flag_if_conversion2 = 1;
     }
 
   if (optimize >= 2)