This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: I need some advice for x86_64-pc-mingw32 va_list calling convention (in i386.c)
- From: rridge at csclub dot uwaterloo dot ca (Ross Ridge)
- To: gcc at gcc dot gnu dot org
- Date: Fri, 23 Feb 2007 12:24:46 -0500 (EST)
- Subject: Re: I need some advice for x86_64-pc-mingw32 va_list calling convention (in i386.c)
Kai Tietz writes:
>I detected, that the MS-ABI does not support SSE or MMX argument passing
>(as gcc does for x86_64). Therefore I search some advice about the
>enforcement of passing (sse,mmx) registers passing via the standard
>integer registers (for MS they are ecx,edx,r9) and via stack.
I think you may be confused here. You don't pass registers, you pass
values. Micrsoft's x64 ABI documents how to pass values with SSE and
MMX types:
__m128 types, arrays and strings are never passed by immediate
value but rather a pointer will be passed to memory allocated
by the caller. Structs/unions of size 8, 16, 32, or 64 bits
and __m64 will be passed as if they were integers of the same
size. Structs/unions other than these sizes will be passed as a
pointer to memory allocated by the caller. For these aggregate
types passed as a pointer (including __m128), the caller-allocated
temporary memory will be 16-byte aligned.
Since __m128 types are the equivilent of GCC's 128-bit vector types
(SSE), values of this type should be passed by reference. GCC's 64-bit
vector types (MMX) should by passed by value using an integer register.
This is how SSE and MMX values should be passed regardless of wether
the function takes a variable number of arguments or not.
Ross Ridge