Float values are wrong in union

Basile B. via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Aug 29 15:24:50 PDT 2016


On Monday, 22 August 2016 at 18:19:52 UTC, Engine Machine wrote:
> On Monday, 22 August 2016 at 05:02:41 UTC, jkpl wrote:
>> On Monday, 22 August 2016 at 04:52:40 UTC, Cauterite wrote:
>>> [...]
>>
>> That's a 32 bit codegen issue then because DMD64 's disasm 
>> shows that SSE regs are used:
> x86 give 7FF and x64 gives 7FB in win.

You can hack the ABI this way:

     void loadInScratchReg(float[1] f...) {}

and pass a single float value.
However when you'll start to use the param (f[0]), loading in 
ST(0) will happen so you must write in iasm. (Not to mention an 
aggressive optimizer that would be able, I think, to replace the 
param type if no iasm is present).

example, usage of a tagged union to perform a safe bit cast:

https://github.com/BBasile/iz/blob/master/import/iz/sugar.d#L1176

Not tested yet...


More information about the Digitalmars-d-learn mailing list