public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/99668] New: Converting argument _Complex double to double vector causes STLF stall
@ 2021-03-19 13:36 rguenth at gcc dot gnu.org
  2023-05-15  7:02 ` [Bug middle-end/99668] " pinskia at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-03-19 13:36 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 99668
           Summary: Converting argument _Complex double to double vector
                    causes STLF stall
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rguenth at gcc dot gnu.org
  Target Milestone: ---

Consider

_Complex double a, b;
typedef double v2df __attribute__((vector_size(16)));
v2df foo (_Complex double x)
{
  return *(v2df *)&x;
}

which on GIMPLE is represented as the simple

v2df foo (complex double x)
{
  v2df _2;
  _2 = VIEW_CONVERT_EXPR<v2df>(x_3(D));
  return _2;
}

but since on x86_64 _Complex double are passed in %xmm0 and %xmm1 we end up
with spilling x to the stack:

foo:
.LFB0:
        .cfi_startproc
        movsd   %xmm0, -24(%rsp)
        movsd   %xmm1, -16(%rsp)
        movupd  -24(%rsp), %xmm0
        ret

Ideally GIMPLE would know that a V_C_E isn't a good representation here
but improving RTL expansion should be possible as well.  We expand
x_3(D) to (concat:DC ...) but the V_C_E expansion path misses special-casing
of this.  The MEM_REF expansion code can deal with this so eventually
splitting out parts of that support is possible.

In the end we want a simple

        movlhps %xmm1, %xmm0

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

* [Bug middle-end/99668] Converting argument _Complex double to double vector causes STLF stall
  2021-03-19 13:36 [Bug middle-end/99668] New: Converting argument _Complex double to double vector causes STLF stall rguenth at gcc dot gnu.org
@ 2023-05-15  7:02 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-15  7:02 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-05-15
           Keywords|                            |missed-optimization
           Severity|normal                      |enhancement

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
.

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

end of thread, other threads:[~2023-05-15  7:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-19 13:36 [Bug middle-end/99668] New: Converting argument _Complex double to double vector causes STLF stall rguenth at gcc dot gnu.org
2023-05-15  7:02 ` [Bug middle-end/99668] " pinskia 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).