[U-Boot] [PATCH] mpc83xx: remove some dead code, saving space

Joakim Tjernlund joakim.tjernlund at transmode.se
Tue Nov 30 21:45:19 CET 2010


>
> Dear Joakim Tjernlund,
>
> In message <1290537223-12160-1-git-send-email-Joakim.Tjernlund at transmode.se> you wrote:
> >
> > Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund at transmode.se>
> > ---
> >  arch/powerpc/cpu/mpc83xx/start.S |    7 -------
> >  1 files changed, 0 insertions(+), 7 deletions(-)
> >
> > diff --git a/arch/powerpc/cpu/mpc83xx/start.S b/arch/powerpc/cpu/mpc83xx/start.S
> > index f7da14b..121c276 100644
> > --- a/arch/powerpc/cpu/mpc83xx/start.S
> > +++ b/arch/powerpc/cpu/mpc83xx/start.S
> > @@ -967,13 +967,6 @@ relocate_code:
> >  30:   li r3, 0
> >     blr
> >
> > -2:   slwi   r0,r0,2 /* re copy in reverse order ... y do we needed it? */
> > -   add   r8,r4,r0
> > -   add   r7,r3,r0
> > -3:   lwzu   r0,-4(r8)
> > -   stwu   r0,-4(r7)
> > -   bdnz   3b
> > -
>
> Why do you think this is dead code?
>
> I see this about 30 lines above:
>
>  ...
>  851         cmplw   cr1,r3,r4
>  852         addi    r0,r5,3
>  853         srwi.   r0,r0,2
>  854         beq     cr1,4f          /* In place copy is not necessary
> */
>  855         beq     7f              /* Protect against 0 count
> */
>  856         mtctr   r0
>  857         bge     cr1,2f
>  ...
>
> With your removal of the code, the "bge     cr1,2f" will jump right
> into the relocation loop.  I don't think this is intended?

Ah, sharp eyes! Didn't notice that branch. I do think that
bge could be removed as well. It will only matter if the src and dst overlap
and the distance between them is < 4 bytes.
Anyhow, we don't need to remove this code now.

On a related note, I am not sure why the I and D cache needs to be flushed,
aren't they coherent?

 Jocke



More information about the U-Boot mailing list