public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/105504] New: Fails to break dependency for vcvtss2sd xmm, xmm, mem
@ 2022-05-06  9:12 amonakov at gcc dot gnu.org
  2022-05-07  3:02 ` [Bug target/105504] " crazylht at gmail dot com
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: amonakov at gcc dot gnu.org @ 2022-05-06  9:12 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105504

            Bug ID: 105504
           Summary: Fails to break dependency for vcvtss2sd xmm, xmm, mem
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: amonakov at gcc dot gnu.org
  Target Milestone: ---

Created attachment 52933
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52933&action=edit
testcase

Hit by core-math team at
https://gcc.gnu.org/pipermail/gcc-help/2022-May/141480.html

Compile the attached testcase with -O2 -march=haswell (other AVX-capable Intel
families except Alderlake are affected too) and observe that the big basic
block begins with

.L6:
        vcvtss2sd       xmm1, xmm1, DWORD PTR [rsp-4]

This creates a false dependency on the previous assignment into xmm1, resulting
in wildly varying (and suboptimal) throughput figures depending on how long the
CPU stalls waiting for the previous assignment to complete.

GCC has code to emit such instructions in a manner that avoids false
dependencies (see e.g. PR89071), but here it doesn't seem to work.


Also there's a potentially related issue that GCC copies the initial xmm0 value
to eax via stack in the beginning of the function:

cr_exp10f:
        vmovss  DWORD PTR [rsp-4], xmm0
        mov     eax, DWORD PTR [rsp-4]

This seems wrong since xmm-reg moves on Haswell are 1 cycle afaict.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-08-12 13:50 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-06  9:12 [Bug target/105504] New: Fails to break dependency for vcvtss2sd xmm, xmm, mem amonakov at gcc dot gnu.org
2022-05-07  3:02 ` [Bug target/105504] " crazylht at gmail dot com
2022-05-07  3:16 ` crazylht at gmail dot com
2022-05-07  3:36 ` crazylht at gmail dot com
2022-05-07  4:04 ` crazylht at gmail dot com
2022-05-07  8:28 ` amonakov at gcc dot gnu.org
2022-06-08  3:24 ` cvs-commit at gcc dot gnu.org
2023-08-05 15:05 ` egallager at gcc dot gnu.org
2023-08-07  1:55 ` crazylht at gmail dot com
2023-08-12 13:50 ` egallager at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).