Question about STD64 ABI

bodrato at mail.dm.unipi.it bodrato at mail.dm.unipi.it
Fri Mar 30 08:06:21 CEST 2012


Ciao!

I played a little bit with mpn/x86_64/sqr_basecase.asm, it contains
instructions like:

	add	$-40, %rsp
	mov	%rbx, 32(%rsp)
	mov	%rbp, 24(%rsp)
	mov	%r12, 16(%rsp)
	mov	%r13, 8(%rsp)
	mov	%r14, (%rsp)

>From the document I've found, about the ABI [*], I read:

"The 128-byte area beyond the location pointed to by %rsp is considered to
be reserved and shall not be modified by signal or interrupt handlers.
Therefore, functions may use this area for temporary data that is not
needed across function calls. In particular, leaf functions may use this
area for their entire stack frame, rather than adjusting the stack pointer
in the prologue and epilogue."

If I understand correctly, this means that we can directly use:

	mov	%rbx, -8(%rsp)
	mov	%rbp, -16(%rsp)
	mov	%r12, -24(%rsp)
	mov	%r13, -32(%rsp)
	mov	%r14, -40(%rsp)

Right?
DOS64 compatibility apart, is there any other reason not to use the second
form?

[*] http://www.x86-64.org/documentation/abi.pdf

Best regards,
m

-- 
http://bodrato.it/software/combinatorics.html



More information about the gmp-devel mailing list