how to generate code-loops
David Livshin
david.livshin@dalsoft.com
Sat Sep 30 20:04:00 GMT 2006
Artūras Moskvinas wrote:
>>> a) It looks like a loop to me.
>>>
>> No it is not a loop, at least not a loop I would like to have. Perhaps I
>> had to mention this in my message, but the boy of the "loop" should be a
>> basic block ( no jump to/from it ) - the code generated is not a such.
>>
> for loop before doing any instructions must check conditions and then
> perform statements inside it. So your code is not right (there is no
> check for conditions before starting the loop)(though sometimes it is
> correct).
>
>
The code in my posting is only small portion of the code generated; just
to illustrate the problem.
> Label:
> <code>
> conditional jump to 'Label'
>
> You might consider using:
> do
> {
> code
> } while (condition not satisfied)
>
>
>
>>> b) You instructed the compiler to unroll all loops, which is
>>> apparently what it did.
>>>
>> Maybe I'm confused about what you are asking?
>>
>
> You forced gcc compiler to unroll all loops in your code even if it
> makes performance lower. "-funroll-all-loops"
> >From gcc manual:
> "-funroll-all-loops" Unroll all loops, even if their number of
> iterations is uncertain when the loop is entered. This usually makes
> programs run more slowly.
> http://gcc.gnu.org/onlinedocs/gcc-4.1.1/gcc/Optimize-Options.html#Optimize-Options
>
> Try switching that setting of.
>
> Arturas M
>
I would like to have unrolled "real loop".
--
David Livshin
david.livshin@dalsoft.com
http://www.dalsoft.com
More information about the Gcc-help
mailing list