OSDN Git Service

* expmed.c (expand_divmod): Ignore sdiv_pow2_cheap for modes in
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 12 Dec 2001 03:00:01 +0000 (03:00 +0000)
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 12 Dec 2001 03:00:01 +0000 (03:00 +0000)
        which there is no divide expander.

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

gcc/ChangeLog
gcc/expmed.c

index 95d55b1..47d63a6 100644 (file)
@@ -1,5 +1,10 @@
 2001-12-11  Richard Henderson  <rth@redhat.com>
 
+       * expmed.c (expand_divmod): Ignore sdiv_pow2_cheap for modes in
+       which there is no divide expander.
+
+2001-12-11  Richard Henderson  <rth@redhat.com>
+
        * except.c (sjlj_find_directly_reachable_regions): Don't
        consider RNL_BLOCKED a directly reachable region.
        (sjlj_assign_call_site_values): Trust directly_reachable.
index 8a7b6b9..8eecca3 100644 (file)
@@ -3271,7 +3271,16 @@ expand_divmod (rem_flag, code, mode, op0, op1, target, unsignedp)
                      goto fail1;
                  }
                else if (EXACT_POWER_OF_2_OR_ZERO_P (d)
-                        && (rem_flag ? smod_pow2_cheap : sdiv_pow2_cheap))
+                        && (rem_flag ? smod_pow2_cheap : sdiv_pow2_cheap)
+                        /* ??? The cheap metric is computed only for
+                           word_mode.  If this operation is wider, this may
+                           not be so.  Assume true if the optab has an
+                           expander for this mode.  */
+                        && (((rem_flag ? smod_optab : sdiv_optab)
+                             ->handlers[(int) compute_mode].insn_code
+                             != CODE_FOR_nothing)
+                            || (sdivmod_optab->handlers[(int) compute_mode]
+                                .insn_code != CODE_FOR_nothing)))
                  ;
                else if (EXACT_POWER_OF_2_OR_ZERO_P (abs_d))
                  {