[PATCH v2] powerpc/math-emu: Update macros from gmp-6.1.2

Joel Stanley joel at jms.id.au
Tue Nov 20 10:15:33 AEDT 2018


On Tue, 20 Nov 2018 at 05:24, Nick Desaulniers <ndesaulniers at google.com> wrote:
> >
> > The only functional change I noticed was this in udiv_qrnnd.
> >
> >     __r1 = (n1) % __d1;
> >     __q1 = (n1) / __d1;
> >
> > Becomes this:
> >
> >     __q1 = (n1) / __d1;
> >     __r1 = (n1) - __q1 * __d1;
> >
> > This is equivalent as it instead of calculating the remainder
> > using modulo, it uses the result of integer division to subtract the
> > count of 'whole' d1 from r1.
>
> I don't understand this; why was this functional change made?

I couldn't see why. It pre-dates GMP's mecurial history that  .
                                              \
> > -    (q) = (UWtype) __q1 * __ll_B | __q0;                               \
> > +    (q) = __q1 * __ll_B | __q0;                                                \
> >      (r) = __r0;                                                                \
> >    } while (0)
>
> This appears to now differ from the upstream source:
> https://github.com/gcc-mirror/gcc/blob/f7289f563a5e447ac21a5901ed75aad0dbd37732/include/longlong.h#L1679

AIUI the upstream source is GMP:

 https://gmplib.org/repo/gmp/file/tip/longlong.h

> If we're going to borrow implementations from GCC, let's borrow the
> same implementation. Otherwise it's hard to have confidence in this
> part of the patch.

I agree we should use the upstream source.

Segher, which tree contains the One True Upstream for longlong.h?

Cheers,

Joel


More information about the Linuxppc-dev mailing list