loop.c:basic_induction_var does not accept ZERO_EXTEND
David Edelsohn
dje@watson.ibm.com
Mon May 22 11:30:00 GMT 2000
While investigating loop optimizations on 64-bit PowerPC on a
32-bit host, I noticed that no biv was being found for a simple loop. I
tracked this down to loop.c:basic_induction_var() not having a case for
ZERO_EXTEND. The comment at the beginning of the function mentions
detecting BIVs in a promoted variable which is sign-extended or
zero-extended, but the switch statement only has a case for SIGN_EXTEND,
not ZERO_EXTEND.
Naively, I would expect ZERO_EXTEND should be treated identically
to SIGN_EXTEND. Was there a technical reason to exclude zero-extended
values or an oversight? Is there some subtle corner-case problem with
zero-extended values as induction variables? If there is a reason, the
comment at the top of the function should be clarified.
Thanks, David
Index: loop.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/loop.c,v
retrieving revision 1.248
diff -c -p -r1.248 loop.c
*** loop.c 2000/05/19 03:44:58 1.248
--- loop.c 2000/05/22 18:26:35
*************** basic_induction_var (loop, x, mode, dest
*** 6071,6076 ****
--- 6071,6077 ----
return 0;
case SIGN_EXTEND:
+ case ZERO_EXTEND:
return basic_induction_var (loop, XEXP (x, 0), GET_MODE (XEXP (x, 0)),
dest_reg, p, inc_val, mult_val, location,
multi_insn_incr);
More information about the Gcc-patches
mailing list