Re: PATCH: Fix ll/sc for mips (take 3)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Feb 04, 2002 at 09:46:45AM +0000, Dominic Sweetman wrote:
> 
> cgd@broadcom.com (cgd@broadcom.com) writes:
> 
> > Branch-likely instructions probably _do_ buy you something (at
> > least, slightly less code size) on some CPUs, probably even some
> > CPUs which are still being produced.
> 
> Here's how branch likely is used to improve performance in a simple
> MIPS CPU, and why it has no effect on code size.
> 
> You start off with this:
> 
>   loopstart: insn 1
>              insn 2
>              ....
> 	     insn last
> 	     branch to loopstart
>              nop
> 
> In small loops, the last instruction in the loop might well calculate
> the branch condition, so it can't be moved into the delay slot of the
> loop-closing branch.  That puts a no-op into every loop iteration.
> With branch-likely, you can transform the loop to 
>             
>   loopstart: insn 1
>   loop2:     insn 2
>              ....
> 	     insn last
> 	     branch-likely loop2
> 	     insn 1 (copy)
> 
> The nop is replaced by a duplicate instruction from the top
> of the loop.  Good for performance, no effect on code size.
> 
> Builders of clever modern CPUs full of branch prediction hardware,
> multiple instruction issue and instruction re-ordering find the
> coupling of the branch-likely to the following instruction makes their
> CPUs more complicated.  That's why MIPS have warned that the
> instructions will be removed from some future version of the MIPS
> instruction set.

I can change glibc not to use branch-likely without using nop. But it
may require one or two instructions outside of the loop. Should I do
it given what we know now?


H.J.


[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux