[Issue 17965] Unexplained usage of the FPU while function result already in right XMM registers

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Mar 29 10:40:14 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=17965

Citrus <bitter.taste at gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bitter.taste at gmx.com

--- Comment #4 from Citrus <bitter.taste at gmx.com> ---
This is a side-effect of a silly optimization that turns Point into a complex
number instead of a double[2] as one would expect.
You can see by yourself how the codegen improves if `TYcdouble` is replaced by
`TYdouble` in `elstruct` (in the `if (I64 && targ1 && targ2)` branch):

---
   33090:       55                      push   rbp
   33091:       48 8b ec                mov    rbp,rsp
   33094:       48 8d 05 b5 bf 02 00    lea    rax,[rip+0x2bfb5]        # 5f050
<_D3foo5Point6__initZ>
   3309b:       66 0f 28 00             movapd xmm0,XMMWORD PTR [rax]
   3309f:       5d                      pop    rbp
   330a0:       c3                      ret    
---

But I'm pretty sure this change may wreak havoc due to various concerns
regarding the alignment and scalar broadcasting.

The bottom line here is:

> You can avoid such FPU <=> XMM round trips by using the LDC compiler.

Or GDC, everything but DMD is fine.

--


More information about the Digitalmars-d-bugs mailing list