public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/96339] New: [SVE] Optimise svlast[ab]
@ 2020-07-27 16:22 rsandifo at gcc dot gnu.org
2021-04-14 13:14 ` [Bug target/96339] " belagod at gcc dot gnu.org
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: rsandifo at gcc dot gnu.org @ 2020-07-27 16:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96339
Bug ID: 96339
Summary: [SVE] Optimise svlast[ab]
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: enhancement
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: rsandifo at gcc dot gnu.org
Target Milestone: ---
For:
#include <arm_sve.h>
int8_t
foo (svint8_t x)
{
return svlasta (svptrue_pat_b8 (SV_VL1), x);
}
we generate:
ptrue p0.b, vl1
lasta w0, p0, z0.b
ret
But this is really a BIT_FIELD_REF with a constant index,
so we can generate:
umov w0, v0.b[0]
ret
(works even on big-endian targets).
We should make svlast_impl fold calls to a BIT_FIELD_REF if:
(1) the predicate input is a constant,
(2) we know at compile time which element the constant selects, and
(3) the selected element ends on or before byte 64
For other cases it is probably better to keep the original call.
(2) excludes variable-length predicate constants if (a) we can't
determine the index of the final 1 bit at compile time or
(b) that index might be beyond the end of the vector
(3) restricts the optimisation to cases that can be handled by
*vec_extract<mode><Vel>_v128 and *vec_extract<mode><Vel>_dup.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/96339] [SVE] Optimise svlast[ab]
2020-07-27 16:22 [Bug target/96339] New: [SVE] Optimise svlast[ab] rsandifo at gcc dot gnu.org
@ 2021-04-14 13:14 ` belagod at gcc dot gnu.org
2021-04-15 10:57 ` belagod at gcc dot gnu.org
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: belagod at gcc dot gnu.org @ 2021-04-14 13:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96339
Tejas Belagod <belagod at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |belagod at gcc dot gnu.org
--- Comment #1 from Tejas Belagod <belagod at gcc dot gnu.org> ---
Small correction - the sequence translates to
umov w0, v0.b[1]
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/96339] [SVE] Optimise svlast[ab]
2020-07-27 16:22 [Bug target/96339] New: [SVE] Optimise svlast[ab] rsandifo at gcc dot gnu.org
2021-04-14 13:14 ` [Bug target/96339] " belagod at gcc dot gnu.org
@ 2021-04-15 10:57 ` belagod at gcc dot gnu.org
2021-10-06 11:51 ` prathamesh3492 at gcc dot gnu.org
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: belagod at gcc dot gnu.org @ 2021-04-15 10:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96339
Tejas Belagod <belagod at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Target Milestone|--- |12.0
Last reconfirmed| |2021-04-15
Ever confirmed|0 |1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/96339] [SVE] Optimise svlast[ab]
2020-07-27 16:22 [Bug target/96339] New: [SVE] Optimise svlast[ab] rsandifo at gcc dot gnu.org
2021-04-14 13:14 ` [Bug target/96339] " belagod at gcc dot gnu.org
2021-04-15 10:57 ` belagod at gcc dot gnu.org
@ 2021-10-06 11:51 ` prathamesh3492 at gcc dot gnu.org
2021-10-07 11:24 ` belagod at gcc dot gnu.org
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: prathamesh3492 at gcc dot gnu.org @ 2021-10-06 11:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96339
prathamesh3492 at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |prathamesh3492 at gcc dot gnu.org
--- Comment #2 from prathamesh3492 at gcc dot gnu.org ---
(In reply to Tejas Belagod from comment #1)
> Small correction - the sequence translates to
> umov w0, v0.b[1]
Hi Tejas,
Are you still working on this PR ? If not, can I assign it to myself ?
Thanks,
Prathamesh
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/96339] [SVE] Optimise svlast[ab]
2020-07-27 16:22 [Bug target/96339] New: [SVE] Optimise svlast[ab] rsandifo at gcc dot gnu.org
` (2 preceding siblings ...)
2021-10-06 11:51 ` prathamesh3492 at gcc dot gnu.org
@ 2021-10-07 11:24 ` belagod at gcc dot gnu.org
2021-10-07 11:26 ` prathamesh3492 at gcc dot gnu.org
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: belagod at gcc dot gnu.org @ 2021-10-07 11:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96339
--- Comment #3 from Tejas Belagod <belagod at gcc dot gnu.org> ---
> Are you still working on this PR ? If not, can I assign it to myself ?
Yes I am - its almost done - just been busy with a few higher priority things.
I'll find some time to clean it up, test it and post it soon. Just curious - is
there some urgency for this fix?
Thanks,
Tejas.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/96339] [SVE] Optimise svlast[ab]
2020-07-27 16:22 [Bug target/96339] New: [SVE] Optimise svlast[ab] rsandifo at gcc dot gnu.org
` (3 preceding siblings ...)
2021-10-07 11:24 ` belagod at gcc dot gnu.org
@ 2021-10-07 11:26 ` prathamesh3492 at gcc dot gnu.org
2022-05-06 8:30 ` jakub at gcc dot gnu.org
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: prathamesh3492 at gcc dot gnu.org @ 2021-10-07 11:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96339
--- Comment #4 from prathamesh3492 at gcc dot gnu.org ---
(In reply to Tejas Belagod from comment #3)
> > Are you still working on this PR ? If not, can I assign it to myself ?
>
> Yes I am - its almost done - just been busy with a few higher priority
> things. I'll find some time to clean it up, test it and post it soon. Just
> curious - is there some urgency for this fix?
>
> Thanks,
> Tejas.
Hi Tejas,
Thanks for the heads up. No urgency, I was just looking around for missed
optimizations related to SVE in the bugzilla ;-)
Thanks,
Prathamesh
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/96339] [SVE] Optimise svlast[ab]
2020-07-27 16:22 [Bug target/96339] New: [SVE] Optimise svlast[ab] rsandifo at gcc dot gnu.org
` (4 preceding siblings ...)
2021-10-07 11:26 ` prathamesh3492 at gcc dot gnu.org
@ 2022-05-06 8:30 ` jakub at gcc dot gnu.org
2023-05-08 12:21 ` rguenth at gcc dot gnu.org
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-05-06 8:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96339
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|12.0 |12.2
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 12.1 is being released, retargeting bugs to GCC 12.2.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/96339] [SVE] Optimise svlast[ab]
2020-07-27 16:22 [Bug target/96339] New: [SVE] Optimise svlast[ab] rsandifo at gcc dot gnu.org
` (5 preceding siblings ...)
2022-05-06 8:30 ` jakub at gcc dot gnu.org
@ 2023-05-08 12:21 ` rguenth at gcc dot gnu.org
2023-06-13 7:04 ` cvs-commit at gcc dot gnu.org
2023-06-13 7:07 ` belagod at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-05-08 12:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96339
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|12.3 |12.4
--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 12.3 is being released, retargeting bugs to GCC 12.4.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/96339] [SVE] Optimise svlast[ab]
2020-07-27 16:22 [Bug target/96339] New: [SVE] Optimise svlast[ab] rsandifo at gcc dot gnu.org
` (6 preceding siblings ...)
2023-05-08 12:21 ` rguenth at gcc dot gnu.org
@ 2023-06-13 7:04 ` cvs-commit at gcc dot gnu.org
2023-06-13 7:07 ` belagod at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-06-13 7:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96339
--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tejas Belagod <belagod@gcc.gnu.org>:
https://gcc.gnu.org/g:22d85c10a004f4f5eaf6b68b62a0792faf048bf8
commit r14-1744-g22d85c10a004f4f5eaf6b68b62a0792faf048bf8
Author: Tejas Belagod <tbelagod@arm.com>
Date: Tue May 11 11:09:03 2021 +0100
AArch64: [PR96339] Optimise svlast[ab]
This PR optimizes an SVE intrinsics sequence where
svlasta (svptrue_pat_b8 (SV_VL1), x)
a scalar is selected based on a constant predicate and a variable vector.
This sequence is optimized to return the correspoding element of a NEON
vector. For eg.
svlasta (svptrue_pat_b8 (SV_VL1), x)
returns
umov w0, v0.b[1]
Likewise,
svlastb (svptrue_pat_b8 (SV_VL1), x)
returns
umov w0, v0.b[0]
This optimization only works provided the constant predicate maps to a
range
that is within the bounds of a 128-bit NEON register.
gcc/ChangeLog:
PR target/96339
* config/aarch64/aarch64-sve-builtins-base.cc (svlast_impl::fold):
Fold sve
calls that have a constant input predicate vector.
(svlast_impl::is_lasta): Query to check if intrinsic is svlasta.
(svlast_impl::is_lastb): Query to check if intrinsic is svlastb.
(svlast_impl::vect_all_same): Check if all vector elements are
equal.
gcc/testsuite/ChangeLog:
PR target/96339
* gcc.target/aarch64/sve/acle/general-c/svlast.c: New.
* gcc.target/aarch64/sve/acle/general-c/svlast128_run.c: New.
* gcc.target/aarch64/sve/acle/general-c/svlast256_run.c: New.
* gcc.target/aarch64/sve/pcs/return_4.c (caller_bf16): Fix asm
to expect optimized code for function body.
* gcc.target/aarch64/sve/pcs/return_4_128.c (caller_bf16):
Likewise.
* gcc.target/aarch64/sve/pcs/return_4_256.c (caller_bf16):
Likewise.
* gcc.target/aarch64/sve/pcs/return_4_512.c (caller_bf16):
Likewise.
* gcc.target/aarch64/sve/pcs/return_4_1024.c (caller_bf16):
Likewise.
* gcc.target/aarch64/sve/pcs/return_4_2048.c (caller_bf16):
Likewise.
* gcc.target/aarch64/sve/pcs/return_5.c (caller_bf16): Likewise.
* gcc.target/aarch64/sve/pcs/return_5_128.c (caller_bf16):
Likewise.
* gcc.target/aarch64/sve/pcs/return_5_256.c (caller_bf16):
Likewise.
* gcc.target/aarch64/sve/pcs/return_5_512.c (caller_bf16):
Likewise.
* gcc.target/aarch64/sve/pcs/return_5_1024.c (caller_bf16):
Likewise.
* gcc.target/aarch64/sve/pcs/return_5_2048.c (caller_bf16):
Likewise.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/96339] [SVE] Optimise svlast[ab]
2020-07-27 16:22 [Bug target/96339] New: [SVE] Optimise svlast[ab] rsandifo at gcc dot gnu.org
` (7 preceding siblings ...)
2023-06-13 7:04 ` cvs-commit at gcc dot gnu.org
@ 2023-06-13 7:07 ` belagod at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: belagod at gcc dot gnu.org @ 2023-06-13 7:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96339
Tejas Belagod <belagod at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
Target Milestone|12.4 |14.0
--- Comment #9 from Tejas Belagod <belagod at gcc dot gnu.org> ---
Now fixed on master.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2023-06-13 7:07 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-27 16:22 [Bug target/96339] New: [SVE] Optimise svlast[ab] rsandifo at gcc dot gnu.org
2021-04-14 13:14 ` [Bug target/96339] " belagod at gcc dot gnu.org
2021-04-15 10:57 ` belagod at gcc dot gnu.org
2021-10-06 11:51 ` prathamesh3492 at gcc dot gnu.org
2021-10-07 11:24 ` belagod at gcc dot gnu.org
2021-10-07 11:26 ` prathamesh3492 at gcc dot gnu.org
2022-05-06 8:30 ` jakub at gcc dot gnu.org
2023-05-08 12:21 ` rguenth at gcc dot gnu.org
2023-06-13 7:04 ` cvs-commit at gcc dot gnu.org
2023-06-13 7:07 ` belagod 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).