[PATCH] Improve and consolidate sparc PIC assembler.

David Miller davem at davemloft.net
Sun Apr 14 21:08:08 CEST 2013

From: Torbjorn Granlund <tg at gmplib.org>
Date: Sun, 14 Apr 2013 19:21:36 +0200

> I tried some timing of call to a pc loading thunk versus an rdpc
> instruction.  Approximate cycle counts:
>        rdpc    thunk
> US2      5       2
> US3      6       6
> T1       6      10
> I assume US1=US2, US3=US4, and T1=T2.  US1, US2 are the least relevant
> machines, and the only ones where I could see a slowdown for rdpc.
> T1 is also getting irrelevant, more so than US3,US4 I think.

Ok, good to know.

> T3 and T4 are of course quite relevant, so we should take these into
> account.  If they run rdpc no slower than the thunk call, then we should
> use rdpc unconditionally.
> I used this test program:

I'll take a look at this.

> At http://docs.oracle.com/cd/E26502_01/html/E28387/gentextid-2583.html
> Oracle assumes one uses rdpc.  They also seem to say that the gdop stuff
> is for the 64-bit ABI, and now we use if in sparc32.

They are using %pc reads for simplicity, not because it's the most
performant thing to do.  The SunPRO compiler uses PIC thunks.

It is also not true that gotdata relocs are for 64-bit only, GCC as
well as SunPRO generate them for both 32-bit and 64-bit PIC code and
have done so for years.

More information about the gmp-devel mailing list