diff options
author | Richard Kenner <kenner@gcc.gnu.org> | 1995-12-13 16:11:05 -0500 |
---|---|---|
committer | Richard Kenner <kenner@gcc.gnu.org> | 1995-12-13 16:11:05 -0500 |
commit | a45cf58ce9640a830d6b964739bd10d6bb05637f (patch) | |
tree | ee4dc560fa99726e243ace156d24ca4856886809 /gcc/expmed.c | |
parent | 8092a8e8417c5fa4bc35e91ab9f20ac2f63bee13 (diff) | |
download | gcc-a45cf58ce9640a830d6b964739bd10d6bb05637f.tar.gz |
(expand_divmod): Don't use TARGET if it's the wrong mode.
From-SVN: r10708
Diffstat (limited to 'gcc/expmed.c')
-rw-r--r-- | gcc/expmed.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/gcc/expmed.c b/gcc/expmed.c index cddfe3e050b..b89a5f85213 100644 --- a/gcc/expmed.c +++ b/gcc/expmed.c @@ -3188,7 +3188,7 @@ expand_divmod (rem_flag, code, mode, op0, op1, target, unsignedp) or remainder to get floor rounding, once we have the remainder. Notice that we compute also the final remainder value here, and return the result right away. */ - if (target == 0) + if (target == 0 || GET_MODE (target) != compute_mode) target = gen_reg_rtx (compute_mode); if (rem_flag) @@ -3315,7 +3315,7 @@ expand_divmod (rem_flag, code, mode, op0, op1, target, unsignedp) quotient or remainder to get ceiling rounding, once we have the remainder. Notice that we compute also the final remainder value here, and return the result right away. */ - if (target == 0) + if (target == 0 || GET_MODE (target) != compute_mode) target = gen_reg_rtx (compute_mode); if (rem_flag) @@ -3417,7 +3417,7 @@ expand_divmod (rem_flag, code, mode, op0, op1, target, unsignedp) quotient or remainder to get ceiling rounding, once we have the remainder. Notice that we compute also the final remainder value here, and return the result right away. */ - if (target == 0) + if (target == 0 || GET_MODE (target) != compute_mode) target = gen_reg_rtx (compute_mode); if (rem_flag) { @@ -3601,6 +3601,9 @@ expand_divmod (rem_flag, code, mode, op0, op1, target, unsignedp) if (quotient == 0) { + if (target && GET_MODE (target) != compute_mode) + target = 0; + if (rem_flag) { /* Try to produce the remainder directly without a library call. */ @@ -3652,6 +3655,9 @@ expand_divmod (rem_flag, code, mode, op0, op1, target, unsignedp) if (rem_flag) { + if (target && GET_MODE (target) != compute_mode) + target = 0; + if (quotient == 0) /* No divide instruction either. Use library for remainder. */ remainder = sign_expand_binop (compute_mode, umod_optab, smod_optab, |