Closed john-terraspace closed 8 years ago
supports passing of XMMWORD, YMMWORD, ZMMWORD types through registers like fastcall
please explain
On Mon, Feb 8, 2016 at 8:28 PM, John Hankinson notifications@github.com wrote:
Available from VS2013 onwards, supports passing of XMMWORD, YMMWORD, ZMMWORD types through registers like fastcall
— Reply to this email directly or view it on GitHub https://github.com/Terraspace/HJWasm/issues/27.
Since VS2013 they’ve extended the normal WIN64 fastcall convention to allow vectors (any simd register to be passed in registers)..
https://blogs.msdn.microsoft.com/vcblog/2013/07/11/introducing-vector-calling-convention/
It’s been around for a while.
I’ve not checked exactly what jwasm or hjwasm would do in these cases but I believe we stick to the old fastcall standard..
So if you had:
myProc PROC FRAME arg1:XMMWORD, arg2:XMMWORD …
arg1 and arg2 would be passed by reference… IE:
invoke myProc, myVector, myVector
000000013FBD82B9 48 8D 0D AB 49 DE 00 lea rcx,[myVector (01409BCC6Bh)]
000000013FBD82C0 48 8D 15 A4 49 DE 00 lea rdx,[myVector (01409BCC6Bh)]
000000013FBD82C7 E8 1E FF FF FF call TestProc (013FBD81EAh)
Further more the vectorcall calling convention would allow you to also use registers like you do with fastcall
So..
Invoke myProc xmm0, myVector
In both cases then you should get something like:
movaps xmm0,xmm0
movaps xmm1,myVector
when generating the invoke.
The only thing I’m not sure about is how I would use my SIMD struct types with this, because by default XMMWORD etc don’t produce very good debugging info..
Ie:
If you debug and check out an xmmword type you get:
Which is complete rubbish.. it should be 4 floats or 4 integers.. because of that I normally use :
; A proper type definition for an XMMWORD and YMMWORD that allows debugger to see sub-elements/types.
__mm128i struct
i0 DWORD ?
i1 DWORD ?
i2 DWORD ?
i3 DWORD ?
__mm128i ends
_mm128i typedef __mm128i
__mm128f struct
f0 real4 ?
f1 real4 ?
f2 real4 ?
f3 real4 ?
__mm128f ends
_mm128f typedef __mm128f
_mm128 union
i32 _mm128i <>
f32 _mm128f <>
_mm128 ends
From: habran [mailto:notifications@github.com] Sent: 08 February 2016 10:18 AM To: Terraspace/HJWasm HJWasm@noreply.github.com Cc: John Hankinson john@terraspace.co.uk Subject: Re: [HJWasm] Add support for VECTORCALL calling convention (#27)
supports passing of XMMWORD, YMMWORD, ZMMWORD types through registers like fastcall
please explain
On Mon, Feb 8, 2016 at 8:28 PM, John Hankinson notifications@github.com wrote:
Available from VS2013 onwards, supports passing of XMMWORD, YMMWORD, ZMMWORD types through registers like fastcall
— Reply to this email directly or view it on GitHub https://github.com/Terraspace/HJWasm/issues/27.
— Reply to this email directly or view it on GitHub https://github.com/Terraspace/HJWasm/issues/27#issuecomment-181292501 .
Done in 2.15
Available from VS2013 onwards, supports passing of XMMWORD, YMMWORD, ZMMWORD types through registers like fastcall.