[backport from gcc-4.8/trunk r188359 ]
Date: Sat, 09 Jun 2012 08:47:03 -0400
From: Kenneth Zadeck
Subject: obvious fix to simplify-rtx.c
List-Archive:
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
gcc/
2012-06-09 Kenneth Zadeck
* simplify-rtx.c (simplify_const_binary_operation): Fixed shift
count trucation.
--- gcc-4.7.0/gcc/simplify-rtx.c.~1~ 2012-02-08 14:29:22.000000000 +0100
+++ gcc-4.7.0/gcc/simplify-rtx.c 2012-06-09 20:31:20.000000000 +0200
@@ -3634,7 +3634,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))