http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55838
--- Comment #10 from H.J. Lu <hjl.tools at gmail dot com> 2013-01-01 23:02:02 UTC --- This patch avoids using (const_int 129 [0x81]) as step in QImode: diff --git a/gcc/loop-iv.c b/gcc/loop-iv.c index 50b7536..aafaae4 100644 --- a/gcc/loop-iv.c +++ b/gcc/loop-iv.c @@ -421,6 +421,8 @@ iv_constant (struct rtx_iv *iv, rtx cst, enum machine_mode mode) static bool iv_subreg (struct rtx_iv *iv, enum machine_mode mode) { + rtx step; + /* If iv is invariant, just calculate the new value. */ if (iv->step == const0_rtx && !iv->first_special) @@ -442,13 +444,17 @@ iv_subreg (struct rtx_iv *iv, enum machine_mode mode) if (GET_MODE_BITSIZE (mode) > GET_MODE_BITSIZE (iv->mode)) return false; + step = simplify_gen_binary (MULT, iv->extend_mode, iv->step, iv->mult); + if (trunc_int_for_mode (INTVAL (step), mode) != INTVAL (step)) + return false; + iv->extend = IV_UNKNOWN_EXTEND; iv->mode = mode; iv->base = simplify_gen_binary (PLUS, iv->extend_mode, iv->delta, simplify_gen_binary (MULT, iv->extend_mode, iv->base, iv->mult)); - iv->step = simplify_gen_binary (MULT, iv->extend_mode, iv->step, iv->mult); + iv->step = step; iv->mult = const1_rtx; iv->delta = const0_rtx; iv->first_special = false;