From: Ingo Molnar
...
> As Linus noticed, data lookup tables are the intelligent solution: if you 
> manage
> to offload the logic into arithmetics and not affect the control flow then 
> that's
> a big win. The inherent branching will be hidden by executing on massively
> parallel arithmetics units which effectively execute everything fed to them 
> in a
> single cycle.

Not necessarily, in real-life they are likely to be a cache miss.

With the parallel execution units you just need to worry about the
register dependency chains.
In this case the 'adc' have dependencies on both the result register
and the flags register.

The best loop might even be:
10:     adc     %rax,0(%rdi,%rcx)
        lea     %rcx,8(%rcx)
        jcxz    20f
        jmp     10b
20:

You then need to insert just enough copies of the adc so they take as long
as the other instructions.

        David

Reply via email to