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.