Hello,
I have a fonction who need the __vectorcall.
UASM don't seem to support it.
Is there a way to correct this ?
You have one function? Just load the registers manually, then use call thefunction
Good idea but ...
in c++
Quote
the call look strange
.data
Eye CXMVECTOR <0.0, 3.0, -6.0, 0.0> ; 4*REAL4
At CXMVECTOR < 0.0, 1.0, 0.0, 0.0 >
Up CXMVECTOR <0.0, 1.0, 0.0, 0.0>
.code
mov g_View,func(XMMatrixLookAtLH,addr Eye,addr At,addr Up)
;-------------------------------------------------------------------
/quote]
in asm /FA
Quote
FXMVECTOR ptr XMVECTOR
;################################################################
XMMatrixLookAtLH PROC EyePosition:FXMVECTOR ,FocusPosition:FXMVECTOR ,UpDirection:FXMVECTOR
Local retour:DWORD
mov retour,1
movaps xmm2, XMMWORD PTR UpDirection
movaps xmm1, XMMWORD PTR FocusPosition
movaps xmm0, XMMWORD PTR EyePosition
lea eax, DWORD PTR $T4[ebp] ;<<<<<<<<<<<<<<< created by c++ in stack ???????????????
push eax
call ?XMMatrixLookAtLH@@YA?AU_XMMATRIX@@T__m128@@00@Z ; XMMatrixLookAtLH
FindeXMMatrixLookAtLH:
mov eax,retour
ret
XMMatrixLookAtLH endp
[
If i understand well,the space needed by XMMVECTOR (size=40h 64 ) is reserved on the stack as last argument
XMMATRIX XM_CALLCONV XMMatrixLookAtLH(FXMVECTOR EyePosition, FXMVECTOR FocusPosition, FXMVECTOR UpDirection);
translate by C++ this give
Quote
extern "C" int _stdcall AXMMatrixLookAtLH(FXMVECTOR EyePosition, FXMVECTOR FocusPosition, FXMVECTOR UpDirection)
{
XMMatrixLookAtLH(EyePosition, FocusPosition, UpDirection);
return 0;
Quote
; COMDAT _AXMMatrixLookAtLH@48
_TEXT SEGMENT
$T1 = -176 ; size = 64
_UpDirection$ = -48 ; size = 16
_FocusPosition$ = -32 ; size = 16
_EyePosition$ = -16 ; size = 16
_AXMMatrixLookAtLH@48 PROC ; COMDAT
; _EyePosition$ = xmm0
; _FocusPosition$ = xmm1
; _UpDirection$ = xmm2
; File H:\directx\Tutorial07\Tutorial07.cpp
; Line 31
push ebx
mov ebx, esp
sub esp, 8
and esp, -16 ; fffffff0H
add esp, 4
push ebp
mov ebp, DWORD PTR [ebx+4]
mov DWORD PTR [esp+4], ebp
mov ebp, esp
sub esp, 184 ; 000000b8H
push esi
push edi
movaps XMMWORD PTR _UpDirection$[ebp], xmm2
movaps XMMWORD PTR _FocusPosition$[ebp], xmm1
movaps XMMWORD PTR _EyePosition$[ebp], xmm0
; Line 32
movaps xmm2, XMMWORD PTR _UpDirection$[ebp]
movaps xmm1, XMMWORD PTR _FocusPosition$[ebp]
movaps xmm0, XMMWORD PTR _EyePosition$[ebp]
lea eax, DWORD PTR $T1[ebp]
push eax
call ?XMMatrixLookAtLH@@YA?AU_XMMATRIX@@T__m128@@00@Z ; XMMatrixLookAtLH
add esp, 4
; Line 33
xor eax, eax
; Line 34
pop edi
pop esi
mov esp, ebp
pop ebp
mov esp, ebx
pop ebx
ret 0
_AXMMatrixLookAtLH@48 ENDP
Quote from: TouEnMasm on November 25, 2020, 06:31:13 AM
Hello,
I have a fonction who need the __vectorcall.
UASM don't seem to support it.
Is there a way to correct this ?
Hi TouEnMasm,
https://github.com/Terraspace/UASM/blob/master/regress/src/vcall/vectorcall.asm
Thanks , it's work only in 64 bits.
deleted
Vectorcall is perfectly defined here https://docs.microsoft.com/en-us/cpp/cpp/vectorcall?view=msvc-160 (https://docs.microsoft.com/en-us/cpp/cpp/vectorcall?view=msvc-160)
Attached is the code sample with the annotated assembly listing.
I implemented vectorcall for 64bit, but never for 32bit. If there is sufficient demand it would be relatively trivial to extend this as the convention is the same and the registers are the same.
I just didn't because A I'm lazy and B I never use 32bit code anymore, especially with vectorcall :)
Thanks for answer.
Don't obliged you to do it.
There is surely better things to do as made better the debugging in 64.