Bug 21835 – Operation on float should use XMM register, not x87

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2021-04-17T07:45:30Z
Last change time
2021-04-17T11:47:46Z
Keywords
backend, performance, pull, SIMD
Assigned to
No Owner
Creator
Walter Bright

Comments

Comment #0 by bugzilla — 2021-04-17T07:45:30Z
Code: void test() { Point p; if (p.f != 0.0) assert(0); } struct Point { float f = 0.0; double g = 0.0; } Compile with -O -m64 on Linux, and the code for test() is: push RBP mov RBP,RSP sub RSP,010h lea RAX,-010h[RBP] xor ECX,ECX mov [RAX],RCX mov 8[RAX],RCX fld float ptr -010h[RBP] fldz fucomip <--- using x87 fstp ST jne L25 mov RSP,RBP pop RBP ret L25: mov ESI,5 mov EDI,offset FLAT:_TMP0@32 call _d_assertp@PC32 mov RSP,RBP pop RBP ret It should be using XMM instructions instead.
Comment #1 by dlang-bot — 2021-04-17T09:13:47Z
@WalterBright created dlang/dmd pull request #12448 "fix Issue 21835 - Operation on float should use XMM register, not x87" fixing this issue: - fix Issue 21835 - Operation on float should use XMM register, not x87 https://github.com/dlang/dmd/pull/12448
Comment #2 by dlang-bot — 2021-04-17T11:47:46Z
dlang/dmd pull request #12448 "fix Issue 21835 - Operation on float should use XMM register, not x87" was merged into master: - a4e85cfa4f080d0df466999c4b5b68546866ed25 by Walter Bright: fix Issue 21835 - Operation on float should use XMM register, not x87 https://github.com/dlang/dmd/pull/12448