[patch] add x32 support
tg at gmplib.org
Mon Jan 14 20:36:43 CET 2013
Richard Henderson <rth at twiddle.net> writes:
On 01/10/2013 12:46 PM, Torbjorn Granlund wrote:
> (I wonder if this can become a robust ABI with current hardware, unless
> we pay a major performance price. It seems like address arithmetic by
> means of hardware indexing, lea, etc, will be 64-bits, while we want to
> compute mod 2^32.)
The addr32 prefix takes care of this.
Can you please explain a bit about how that works?
insn (%rX), reg
gives me no addr32 prefix, but
insn (%eX), reg
does indeed. Is that register syntax change the standard way of
For assembly code that needs to support both the 64-bit ABI ans x32, it
might be more convenient to conditionally put an explicit ".byte 0x67"
at the preceding line. Apparently gas also accept "addr32" but then
prints "Warning: stand-alone `addr32' prefix".
An optimisation is to use a 64-bit expresson if one knows that the
expresson >= 0 and < 2^32. Correct?
So that saves a byte. Do you know if there are other costs, i.e.,
decoding or execution costs associated to addr32? (OK, insn aligment vs
cache lines matters, and might cause addr32 to either slow down or speed
At some point, we'd like to make the assembly code in GMP support x32.
I think it should already be fine, without any addr32 prefixing, but I
am not sure. For most reasonable indexing, I'd say that one should not
magically end up with a non-canonical address.
Do you agree?
More information about the gmp-devel