aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.8/gcc/loop-iv.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.8/gcc/loop-iv.c')
-rw-r--r--gcc-4.8/gcc/loop-iv.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/gcc-4.8/gcc/loop-iv.c b/gcc-4.8/gcc/loop-iv.c
index be2e0f412..4c34007b4 100644
--- a/gcc-4.8/gcc/loop-iv.c
+++ b/gcc-4.8/gcc/loop-iv.c
@@ -425,7 +425,9 @@ iv_subreg (struct rtx_iv *iv, enum machine_mode mode)
&& !iv->first_special)
{
rtx val = get_iv_value (iv, const0_rtx);
- val = lowpart_subreg (mode, val, iv->extend_mode);
+ val = lowpart_subreg (mode, val,
+ iv->extend == IV_UNKNOWN_EXTEND
+ ? iv->mode : iv->extend_mode);
iv->base = val;
iv->extend = IV_UNKNOWN_EXTEND;
@@ -465,8 +467,14 @@ iv_extend (struct rtx_iv *iv, enum iv_extend_code extend, enum machine_mode mode
&& !iv->first_special)
{
rtx val = get_iv_value (iv, const0_rtx);
+ if (iv->extend_mode != iv->mode
+ && iv->extend != IV_UNKNOWN_EXTEND
+ && iv->extend != extend)
+ val = lowpart_subreg (iv->mode, val, iv->extend_mode);
val = simplify_gen_unary (iv_extend_to_rtx_code (extend), mode,
- val, iv->extend_mode);
+ val,
+ iv->extend == extend
+ ? iv->extend_mode : iv->mode);
iv->base = val;
iv->extend = IV_UNKNOWN_EXTEND;
iv->mode = iv->extend_mode = mode;