D generates large assembly for simple function

Stefan Koch uplink.coder at googlemail.com
Sat Jan 27 19:45:35 UTC 2018


On Saturday, 27 January 2018 at 19:43:50 UTC, Stefan Koch wrote:
> On Saturday, 27 January 2018 at 19:42:01 UTC, Matt wrote:
>> Godbolt link: https://godbolt.org/g/t5S976
> The actual code is :
>  imul edi, edi
>  mov eax, edi
>  ret
>
>
> The rest is runtime initialization.
> which you can remove using an undocumented -betterC switch.

ah ... -betterC is only for dmd.
try using the gdc compiler instead of ldc.
it does not emit runtime stuff if it's not used.


More information about the Digitalmars-d-learn mailing list