This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: how to generate code-loops
>> 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).
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.