public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "tnfchris at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/110625] [14 Regression][AArch64] Vect: SLP fails to vectorize a loop as the reduction_latency calculated by new costs is too large
Date: Fri, 29 Dec 2023 16:16:00 +0000 [thread overview]
Message-ID: <bug-110625-4-HdnsuQsBh0@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-110625-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110625
Tamar Christina <tnfchris at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
--- Comment #25 from Tamar Christina <tnfchris at gcc dot gnu.org> ---
(In reply to Hao Liu from comment #0)
> This problem causes a performance regression in SPEC2017 538.imagick. For
> the following simple case (modified from pr96208):
>
> typedef struct {
> unsigned short m1, m2, m3, m4;
> } the_struct_t;
> typedef struct {
> double m1, m2, m3, m4, m5;
> } the_struct2_t;
>
> double bar1 (the_struct2_t*);
>
> double foo (double* k, unsigned int n, the_struct_t* the_struct) {
> unsigned int u;
> the_struct2_t result;
> for (u=0; u < n; u++, k--) {
> result.m1 += (*k)*the_struct[u].m1;
> result.m2 += (*k)*the_struct[u].m2;
> result.m3 += (*k)*the_struct[u].m3;
> result.m4 += (*k)*the_struct[u].m4;
> }
> return bar1 (&result);
> }
>
In the context of this report the regression should be fixed, however we still
don't vectorize this loop. We ran this and other cases comparing scalar and
vector versions of this loop and it looks like specifically Neoverse N2 does
much better using the scalar version here. So it looks like the cost model is
doing the right thing here for the current codegen of the function.
Note that the vector version:
ldr q31, [x3], 16
ldr q29, [x4], -16
rev64 v31.8h, v31.8h
uxtl v30.4s, v31.4h
uxtl2 v31.4s, v31.8h
sxtl v27.2d, v30.2s
sxtl v28.2d, v31.2s
sxtl2 v30.2d, v30.4s
sxtl2 v31.2d, v31.4s
scvtf v27.2d, v27.2d
scvtf v28.2d, v28.2d
scvtf v30.2d, v30.2d
scvtf v31.2d, v31.2d
fmla v26.2d, v27.2d, v29.d[1]
fmla v24.2d, v30.2d, v29.d[1]
fmla v23.2d, v28.2d, v29.d[0]
fmla v25.2d, v31.2d, v29.d[0]
Is still pretty inefficient due to all the extends. If we generate better code
here this may tip the scale back to vector. But for now, the patch should fix
the regression.
next prev parent reply other threads:[~2023-12-29 16:16 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-11 9:15 [Bug target/110625] New: [AArch64] " hliu at amperecomputing dot com
2023-07-11 10:41 ` [Bug target/110625] " rguenth at gcc dot gnu.org
2023-07-12 0:58 ` hliu at amperecomputing dot com
2023-07-14 8:58 ` hliu at amperecomputing dot com
2023-07-18 10:41 ` rsandifo at gcc dot gnu.org
2023-07-18 12:03 ` rsandifo at gcc dot gnu.org
2023-07-19 2:57 ` hliu at amperecomputing dot com
2023-07-19 8:55 ` rsandifo at gcc dot gnu.org
2023-07-19 9:36 ` hliu at amperecomputing dot com
2023-07-28 16:50 ` rsandifo at gcc dot gnu.org
2023-07-28 16:53 ` rsandifo at gcc dot gnu.org
2023-07-31 2:45 ` hliu at amperecomputing dot com
2023-07-31 12:56 ` cvs-commit at gcc dot gnu.org
2023-08-01 9:09 ` tnfchris at gcc dot gnu.org
2023-08-01 9:19 ` tnfchris at gcc dot gnu.org
2023-08-01 9:45 ` hliu at amperecomputing dot com
2023-08-01 9:49 ` tnfchris at gcc dot gnu.org
2023-08-01 9:50 ` hliu at amperecomputing dot com
2023-08-01 13:49 ` tnfchris at gcc dot gnu.org
2023-08-02 3:49 ` hliu at amperecomputing dot com
2023-08-04 2:34 ` cvs-commit at gcc dot gnu.org
2023-12-08 10:20 ` [Bug target/110625] [14 Regression][AArch64] " tnfchris at gcc dot gnu.org
2023-12-12 16:26 ` tnfchris at gcc dot gnu.org
2023-12-26 14:55 ` tnfchris at gcc dot gnu.org
2023-12-29 15:59 ` cvs-commit at gcc dot gnu.org
2023-12-29 16:16 ` tnfchris at gcc dot gnu.org [this message]
2023-12-30 8:34 ` hliu at amperecomputing dot com
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bug-110625-4-HdnsuQsBh0@http.gcc.gnu.org/bugzilla/ \
--to=gcc-bugzilla@gcc.gnu.org \
--cc=gcc-bugs@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).