poor codegen for abs(), and div by literal?
kinke
noone at nowhere.com
Fri Feb 8 00:09:55 UTC 2019
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:
```
real fabs(real x) @safe pure nothrow @nogc { pragma(inline,
true); return core.math.fabs(x); }
//FIXME
///ditto
double fabs(double x) @safe pure nothrow @nogc { return
fabs(cast(real) x); }
//FIXME
///ditto
float fabs(float x) @safe pure nothrow @nogc { return
fabs(cast(real) x); }
```
Just one of many functions still operating with `real` precision
only.
More information about the Digitalmars-d
mailing list