OSDN Git Service

2004-05-13 Benjamin Kosnik <bkoz@redhat.com>
[pf3gnuchains/gcc-fork.git] / gcc / expmed.c
index 5d213c3..a8cd617 100644 (file)
@@ -1718,9 +1718,7 @@ extract_fixed_bit_field (enum machine_mode tmode, rtx op0,
          tree amount = build_int_2 (bitpos, 0);
          /* Maybe propagate the target for the shift.  */
          /* But not if we will return it--could confuse integrate.c.  */
-         rtx subtarget = (target != 0 && GET_CODE (target) == REG
-                          && !REG_FUNCTION_VALUE_P (target)
-                          ? target : 0);
+         rtx subtarget = (target != 0 && GET_CODE (target) == REG ? target : 0);
          if (tmode != mode) subtarget = 0;
          op0 = expand_shift (RSHIFT_EXPR, mode, op0, amount, subtarget, 1);
        }
@@ -1759,10 +1757,7 @@ extract_fixed_bit_field (enum machine_mode tmode, rtx op0,
       tree amount
        = build_int_2 (GET_MODE_BITSIZE (mode) - (bitsize + bitpos), 0);
       /* Maybe propagate the target for the shift.  */
-      /* But not if we will return the result--could confuse integrate.c.  */
-      rtx subtarget = (target != 0 && GET_CODE (target) == REG
-                      && ! REG_FUNCTION_VALUE_P (target)
-                      ? target : 0);
+      rtx subtarget = (target != 0 && GET_CODE (target) == REG ? target : 0);
       op0 = expand_shift (LSHIFT_EXPR, mode, op0, amount, subtarget, 1);
     }
 
@@ -2882,6 +2877,7 @@ static rtx
 expand_mult_highpart_optab (enum machine_mode mode, rtx op0, rtx op1,
                            rtx target, int unsignedp, int max_cost)
 {
+  rtx narrow_op1 = gen_int_mode (INTVAL (op1), mode);
   enum machine_mode wider_mode;
   optab moptab;
   rtx tem;
@@ -2895,7 +2891,7 @@ expand_mult_highpart_optab (enum machine_mode mode, rtx op0, rtx op1,
   if (mul_highpart_cost[(int) mode] < max_cost)
     {
       moptab = unsignedp ? umul_highpart_optab : smul_highpart_optab;
-      tem = expand_binop (mode, moptab, op0, op1, target,
+      tem = expand_binop (mode, moptab, op0, narrow_op1, target,
                          unsignedp, OPTAB_DIRECT);
       if (tem)
        return tem;
@@ -2908,11 +2904,11 @@ expand_mult_highpart_optab (enum machine_mode mode, rtx op0, rtx op1,
          < max_cost))
     {
       moptab = unsignedp ? smul_highpart_optab : umul_highpart_optab;
-      tem = expand_binop (mode, moptab, op0, op1, target,
+      tem = expand_binop (mode, moptab, op0, narrow_op1, target,
                          unsignedp, OPTAB_DIRECT);
       if (tem)
        /* We used the wrong signedness.  Adjust the result.  */
-       return expand_mult_highpart_adjust (mode, tem, op0, op1,
+       return expand_mult_highpart_adjust (mode, tem, op0, narrow_op1,
                                            tem, unsignedp);
     }
 
@@ -2921,7 +2917,7 @@ expand_mult_highpart_optab (enum machine_mode mode, rtx op0, rtx op1,
   if (moptab->handlers[(int) wider_mode].insn_code != CODE_FOR_nothing
       && mul_widen_cost[(int) wider_mode] < max_cost)
     {
-      tem = expand_binop (wider_mode, moptab, op0, op1, 0,
+      tem = expand_binop (wider_mode, moptab, op0, narrow_op1, 0,
                          unsignedp, OPTAB_WIDEN);
       if (tem)
        return extract_high_half (mode, tem);
@@ -2946,14 +2942,13 @@ expand_mult_highpart_optab (enum machine_mode mode, rtx op0, rtx op1,
       && (mul_widen_cost[(int) wider_mode]
          + 2 * shift_cost[size-1] + 4 * add_cost < max_cost))
     {
-      rtx regop1 = force_reg (mode, op1);
-      tem = expand_binop (wider_mode, moptab, op0, regop1,
+      tem = expand_binop (wider_mode, moptab, op0, narrow_op1,
                          NULL_RTX, ! unsignedp, OPTAB_WIDEN);
       if (tem != 0)
        {
          tem = extract_high_half (mode, tem);
          /* We used the wrong signedness.  Adjust the result.  */
-         return expand_mult_highpart_adjust (mode, tem, op0, op1,
+         return expand_mult_highpart_adjust (mode, tem, op0, narrow_op1,
                                              target, unsignedp);
        }
     }
@@ -2987,7 +2982,7 @@ expand_mult_highpart (enum machine_mode mode, rtx op0,
   if (GET_MODE_BITSIZE (mode) > HOST_BITS_PER_WIDE_INT)
     abort ();
 
-  op1 = gen_int_mode (cnst1, mode);
+  op1 = gen_int_mode (cnst1, wider_mode);
   cnst1 &= GET_MODE_MASK (mode);
 
   /* We can't optimize modes wider than BITS_PER_WORD.