OSDN Git Service

* simplify-rtx.c (simplify_const_binary_operation): Use the
authorbernds <bernds@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 6 Jul 2011 13:36:16 +0000 (13:36 +0000)
committerbernds <bernds@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 6 Jul 2011 13:36:16 +0000 (13:36 +0000)
shift_truncation_mask hook instead of performing modulo by
width.  Compare against mode precision, not bitsize.
* combine.c (combine_simplify_rtx, simplify_shift_const_1):
Use shift_truncation_mask instead of constructing the value
manually.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@175913 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/combine.c
gcc/simplify-rtx.c

index ab16711..a853add 100644 (file)
@@ -1,3 +1,12 @@
+2011-07-06  Bernd Schmidt  <bernds@codesourcery.com>
+
+       * simplify-rtx.c (simplify_const_binary_operation): Use the
+       shift_truncation_mask hook instead of performing modulo by
+       width.  Compare against mode precision, not bitsize.
+       * combine.c (combine_simplify_rtx, simplify_shift_const_1):
+       Use shift_truncation_mask instead of constructing the value
+       manually.
+
 2011-07-06  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR middle-end/47383
index ba35f28..737f300 100644 (file)
@@ -5946,9 +5946,7 @@ combine_simplify_rtx (rtx x, enum machine_mode op0_mode, int in_dest,
       else if (SHIFT_COUNT_TRUNCATED && !REG_P (XEXP (x, 1)))
        SUBST (XEXP (x, 1),
               force_to_mode (XEXP (x, 1), GET_MODE (XEXP (x, 1)),
-                             ((unsigned HOST_WIDE_INT) 1
-                              << exact_log2 (GET_MODE_BITSIZE (GET_MODE (x))))
-                             - 1,
+                             targetm.shift_truncation_mask (GET_MODE (x)),
                              0));
       break;
 
@@ -9901,7 +9899,7 @@ simplify_shift_const_1 (enum rtx_code code, enum machine_mode result_mode,
      want to do this inside the loop as it makes it more difficult to
      combine shifts.  */
   if (SHIFT_COUNT_TRUNCATED)
-    orig_count &= GET_MODE_BITSIZE (mode) - 1;
+    orig_count &= targetm.shift_truncation_mask (mode);
 
   /* If we were given an invalid count, don't do anything except exactly
      what was requested.  */
index 5894f74..f7669b1 100644 (file)
@@ -3726,8 +3726,8 @@ simplify_const_binary_operation (enum rtx_code code, enum machine_mode mode,
             shift_truncation_mask, since the shift might not be part of an
             ashlM3, lshrM3 or ashrM3 instruction.  */
          if (SHIFT_COUNT_TRUNCATED)
-           arg1 = (unsigned HOST_WIDE_INT) arg1 % width;
-         else if (arg1 < 0 || arg1 >= GET_MODE_BITSIZE (mode))
+           arg1 &= targetm.shift_truncation_mask (mode);
+         else if (arg1 < 0 || arg1 >= GET_MODE_PRECISION (mode))
            return 0;
 
          val = (code == ASHIFT