aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorTorbjorn Granlund <tege@matematik.su.se>1998-10-05 02:08:56 +0200
committerJeff Law <law@gcc.gnu.org>1998-10-04 18:08:56 -0600
commit32fdf36bb633d048c30d8be6c5e45ffef024e440 (patch)
tree22508e809d2c2dbaf3bf42846bc47e8b4b8164ce /gcc
parent4284b774e6f846f1fe69479a6246a3bcfd6c3641 (diff)
downloadgcc-32fdf36bb633d048c30d8be6c5e45ffef024e440.zip
gcc-32fdf36bb633d048c30d8be6c5e45ffef024e440.tar.gz
gcc-32fdf36bb633d048c30d8be6c5e45ffef024e440.tar.bz2
expmed.c (expand_divmod): Don't widen for computing remainder if we seem to have a divmod pattern for...
* expmed.c (expand_divmod): Don't widen for computing remainder if we seem to have a divmod pattern for needed mode. From-SVN: r22828
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/expmed.c20
2 files changed, 21 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 929c4b1..fa5a057 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+Mon Oct 5 01:07:23 1998 Torbjorn Granlund <tege@matematik.su.se>
+
+ * expmed.c (expand_divmod): Don't widen for computing remainder
+ if we seem to have a divmod pattern for needed mode.
+
Mon Oct 5 01:01:42 1998 Zack Weinberg <zack@rabi.phys.columbia.edu>
* cpplib.c (macroexpand): Correct off-by-one error in handling
diff --git a/gcc/expmed.c b/gcc/expmed.c
index 734365f..f9bd9ad 100644
--- a/gcc/expmed.c
+++ b/gcc/expmed.c
@@ -3709,10 +3709,22 @@ expand_divmod (rem_flag, code, mode, op0, op1, target, unsignedp)
if (rem_flag)
{
- /* Try to produce the remainder directly without a library call. */
- remainder = sign_expand_binop (compute_mode, umod_optab, smod_optab,
- op0, op1, target,
- unsignedp, OPTAB_WIDEN);
+ /* Try to produce the remainder without producing the quotient.
+ If we seem to have a divmod patten that does not require widening,
+ don't try windening here. We should really have an WIDEN argument
+ to expand_twoval_binop, since what we'd really like to do here is
+ 1) try a mod insn in compute_mode
+ 2) try a divmod insn in compute_mode
+ 3) try a div insn in compute_mode and multiply-subtract to get
+ remainder
+ 4) try the same things with widening allowed. */
+ remainder
+ = sign_expand_binop (compute_mode, umod_optab, smod_optab,
+ op0, op1, target,
+ unsignedp,
+ ((optab2->handlers[(int) compute_mode].insn_code
+ != CODE_FOR_nothing)
+ ? OPTAB_DIRECT : OPTAB_WIDEN));
if (remainder == 0)
{
/* No luck there. Can we do remainder and divide at once