Simplify mult-to-shift conversion code.
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 10 Nov 2013 10:13:20 +0000 (10:13 +0000)
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 10 Nov 2013 10:13:20 +0000 (10:13 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/wide-int@204629 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/expmed.c
gcc/simplify-rtx.c

index c3d773e..089a0b5 100644 (file)
@@ -3075,30 +3075,11 @@ expand_mult (enum machine_mode mode, rtx op0, rtx op1, rtx target,
       else if (CONST_DOUBLE_AS_INT_P (scalar_op1))
 #endif
        {
-         int p = GET_MODE_PRECISION (mode);
          int shift = wi::exact_log2 (std::make_pair (scalar_op1, mode));
-         /* Perfect power of 2.  */
-         is_neg = false;
+         /* Perfect power of 2 (other than 1, which is handled above).  */
          if (shift > 0)
-           {
-             /* Do the shift count trucation against the bitsize, not
-                the precision.  See the comment above
-                wide-int.c:trunc_shift for details.  */
-             if (SHIFT_COUNT_TRUNCATED)
-               shift &= GET_MODE_BITSIZE (mode) - 1;
-             /* We could consider adding just a move of 0 to target
-                if the shift >= p  */
-             if (shift < p)
-               return expand_shift (LSHIFT_EXPR, mode, op0, 
-                                    shift, target, unsignedp);
-             /* Any positive number that fits in a word.  */
-             coeff = CONST_WIDE_INT_ELT (scalar_op1, 0);
-           }
-         else if (wi::sign_mask (std::make_pair (scalar_op1, mode)) == 0)
-           {
-             /* Any positive number that fits in a word.  */
-             coeff = CONST_WIDE_INT_ELT (scalar_op1, 0);
-           }
+           return expand_shift (LSHIFT_EXPR, mode, op0,
+                                shift, target, unsignedp);
          else
            goto skip_synth;
        }
index fb1a27e..c19d709 100644 (file)
@@ -2399,7 +2399,7 @@ simplify_binary_operation_1 (enum rtx_code code, enum machine_mode mode,
       if (CONST_SCALAR_INT_P (trueop1))
        {
          val = wi::exact_log2 (std::make_pair (trueop1, mode));
-         if (val >= 0 && val < GET_MODE_BITSIZE (mode))
+         if (val >= 0)
            return simplify_gen_binary (ASHIFT, mode, op0, GEN_INT (val));
        }