linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* arch/powerpc/*/div64.S
@ 2010-10-02 18:16 Albert Cahalan
  2010-11-18  3:37 ` arch/powerpc/*/div64.S Benjamin Herrenschmidt
  0 siblings, 1 reply; 2+ messages in thread
From: Albert Cahalan @ 2010-10-02 18:16 UTC (permalink / raw)
  To: linuxppc-dev

This looks like duplicated code getting out of sync.

$ 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: arch/powerpc/*/div64.S
  2010-10-02 18:16 arch/powerpc/*/div64.S Albert Cahalan
@ 2010-11-18  3:37 ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 2+ messages in thread
From: Benjamin Herrenschmidt @ 2010-11-18  3:37 UTC (permalink / raw)
  To: Albert Cahalan; +Cc: linuxppc-dev

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
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-11-18  3:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-02 18:16 arch/powerpc/*/div64.S Albert Cahalan
2010-11-18  3:37 ` arch/powerpc/*/div64.S Benjamin Herrenschmidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).