The shift count was being truncated by the wrong amount. It is now zero extended from log2 of the mode size rather than the mode size. This is a (mostly) obvious fix - iant needed a hint to see what was wrong. The location of this code meant that this would be a very rare bug: only ti mode shifts on an llp64 platform.

bootstrapped and regression tested on x86-64.

committed as revision 188359.

Kenny



2012-06-09  Kenneth Zadeck <zad...@naturalbridge.com>

    * simplify-rtx.c (simplify_const_binary_operation): Fixed shift
    count trucation.

Index: gcc/simplify-rtx.c
===================================================================
--- gcc/simplify-rtx.c    (revision 188350)
+++ gcc/simplify-rtx.c    (working copy)
@@ -3653,7 +3653,10 @@ simplify_const_binary_operation (enum rt
         unsigned HOST_WIDE_INT cnt;

         if (SHIFT_COUNT_TRUNCATED)
-          o1 = double_int_zext (o1, GET_MODE_PRECISION (mode));
+          {
+        o1.high = 0;
+        o1.low &= GET_MODE_PRECISION (mode) - 1;
+          }

         if (!double_int_fits_in_uhwi_p (o1)
             || double_int_to_uhwi (o1) >= GET_MODE_PRECISION (mode))

Reply via email to