Invoke with SIMD operands
Posted: 29 Aug 2018 22:45
Yes I understand your idea. BTW %j is assigned with ordinal integer number, TYPE# %j returns 'N'. You probably meant TYPE# %*{%j}.ar18 wrote: ↑29 Aug 2018 13:38 Sometimes a bit of pseudocode will help better than any explanation ...
api %MACRO Function, Argument1, Argument2,,,Lib=
____%i %SETA %#
____j %FOR %i..1
________%IF %i=4
____________%IF TYPE# %j = 'real4'
________________movss xmm3,%j
____________%ELSEIF TYPE# %j = 'real8'
________________movsd xmm3,%j
____________%ELSE
________________mov r9,%j
________________%ENDIF
...
Unfortunately, operator TYPE# doesn't distinguish register families, it returns 'R' for GPR, XMM, MMX, SEGREG...
I would have to implement another operator REGTYPE#. What if the operand is provided as an immediate number, e.g. Function 0x8040, how should the poor assembler know whether it is integer number 32832 or real4 number 4.0?
€ASM fastcall implementation expects all operands of Invoke to be qword-pushable, i.e. r64, imm, [mem]. That would require some new mechanism how to tell the Invoke macro, if the operand should be preloaded to GPR or to SIMD register. I'm afraid automatic detection with TYPE# is not capable of this.
And I'm not sure if it's worth the effort - I didn't found any WinAPI function which requires SIMD, and with user-defined functions we are not obeyed with fastcall convention, we may contract arbitrary register calling convention, right?