Commit a45cf58c by Richard Kenner

(expand_divmod): Don't use TARGET if it's the wrong mode.

From-SVN: r10708
parent 8092a8e8
...@@ -3188,7 +3188,7 @@ expand_divmod (rem_flag, code, mode, op0, op1, target, unsignedp) ...@@ -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. or remainder to get floor rounding, once we have the remainder.
Notice that we compute also the final remainder value here, Notice that we compute also the final remainder value here,
and return the result right away. */ and return the result right away. */
if (target == 0) if (target == 0 || GET_MODE (target) != compute_mode)
target = gen_reg_rtx (compute_mode); target = gen_reg_rtx (compute_mode);
if (rem_flag) if (rem_flag)
...@@ -3315,7 +3315,7 @@ expand_divmod (rem_flag, code, mode, op0, op1, target, unsignedp) ...@@ -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 quotient or remainder to get ceiling rounding, once we have the
remainder. Notice that we compute also the final remainder remainder. Notice that we compute also the final remainder
value here, and return the result right away. */ 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); target = gen_reg_rtx (compute_mode);
if (rem_flag) if (rem_flag)
...@@ -3417,7 +3417,7 @@ expand_divmod (rem_flag, code, mode, op0, op1, target, unsignedp) ...@@ -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 quotient or remainder to get ceiling rounding, once we have the
remainder. Notice that we compute also the final remainder remainder. Notice that we compute also the final remainder
value here, and return the result right away. */ 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); target = gen_reg_rtx (compute_mode);
if (rem_flag) if (rem_flag)
{ {
...@@ -3601,6 +3601,9 @@ expand_divmod (rem_flag, code, mode, op0, op1, target, unsignedp) ...@@ -3601,6 +3601,9 @@ expand_divmod (rem_flag, code, mode, op0, op1, target, unsignedp)
if (quotient == 0) if (quotient == 0)
{ {
if (target && GET_MODE (target) != compute_mode)
target = 0;
if (rem_flag) if (rem_flag)
{ {
/* Try to produce the remainder directly without a library call. */ /* Try to produce the remainder directly without a library call. */
...@@ -3652,6 +3655,9 @@ expand_divmod (rem_flag, code, mode, op0, op1, target, unsignedp) ...@@ -3652,6 +3655,9 @@ expand_divmod (rem_flag, code, mode, op0, op1, target, unsignedp)
if (rem_flag) if (rem_flag)
{ {
if (target && GET_MODE (target) != compute_mode)
target = 0;
if (quotient == 0) if (quotient == 0)
/* No divide instruction either. Use library for remainder. */ /* No divide instruction either. Use library for remainder. */
remainder = sign_expand_binop (compute_mode, umod_optab, smod_optab, remainder = sign_expand_binop (compute_mode, umod_optab, smod_optab,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment