Subject: Re: arch/powerpc/*/div64.S

From: Benjamin Herrenschmidt <[email-masked]>
Date: Thu, 18 Nov 2010 14:37:14 +1100

On Sat, 2010-10-02 at 14:16 -0400, Albert Cahalan wrote:
> This looks like duplicated code getting out of sync.

Right, tho your patch actually reverts the fix :-)

I don't know if it's worth considering using common files for some /lib
stuff there tho.. .the runtime env. is quite different...

Ben.

> $ diff -Naurd arch/powerpc/lib/div64.S arch/powerpc/boot/div64.S
> --- arch/powerpc/lib/div64.S    2009-09-09 18:13:59.000000000 -0400
> +++ arch/powerpc/boot/div64.S   2009-09-09 18:13:59.000000000 -0400
> @@ -13,10 +13,10 @@
>   * as published by the Free Software Foundation; either version
>   * 2 of the License, or (at your option) any later version.
>   */
> -#include <asm/ppc_asm.h>
> -#include <asm/processor.h>
> +#include "ppc_asm.h"
> 
> -_GLOBAL(__div64_32)
> +       .globl __div64_32
> +__div64_32:
>         lwz     r5,0(r3)        # get the dividend into r5/r6
>         lwz     r6,4(r3)
>         cmplw   r5,r4
> @@ -33,10 +33,9 @@
>         cntlzw  r0,r5           # we are shifting the dividend right
>         li      r10,-1          # to make it < 2^32, and shifting
>         srw     r10,r10,r0      # the divisor right the same amount,
> -       addc    r9,r4,r10       # rounding up (so the estimate cannot
> +       add     r9,r4,r10       # rounding up (so the estimate cannot
>         andc    r11,r6,r10      # ever be too large, only too small)
>         andc    r9,r9,r10
> -       addze   r9,r9
>         or      r11,r5,r11
>         rotlw   r9,r9,r0
>         rotlw   r11,r11,r0
> _______________________________________________
> Linuxppc-dev mailing list
> [email-masked]
> https://lists.ozlabs.org/listinfo/linuxppc-dev