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

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).