public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/110400] New: Reuse vector register for both scalar and vector value.
@ 2023-06-25 4:21 crazylht at gmail dot com
2023-06-25 13:24 ` [Bug rtl-optimization/110400] " pinskia at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: crazylht at gmail dot com @ 2023-06-25 4:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110400
Bug ID: 110400
Summary: Reuse vector register for both scalar and vector
value.
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: crazylht at gmail dot com
Target Milestone: ---
From PR109812 #c18
Uroš Bizjak 2023-06-21 09:46:43 UTC
One interesting observation:
clang is able to do this:
0.09 │ │ vmovddup -0x8(%rdx,%rsi,1),%xmm3 ▒
...
0.11 │ │ vfmadd231sd %xmm2,%xmm3,%xmm1 ▒
...
0.74 │ │ vfmadd231pd %xmm2,%xmm3,%xmm0 ▒
It figures out that duplicated V2DFmode value in %xmm3 can also be accessed in
the same register as DFmode value.
OTOH, current gcc does:
vmovsd (%rsi,%rax,8), %xmm1
...
vmovddup %xmm1, %xmm4
...
vfmadd231pd %xmm4, %xmm0, %xmm2
...
vfmadd231sd %xmm1, %xmm0, %xmm3
The above code needs two registers.
----------------------------------------------------
Similar with below testcase
typedef double v2df __attribute__((vector_size(16)));
v2df c;
double d;
void
foo (double* __restrict a)
{
c = __extension__(v2df) {*a, *a};
d = *a;
}
with option: -O2 -mavx2
GCC generates
foo(double*):
vmovsd (%rdi), %xmm0
vmovddup %xmm0, %xmm1
vmovsd %xmm0, d(%rip)
vmovapd %xmm1, c(%rip)
Clang
foo(double*): # @foo(double*)
vmovddup (%rdi), %xmm0 # xmm0 = mem[0,0]
vmovaps %xmm0, c(%rip)
vmovlps %xmm0, d(%rip)
retq
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug rtl-optimization/110400] Reuse vector register for both scalar and vector value.
2023-06-25 4:21 [Bug target/110400] New: Reuse vector register for both scalar and vector value crazylht at gmail dot com
@ 2023-06-25 13:24 ` pinskia at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-25 13:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110400
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2023-06-25
Ever confirmed|0 |1
Component|target |rtl-optimization
Severity|normal |enhancement
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed. a "CSE" should happen ...
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-06-25 13:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-25 4:21 [Bug target/110400] New: Reuse vector register for both scalar and vector value crazylht at gmail dot com
2023-06-25 13:24 ` [Bug rtl-optimization/110400] " 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).