Re: Compiler Loop Unswitching




"Walter Banks" <walter@xxxxxxxxxxxxx> wrote in message
news:47C82E25.FA5CF120@xxxxxxxxxxxxxxxx


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:

I guess you want yy: just before the if stmt? And (i>=j)?

What do you think of code like the following?

i=0;
goto ww;
yy:
dosomething()
i++;
ww:
if (i<j) goto yy;

--
Bart


.



Relevant Pages

  • Re: Compiler Loop Unswitching
    ... compare is known at compile time. ... It halves the pipe line flushes ... Could you explain what you mean with "first compare"? ... if goto zz ...
    (comp.programming)
  • Re: Compiler Loop Unswitching
    ... on application code is moving the test to the bottom when the first ... compare is known at compile time. ... Could you explain what you mean with "first compare"? ... if goto zz ...
    (comp.programming)
  • Re: Process one line of output only?...
    ... errorlevel I compare the output of fc to see if I get the message they ... I tried putting a goto in the unmatch condition but this is making the ... REM jumpout as it is enough for me to know the files don't match ...
    (microsoft.public.win2000.cmdprompt.admin)
  • Re: Process one line of output only?...
    ... errorlevel I compare the output of fc to see if I get the message they ... I tried putting a goto in the unmatch condition but this is making the ... REM jumpout as it is enough for me to know the files don't match ... On my computer fc does in fact return errorlevel .. ...
    (microsoft.public.win2000.cmdprompt.admin)
  • Re: Invalid Use of Null
    ... > table I need to compare the above record to the below record for ... > have no control over and can't change. ... > GoTo 800 ... control-of-flow constructs such as Do loops, For loops, If...Then and ...
    (microsoft.public.access.modulesdaovba)