Bug#724320: gmp: x32: sizeof(mp_limb_t)!=sizeof(void*) is not supported by GAP and PARI

Vincent Lefevre vincent at vinc17.net
Sat Sep 28 10:26:33 CEST 2013


On 2013-09-28 09:03:53 +0200, Marc Glisse wrote:
> On Fri, 27 Sep 2013, Steve M. Robbins wrote:
> 
> >For readers of gmp-discuss and Daniel Schepler: this concerns a bug
> >reported to Debian regarding GMP on the x32 architecture. In a
> >nutshell: x32 selects a limb size of 8, which means it is larger
> >than a pointer and some software (gap, pari) fail to build. The
> >question is whether it makes sense to change the limb size to 4 on
> >x32. I'd appreciate your thoughts.
> >
> >See full thread at http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=724320

There is/was a similar problem on PowerPC with the mode32 ABI
(except that this was worse as we got wrong results):
http://trac.macports.org/ticket/18780 but AFAIK, this wasn't
the default.

> the whole point of creating x32 was to benefit from the speed advantages of
> amd64 without having a pointer size of 64 bits. Those speed advantages
> include using more registers, but also using hardware 64 bit long long. The
> speed difference between 32 and 64 bits is very large (a factor >2 for
> multiplication IIRC, not even counting the fact that we have super-optimized
> asm for amd64 and may not be spending so much time tweaking the x86 asm for
> new platforms these days) so it doesn't make sense to me to penalize x32

I agree. PARI is not the only software that uses GMP.

> that way. The assumption that mp_limb_t and void* have the same size is the
> same kind of problem that we had when people assumed things about long and
> void*, and most of those got fixed with time (though I know it was very
> painful to do so in some cases).

Including PARI for long and void*? If no, I doubt that changing GMP
would solve the problem. If yes, can't a similar fix be done in PARI?

Otherwise couldn't PARI use its own version of GMP with a limb size
of 4 bytes?

-- 
Vincent Lefèvre <vincent at vinc17.net> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


More information about the gmp-discuss mailing list