Windows X64 Calling conventions

Tofu Ninja via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Apr 19 18:16:11 PDT 2017


I am trying to learn the calling conventions in DMD, I am sure I 
will have more than one question about them so as I come across 
them I will ask them in this thread. I am mainly reading the MSDN 
docs on the x64 calls and looking at disassemblies to confirm 
what I learn.


While I was looking at a call of the form void foo(float), I get 
the following disassembly:

movss       xmm0,dword ptr [_TMP0]
sub         rsp,20h
movd        rcx,xmm0
call        void main.foo(float)
add         rsp,20h


My question is, why is it passed twice, both in xmm0 and rcx? The 
MSDN docs say floating point are passed in xmm registers, why is 
it also copied in into rcx? Is it necessary for anything? If it 
was skipped would anything break?


Thanks


More information about the Digitalmars-d-learn mailing list