OSDN Git Service

(expand_divmod): Don't use TARGET if it's the wrong mode.
authorkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 13 Dec 1995 21:11:05 +0000 (21:11 +0000)
committerkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 13 Dec 1995 21:11:05 +0000 (21:11 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@10708 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/expmed.c

index cddfe3e..b89a5f8 100644 (file)
@@ -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,