Re: Compiler Loop Unswitching
- From: Walter Banks <walter@xxxxxxxxxxxxx>
- Date: Fri, 29 Feb 2008 11:09:09 -0500
Tim Frink wrote:
Based on our metrics the single most important loop optimization
on application code is moving the test to the bottom when the first
compare is known at compile time. It halves the pipe line flushes
and is almost trivial to implement.
Could you explain what you mean with "first compare"? Maybe you could
provide a small code example?
for (i = 0; i < j; i++)
dosomething();
would generated something like
if (i<j) goto zz
yy:
dosomething();
i++;
goto yy:
zz:
for (i = 0; i < 29 ; i++)
dosomething();
if the compare were known at compile time
ie it is a constant in this case
do something will always be executed so the generated code can be
i = 0;
ll:
dosomething();
i++;
if (i < 29) goto ll
This will eliminate the goto yy and move the if ( ) to the end of the loop
Regards,
--
Walter Banks
Byte Craft Limited
Tel. (519) 888-6911
http://www.bytecraft.com
walter@xxxxxxxxxxxxx
.
- Follow-Ups:
- Re: Compiler Loop Unswitching
- From: Bartc
- Re: Compiler Loop Unswitching
- References:
- Compiler Loop Unswitching
- From: Tim Frink
- Re: Compiler Loop Unswitching
- From: Walter Banks
- Re: Compiler Loop Unswitching
- From: Tim Frink
- Compiler Loop Unswitching
- Prev by Date: Re: data specs
- Next by Date: Re: data specs
- Previous by thread: Re: Compiler Loop Unswitching
- Next by thread: Re: Compiler Loop Unswitching
- Index(es):
Relevant Pages
|