summaryrefslogtreecommitdiff
path: root/gcc/expmed.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2001-12-11 19:00:01 -0800
committerRichard Henderson <rth@gcc.gnu.org>2001-12-11 19:00:01 -0800
commita8c7e72da252fa6d01037d70d9bf24f9af37b07d (patch)
tree33bcb4fa6a02617cfdb400f1965f75f861fee372 /gcc/expmed.c
parent98ce21b3b388f4f93b1926c1bac451ead787292a (diff)
downloadgcc-a8c7e72da252fa6d01037d70d9bf24f9af37b07d.tar.gz
expmed.c (expand_divmod): Ignore sdiv_pow2_cheap for modes in which there is no divide expander.
* expmed.c (expand_divmod): Ignore sdiv_pow2_cheap for modes in which there is no divide expander. From-SVN: r47916
Diffstat (limited to 'gcc/expmed.c')
-rw-r--r--gcc/expmed.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/gcc/expmed.c b/gcc/expmed.c
index 8a7b6b91d55..8eecca34efa 100644
--- a/gcc/expmed.c
+++ b/gcc/expmed.c
@@ -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))
{