[1/4] RFC: SLB rewrite (core rewrite)

Anton Blanchard anton at samba.org
Sun Jul 11 10:27:46 EST 2004



> This branch probably shouldn't be predicted.  The general rule on branch
> prediction is for an error case, or a missed lock.  Since about power 4,
> the branch prediction is a little over 99% correct, you'll get a miss 1
> out of 62 times or 1.6% of the time.  It's probably not measurable, just
> might save a few cycles.

Milton and I looked over this a while ago. Neither of the two POWER4
branch prediction algorithms will do a good job. We are likely to get 2
mispredictions per loop whereas we only get one misprediction per loop
with static prediction.

As David pointed out we have removed the slbmfee loop completely in
subsequent patches. We could probably remove the first loop by keeping
the bolted entries to a power of 2 and using a rotate and mask insert
instruction to shift the 2 ^ 6 bit down:

	addi	r3,r3,1
	li	r4,0
	rlwimi	r4,r3,32-(6-2),31-2,31-2
	andi.	r3,r3,0x3f
	or	r3,r3,r4

That looks like 3 cycles but Im sure we can do it in less. However even
if we manage to do it in 2 cycles, thats going to add 2 * 60 = 120
cycles in one complete loop whereas a single misprediction per loop
should take somewhere around 20 cycles I think.

Anton

** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/





More information about the Linuxppc64-dev mailing list