loop.c (insert_bct): Replace use of sdiv_optab with asr_optab and delete comment...
authorMichael Tiemann <tiemann@holodeck.cygnus.com>
Wed, 25 Aug 1999 05:28:26 +0000 (05:28 +0000)
committerJeff Law <law@gcc.gnu.org>
Wed, 25 Aug 1999 05:28:26 +0000 (23:28 -0600)
        * loop.c (insert_bct): Replace use of sdiv_optab with asr_optab
        and delete comment that code should be rewritten.

From-SVN: r28839

gcc/ChangeLog
gcc/loop.c

index 6597b92dc2f5fa0f8b420314dbe34f85cb265497..7dcf4b92ad06cc09abe8a3540b7579f4f410659a 100644 (file)
@@ -1,3 +1,8 @@
+Tue Aug 24 23:26:44 1999  Michael Tiemann  <tiemann@holodeck.cygnus.com>
+
+       * loop.c (insert_bct): Replace use of sdiv_optab with asr_optab
+       and delete comment that code should be rewritten.
+
 Tue Aug 24 22:56:35 1999  Jeffrey A Law  (law@cygnus.com)
 
        * haifa-sched.c (find_rgns): Mark a block found during the DFS search
index db4664ce192599bfa2afe1fee946b90cfef360c9..4d18f5ee65e7f4f752830f90b094657467f2124a 100644 (file)
@@ -9235,19 +9235,10 @@ insert_bct (loop_start, loop_end, loop_info)
                                   NULL_RTX, 0, OPTAB_LIB_WIDEN);
 
        if (increment_value_abs != 1)
-         {
-           /* ??? This will generate an expensive divide instruction for
-              most targets.  The original authors apparently expected this
-              to be a shift, since they test for power-of-2 divisors above,
-              but just naively generating a divide instruction will not give 
-              a shift.  It happens to work for the PowerPC target because
-              the rs6000.md file has a divide pattern that emits shifts.
-              It will probably not work for any other target.  */
-           iterations_num_reg = expand_binop (loop_var_mode, sdiv_optab,
-                                              temp_reg,
-                                              GEN_INT (increment_value_abs),
-                                              NULL_RTX, 0, OPTAB_LIB_WIDEN);
-         }
+         iterations_num_reg = expand_binop (loop_var_mode, asr_optab,
+                                            temp_reg,
+                                            GEN_INT (exact_log2 (increment_value_abs)),
+                                            NULL_RTX, 0, OPTAB_LIB_WIDEN);
        else
          iterations_num_reg = temp_reg;
       }