expmed.c (expand_divmod): Ignore sdiv_pow2_cheap for modes in which there is no divid...
authorRichard Henderson <rth@redhat.com>
Wed, 12 Dec 2001 03:00:01 +0000 (19:00 -0800)
committerRichard Henderson <rth@gcc.gnu.org>
Wed, 12 Dec 2001 03:00:01 +0000 (19:00 -0800)
        * expmed.c (expand_divmod): Ignore sdiv_pow2_cheap for modes in
        which there is no divide expander.

From-SVN: r47916

gcc/ChangeLog
gcc/expmed.c

index 95d55b1e84d94edea57decf0031dcd1e6005240a..47d63a612ac03afcd6817caae879a31b0adee03c 100644 (file)
@@ -1,3 +1,8 @@
+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
index 8a7b6b91d550bd8b0e91519c257674adccd6d20a..8eecca34efa3b836a712c0c07d07cd2c6b507bf0 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))
                  {