https://goo.gl/WPlPB8
Why not:
int example.square(ref int)
mov DWORD PTR [rdi],0xb
xor eax,eax
ret
???
We can save 17 bytes. It's 68% of all the procedure binary... What's wrong?
Comment #1 by ag0aep6g — 2017-05-08T21:45:55Z
(In reply to Serafimati from comment #0)
> https://goo.gl/WPlPB8
[...]
> We can save 17 bytes. It's 68% of all the procedure binary... What's wrong?
You forgot `-O`.
Comment #2 by github-bugzilla — 2017-10-02T00:24:55Z
Comment #3 by jrdemail2000-dlang — 2017-10-02T02:38:09Z
(In reply to github-bugzilla from comment #2)
> Commits pushed to master at https://github.com/dlang/phobos
>
> https://github.com/dlang/phobos/commit/
> 30c280156c6d7f0550f42a3a4d64db5c0cced4e3
> Issue 17385: Update findSplit doc so example compiles.
>
> https://github.com/dlang/phobos/commit/
> 28b8c9d46c5e824fd187bcf51354b70607ba2f59
> Merge pull request #5752 from jondegenhardt/issue-17385-findSplit-doc
>
> Issue 17385: Update findSplit doc so example compiles.
> merged-on-behalf-of: MetaLang <[email protected]>
Ignore this comment. The result of an incorrect issue number in a PR title.
Comment #4 by github-bugzilla — 2017-10-16T09:58:10Z
This is the code (which is available in the URL that the shortlink resolves to):
int square(ref int num) {
num = 11;
return 0;
}
Putting that in run.dlang.io, setting flags to '-O' and clicking the ASM button gives this:
int onlineapp.square(ref int):
push RBP
mov RBP,RSP
mov dword ptr [RDI],0Bh
xor EAX,EAX
pop RBP
ret
add [RAX],AL
Comment #7 by b2.temp — 2020-02-20T12:31:55Z
sorry I got a 503 and thought it was gone forever.
Comment #8 by pro.mathias.lang — 2020-11-09T01:12:32Z
I'm going to close this as not actionable. Asking for a specific set of instructions to be output is not quite a bug report.
As mentioned, one can use `-O`, and/or `-inline`, or one of the other compilers (GDC, LDC), if the output code is not satisfactory. If this is part of a bigger issue, please re-open with the details.