poor codegen for abs(), and div by literal?

NaN divide at by.zero
Fri Feb 8 00:23:08 UTC 2019


On Friday, 8 February 2019 at 00:09:55 UTC, kinke wrote:
> On Thursday, 7 February 2019 at 23:35:36 UTC, H. S. Teoh wrote:
>> On Thu, Feb 07, 2019 at 11:15:08PM +0000, NaN via Digitalmars-d
>>> So to do the abs(), it stores to memory from XMM reg, loads 
>>> into x87 FPU regs, does the abs with the old FPU instruction, 
>>> then for some reason stores the result as a double, loads 
>>> that back into an XMM, converts it back to single.
>>
>> Which compiler are you using?
>>
>> For performance / codegen quality issues, I highly recommend 
>> looking at the output of ldc or gdc, rather than dmd.
>
> Or just open std.math to see the simple reason for the old FPU 
> being used:

Im embarrassed to admit I did look at the source and didn't spot 
that they were all being upcast to real precision.


More information about the Digitalmars-d mailing list