Where is there documentation on how to write inline asm?
kinke
noone at nowhere.com
Thu Nov 15 21:48:46 UTC 2018
On Thursday, 15 November 2018 at 21:32:10 UTC, pineapple wrote:
> On the less positive side: I still have no clue how to return
> my 16-byte struct. The Microsoft x64 ABI documentation I've
> seen so far explains how return values of 8 bytes and fewer
> work, but haven't explained how larger return values work. The
> obvious answer of "RAX or EAX contains a pointer" is either not
> working or my asm is wrong. (The latter is certainly a
> possibility.)
The MS docs are complete IIRC. The pointer to the pre-allocated
result of your 16-bytes struct is passed in RCX.
If unsure, just reverse-engineer what you need: type it down in
normal D and analyze the generated assembly. You can even do so
online via run.dlang.io (https://run.dlang.io/is/rhsDBF); just
select LDC and add `-mtriple=x86_64-pc-windows-msvc` to generate
Win64 assembly.
Note that run.dlang.io displays AT&T-style asm, not the Intel
one. You can use LDC offline via `-output-s
-x86-asm-syntax=intel` to generate a .s file with Intel syntax.
More information about the Digitalmars-d-learn
mailing list