[Issue 17965] Unexplained usage of the FPU while function result already in right XMM registers
https://issues.dlang.org/show_bug.cgi?id=17965 Walter Bright changed: What|Removed |Added Keywords||backend CC||bugzi...@digitalmars.com --
[Issue 17965] Unexplained usage of the FPU while function result already in right XMM registers
https://issues.dlang.org/show_bug.cgi?id=17965 Citruschanged: What|Removed |Added CC||bitter.ta...@gmx.com --- Comment #4 from Citrus --- 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 ecmovrbp,rsp 33094: 48 8d 05 b5 bf 02 00learax,[rip+0x2bfb5]# 5f050 <_D3foo5Point6__initZ> 3309b: 66 0f 28 00 movapd xmm0,XMMWORD PTR [rax] 3309f: 5d poprbp 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. --
[Issue 17965] Unexplained usage of the FPU while function result already in right XMM registers
https://issues.dlang.org/show_bug.cgi?id=17965 --- Comment #3 from ponce--- @Basile: I also find that unsettling. --
[Issue 17965] Unexplained usage of the FPU while function result already in right XMM registers
https://issues.dlang.org/show_bug.cgi?id=17965 b2.t...@gmx.com changed: What|Removed |Added Keywords||wrong-code --- Comment #2 from b2.t...@gmx.com --- (In reply to ponce from comment #1) > You can avoid such FPU <=> XMM round trips by using the LDC compiler. The > DMD backend tend to generate those. I know p0nce, but this is really a "pathological case" to me. The "trip", as you say, that happens at the end is a bug, not just something that could be better. --
[Issue 17965] Unexplained usage of the FPU while function result already in right XMM registers
https://issues.dlang.org/show_bug.cgi?id=17965 poncechanged: What|Removed |Added CC||alil...@gmail.com --- Comment #1 from ponce --- You can avoid such FPU <=> XMM round trips by using the LDC compiler. The DMD backend tend to generate those. --