On Tue, Nov 20, 2018 at 09:45:33AM +1030, Joel Stanley wrote: > On Tue, 20 Nov 2018 at 05:24, Nick Desaulniers <ndesaulni...@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 .
Perhaps it is to make it more likely only a single divide machine instruction results. Maybe for -O0, maybe for older GCC, maybe for GCC targets that do not get this right. It of course means exactly the same. > 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? You should probably get your updates from the same place as was used to get the file in the first place. Or, don't worry so much about it, how often is this updated? Once in ten years, or twenty? If you do not want to include bigger (maybe irrelevant) changes from upstream, you have already forked, effectively. Segher