diff options
author | sayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-06-24 16:50:35 +0000 |
---|---|---|
committer | sayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-06-24 16:50:35 +0000 |
commit | 567c3006dc52706d968cb9973ed5559ed000b7bd (patch) | |
tree | 22302d5c99a616cc8c7a17165f37236497372afb /gcc/loop-iv.c | |
parent | c6b8c9732c5f59355a8d2e6f70b06a35a6f5ce2e (diff) | |
download | gcc-567c3006dc52706d968cb9973ed5559ed000b7bd.tar.gz |
2004-06-24 Revital Eres <eres@il.ibm.com>
* loop-iv.c (iv_analyze, simple_set_p): Support for identifying
shifts of induction variable.
(iv_shift): New function.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@83599 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/loop-iv.c')
-rw-r--r-- | gcc/loop-iv.c | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/gcc/loop-iv.c b/gcc/loop-iv.c index 0093743c105..e739a852bce 100644 --- a/gcc/loop-iv.c +++ b/gcc/loop-iv.c @@ -222,6 +222,7 @@ simple_set_p (rtx lhs, rtx rhs) case PLUS: case MINUS: case MULT: + case ASHIFT: op0 = XEXP (rhs, 0); op1 = XEXP (rhs, 1); @@ -238,6 +239,10 @@ simple_set_p (rtx lhs, rtx rhs) && !CONSTANT_P (op1)) return false; + if (GET_CODE (rhs) == ASHIFT + && CONSTANT_P (op0)) + return false; + return true; default: @@ -589,6 +594,31 @@ iv_mult (struct rtx_iv *iv, rtx mby) return true; } +/* Evaluates shift of IV by constant CST. */ + +static bool +iv_shift (struct rtx_iv *iv, rtx mby) +{ + enum machine_mode mode = iv->extend_mode; + + if (GET_MODE (mby) != VOIDmode + && GET_MODE (mby) != mode) + return false; + + if (iv->extend == NIL) + { + iv->base = simplify_gen_binary (ASHIFT, mode, iv->base, mby); + iv->step = simplify_gen_binary (ASHIFT, mode, iv->step, mby); + } + else + { + iv->delta = simplify_gen_binary (ASHIFT, mode, iv->delta, mby); + iv->mult = simplify_gen_binary (ASHIFT, mode, iv->mult, mby); + } + + return true; +} + /* The recursive part of get_biv_step. Gets the value of the single value defined in INSN wrto initial value of REG inside loop, in shape described at get_biv_step. */ @@ -1032,7 +1062,14 @@ iv_analyze (rtx insn, rtx def, struct rtx_iv *iv) mby = tmp; } break; - + + case ASHIFT: + if (CONSTANT_P (XEXP (rhs, 0))) + abort (); + op0 = XEXP (rhs, 0); + mby = XEXP (rhs, 1); + break; + default: abort (); } @@ -1088,6 +1125,11 @@ iv_analyze (rtx insn, rtx def, struct rtx_iv *iv) goto end; break; + case ASHIFT: + if (!iv_shift (&iv0, mby)) + goto end; + break; + default: break; } |