[patch, fortran] Fix PR 42131, improvement in do loops

Thomas Koenig tkoenig@netcologne.de
Mon Nov 30 23:06:00 GMT 2009


Hi Daniel,

> How does this calculate the sign of step?  To me this looks like:
> 
> 1) Shift step right so that afterwards only the highest bit (which 
> contains its sign) is present any longer; thus step will be 0 or 1.

The value will be 0 or -1 (signed shift).

> 2) Multiply it by two, gives 0 or 2.  (Why no left-shift?)

Gives 0 or -2.

Multiply by two or left-shift should not matter, it's the same
number of operations either way.  I also could have shifted by one bit
less and masked off the last bit.

> 3) Add 1, gives 1 or 3 (?).

... and this gives 1 or -1.

Thanks for the review!  Jerry also reviewed it in the PR.

Sending        fortran/ChangeLog
Sending        fortran/trans-stmt.c
Transmitting file data ..
Committed revision 154839.

I will be interesting to see if this makes any difference in the
polyhedron benchmarks...

	Thomas



More information about the Fortran mailing list