This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

obvious fix to simplify-rtx.c


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 <zadeck@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))


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]