Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Assembly Language > How many branch...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 5 Topic 5002 of 5072
Post > Topic >>

How many branches in a loop can be predicted successfully ?

by "Skybuck Flying" <BloodyShame@[EMAIL PROTECTED] > May 6, 2008 at 06:35 PM

Hello,

Suppose I have code like so:

Condition1 := True or False; // determined here
Condition2 := True or False; // determined here
Condition3 := True or False; // determined here

for Y := 0 to Height-1 do
begin
    for X := 0 to Width-1 do
    begin

        // ... inner loop ...

        if Condition1 then
        begin
            ... condition 1 code ...
        end;

        if Condition2 then
        begin
            ... condition 2 code ...
        end;

        if Condition3 then
        begin
            ... condition 3 code ...
        end;

        // ... inner loop ...

    end;
end;

The question is:

How many of these "condition branches" can be added to the inner loop 
without getting miss-prediction on for example an AMD X2 3800+ ?

The asm looks something like:

// Condition 1
026B08AA 803C2400         cmp byte ptr [esp],$00
026B08AE 0F8496000000     jz $026b094a

// Condition 1 Code

026B08B4 8B481C           mov ecx,[eax+$1c]
....
....
....
....

// Condition 2

I have a further question:

In the manual it says the processor assumes fall throughs ?

So does this mean the processor assumes the "condition x code" is always 
taken ?

In other words, the processor does not assume a jump occurs ?

Hmm this seems to be contrary to the loop idea.

Loops jump back, I read the jumps are always followed/assumed taken by the

processor ?

I am confused...

Bye,
  Skybuck.
 




 5 Posts in Topic:
How many branches in a loop can be predicted successfully ?
"Skybuck Flying"  2008-05-06 18:35:02 
Re: How many branches in a loop can be predicted successfully ?
"Skybuck Flying"  2008-05-06 21:10:35 
Re: How many branches in a loop can be predicted successfully ?
MitchAlsup <MitchAlsup  2008-05-06 15:17:23 
Re: How many branches in a loop can be predicted successfully ?
"Skybuck Flying"  2008-05-07 01:36:06 
Re: How many branches in a loop can be predicted successfully ?
hutch-- <hutch@[EMAIL   2008-05-06 19:55:32 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sun Jul 6 16:18:56 CDT 2008.