www.fgks.org   »   [go: up one dir, main page]

Issue 21835 - Operation on float should use XMM register, not x87
Summary: Operation on float should use XMM register, not x87
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86_64 Linux
: P1 enhancement
Assignee: No Owner
URL:
Keywords: backend, performance, pull, SIMD
Depends on:
Blocks:
 
Reported: 2021-04-17 07:45 UTC by Walter Bright
Modified: 2021-04-17 11:47 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Walter Bright 2021-04-17 07:45:30 UTC
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 Dlang Bot 2021-04-17 09:13:47 UTC
@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 Dlang Bot 2021-04-17 11:47:46 UTC
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