Adding support for R6 of MIPS architecture

Steve Ellcey sellcey at
Thu Feb 5 22:44:13 UTC 2015

On Tue, 2015-02-03 at 10:57 +0100, Torbjörn Granlund wrote:
> Marc Glisse <marc.glisse at> writes:
>   Apparently not, the motivation for the patch is that multu has
>   disappeared...
> Then I see no other robust approach than making mpn/mipsnomultu_64 (or
> somesuch).
> Well, an analogous robust approach would be moving the dmultu code into
> mpn/mips64/dmultu and put the r6 code into mpn/mips64/nodmultu.
> (As a side note, I have been planning to move things around a bit,
> creating mpn/x86/32 and mpn/x86/64 with the contents of mpn/x86 and
> mpn/x86_64, respectively.  SImilarly for powerpc32 and powerpc64,
> sparc32 and sparc64, etc.  Common code between 32-bit and 64-bit limbs
> will live in the shared directory (mpn/x86, mpn/powerpc, mpn/sparc,
> etc).  There is a good amount of such common code already, which is
> shared in an ugly manner.)

OK, so what I did was to create a mips32r6 directory under mips32 and a
mips64r6 directory under mips64 and put copies of the routines that had
to be changed for r6 in those directories.  I have done test builds for
various MIPS targets and verified that the non-r6 code has not changed.
For the new r6 stuff I have verified that it all builds but I haven't
tested the changes with 'make check'.

Is there a way to do 'make check' with a simulator or a remote system?
I usually build MIPS code using a cross compiler on an x86 Linux box and
that is what I did to build GMP (using --build=x86_64-unknown-linux-gnu
--host=mips-img-linux-gnu or some other host depending on what flavor of
MIPS I wanted to build).  I was hoping I could run 'make check' on the
x86 box and have it run tests via a simulator.  That makes it easier to
build and test multiple MIPS architectures.

I tweaked the GMP configure script to recognize mips*-mti-* and
mips*-img-* targets, these hosts/targets exist in GCC and binutils as
names to use for cross compilers targeting MIPS (mti for pre-r6, img for

I have attached the patch as it currently exists to this email so people
could look it over.

Steve Ellcey
sellcey at

-------------- next part --------------
A non-text attachment was scrubbed...
Name: gmp-mipsr6-patch
Type: text/x-patch
Size: 23586 bytes
Desc: not available
URL: <>

More information about the gmp-devel mailing list