------- Comment #26 from rguenther at suse dot de 2009-12-01 09:42 -------
Subject: Re: Weird translation of DO loops
On Mon, 30 Nov 2009, tkoenig at gcc dot gnu dot org wrote:
>
>
> ------- Comment #22 from tkoenig at gcc dot gnu dot org 2009-11-30 19:15
> -------
> (In reply to comment #21)
>
> > the "sign" for unsigned steps is always 1, you don't seem to account
> > for unsignedness?
>
> (Un)fortunately, there are no unsigned varaibles in Fortran.
>
> > Note that I believe generating
> >
> > step_sign = fold_build3 (fold_build2 (LT_EXPR, boolean_type_node,
> > step, build_int_cst (TREE_TYPE (step),
> > 0)),
> > build_int_cst (type, -1), build_int_cst (type, 1));
> >
> > is better as that allows more freedom for fold and efficient expansion
> > for the target. Just double-check that it also works for the
> > unrolling ;)
>
> That doesn't work (something about fold_build3 needing five arguments
> instead of three), so think I'll submit my patch "as is".
Ah, of course ... more like
step_sign = fold_build3 (COND_EXPR, type,
fold_build2 (LT_EXPR, boolean_type_node,
step, build_int_cst (TREE_TYPE (step), 0)),
build_int_cst (type, -1), build_int_cst (type, 1));
Which still would be prefered IMHO.
Richard.
> Thanks for your comments!
> > Thanks,
> > Richard.
> >
>
>
>
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42131