Adding support for R6 of MIPS architecture

Steve Ellcey sellcey at
Sat Jan 31 00:09:49 UTC 2015

I am new to the gmp-devel list but have been downloading GMP and using it
as part of my GCC toolchain builds that also include GLIBC.

Recently I updated some of the GMP files that glibc uses in order to support
new revisions of the MIPS architecture (mips32r6 and mips64r6) and I would
like to get those changes into the official GMP as well.

I went ahead and downloaded the GMP 6.0.0 sources from hg (I tried the
unstable branch but it had no configure file and running autoconf on gave me a bunch of errors) and made the same changes there
as I had done in glibc.  Then I tried building GMP and it failed because
the assembly language files are preproccessed by m4 and not by GCC and so
my code with things like:

#if __mips_isa_rev < 6
 	multu	$8,$7
	mulu	$11,$8,$7
	muhu	$12,$8,$7

are not working.  I guess I things more like:

	mulu	$11,$8,$7
	muhu	$12,$8,$7
	multu	$8,$7

But I am not sure how or where I would set ISA_REV6.  Should this be handled
in the configure script or in a *.m4 file under mpn/mips32 or mpn/mips64?  Is
there an example of a compiler macro being checked and used to set a asm
ifdef somewhere that I could copy from?

The files that I need to change for MIPS R6 are addmul_1.asm, mul_1.asm,
and submul_1.asm in both the mpn/mips32 and mpn/mips64 directories.  There
is also a file mpn/mips64/sqr_diagonal.asm that needs changes but it doesn't
look like this file is currently compiled as part of GMP.

Steve Ellcey
sellcey at

More information about the gmp-devel mailing list