diff options
author | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 1998-10-05 00:08:56 +0000 |
---|---|---|
committer | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 1998-10-05 00:08:56 +0000 |
commit | d65671519e36e8dd74c80fb98c09a7b8fd96180c (patch) | |
tree | 22508e809d2c2dbaf3bf42846bc47e8b4b8164ce /gcc/expmed.c | |
parent | 269d121736916dc9d023e25438c1969ca3a1c37a (diff) | |
download | gcc-d65671519e36e8dd74c80fb98c09a7b8fd96180c.tar.gz |
* expmed.c (expand_divmod): Don't widen for computing remainder
if we seem to have a divmod pattern for needed mode.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@22828 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/expmed.c')
-rw-r--r-- | gcc/expmed.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/gcc/expmed.c b/gcc/expmed.c index 734365f8d35..f9bd9ad20be 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 |