make tune fails on a Loongson processor

Torbjorn Granlund tg at
Mon Oct 18 19:36:29 CEST 2010

Some more information about mips timing under the kernel Linux:

The function clock_gettime claims accuracy, but is rejected by GMP's
sanity checks.  And getrusage seems to be accurate, but is actually only
updated about 250 times per second!

I see two ways of fixing this.

(1) Make GMP be smarter about rejecting broken getrusage.  See the remark
    "getrusage_microseconds_p is fundamentally flawed" in tune/time.c.

(2) Make GMP use the instruction rdhwr where available.  To make the
    assembler accept it, one needs to pass -mips32r2 or -mips64r2 to the
    it (depending which ABI we're using).

I do not intend to work more on this.  Some person interested in MIPS
need to take it from here.  Figuring out which MIPS processors support
rdhwr might be a place to start.  Then you need to improve the mips cpu
recognition in, so that GMP can use rdhwr on just adequate


More information about the gmp-bugs mailing list