public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/109406] New: Missing use of aarch64 SVE2 unpredicated integer multiply
@ 2023-04-04 14:36 ktkachov at gcc dot gnu.org
  2023-04-04 14:36 ` [Bug target/109406] " ktkachov at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: ktkachov at gcc dot gnu.org @ 2023-04-04 14:36 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 109406
           Summary: Missing use of aarch64 SVE2 unpredicated integer
                    multiply
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ktkachov at gcc dot gnu.org
  Target Milestone: ---
            Target: aarch64

For the testcase
#define N 1024

long long res[N];
long long in1[N];
long long in2[N];

void
mult (void)
{
  for (int i = 0; i < N; i++)
    res[i] = in1[i] * in2[i];
}

With -O3 -march=armv8.5-a+sve2 we generate the loop:
        ptrue   p1.b, all
        whilelo p0.d, wzr, w2
.L2:
        ld1d    z0.d, p0/z, [x4, x0, lsl 3]
        ld1d    z1.d, p0/z, [x3, x0, lsl 3]
        mul     z0.d, p1/m, z0.d, z1.d
        st1d    z0.d, p0, [x1, x0, lsl 3]
        incd    x0
        whilelo p0.d, w0, w2
        b.any   .L2
        ret

SVE2 supports the MUL (vectors, unpredicated) instruction that would allow us
to  eliminate the use of p1. Clang manages to do this (though it has other
inefficiencies) in https://godbolt.org/z/7xj6xEchx

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

* [Bug target/109406] Missing use of aarch64 SVE2 unpredicated integer multiply
  2023-04-04 14:36 [Bug target/109406] New: Missing use of aarch64 SVE2 unpredicated integer multiply ktkachov at gcc dot gnu.org
@ 2023-04-04 14:36 ` ktkachov at gcc dot gnu.org
  2023-04-04 18:40 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: ktkachov at gcc dot gnu.org @ 2023-04-04 14:36 UTC (permalink / raw)
  To: gcc-bugs

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

ktkachov at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement

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

* [Bug target/109406] Missing use of aarch64 SVE2 unpredicated integer multiply
  2023-04-04 14:36 [Bug target/109406] New: Missing use of aarch64 SVE2 unpredicated integer multiply ktkachov at gcc dot gnu.org
  2023-04-04 14:36 ` [Bug target/109406] " ktkachov at gcc dot gnu.org
@ 2023-04-04 18:40 ` pinskia at gcc dot gnu.org
  2023-04-24  9:28 ` cvs-commit at gcc dot gnu.org
  2023-04-24  9:29 ` ktkachov at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-04-04 18:40 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2023-04-04
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

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

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

* [Bug target/109406] Missing use of aarch64 SVE2 unpredicated integer multiply
  2023-04-04 14:36 [Bug target/109406] New: Missing use of aarch64 SVE2 unpredicated integer multiply ktkachov at gcc dot gnu.org
  2023-04-04 14:36 ` [Bug target/109406] " ktkachov at gcc dot gnu.org
  2023-04-04 18:40 ` pinskia at gcc dot gnu.org
@ 2023-04-24  9:28 ` cvs-commit at gcc dot gnu.org
  2023-04-24  9:29 ` ktkachov at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-04-24  9:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Kyrylo Tkachov <ktkachov@gcc.gnu.org>:

https://gcc.gnu.org/g:9fd4a38c2f30b72ad5e3df7acb1ade201d8ac2cd

commit r14-193-g9fd4a38c2f30b72ad5e3df7acb1ade201d8ac2cd
Author: Kyrylo Tkachov <kyrylo.tkachov@arm.com>
Date:   Mon Apr 24 10:27:31 2023 +0100

    aarch64: PR target/109406 Add support for SVE2 unpredicated MUL

    SVE2 supports an unpredicated vector integer MUL form that we can emit from
our SVE expanders
    without using up a predicate registers. This patch does so.
    As the SVE MUL expansion currently is templated away through a code
iterator I did not split it
    off just for this case but instead special-cased it in the define_expand.
It seemed somewhat less
    invasive than the alternatives but I could split it off more explicitly if
others want to.
    The div-by-bitmask_1.c testcase is adjusted to expect this new MUL form.

    Bootstrapped and tested on aarch64-none-linux-gnu.

    gcc/ChangeLog:

            PR target/109406
            * config/aarch64/aarch64-sve.md (<optab><mode>3): Handle
TARGET_SVE2 MUL
            case.
            * config/aarch64/aarch64-sve2.md
(*aarch64_mul_unpredicated_<mode>): New
            pattern.

    gcc/testsuite/ChangeLog:

            PR target/109406
            * gcc.target/aarch64/sve2/div-by-bitmask_1.c: Adjust for
unpredicated SVE2
            MUL.
            * gcc.target/aarch64/sve2/unpred_mul_1.c: New test.

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

* [Bug target/109406] Missing use of aarch64 SVE2 unpredicated integer multiply
  2023-04-04 14:36 [Bug target/109406] New: Missing use of aarch64 SVE2 unpredicated integer multiply ktkachov at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2023-04-24  9:28 ` cvs-commit at gcc dot gnu.org
@ 2023-04-24  9:29 ` ktkachov at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: ktkachov at gcc dot gnu.org @ 2023-04-24  9:29 UTC (permalink / raw)
  To: gcc-bugs

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

ktkachov at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
   Target Milestone|---                         |14.0
         Resolution|---                         |FIXED

--- Comment #3 from ktkachov at gcc dot gnu.org ---
Fixed for GCC 14

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

end of thread, other threads:[~2023-04-24  9:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-04 14:36 [Bug target/109406] New: Missing use of aarch64 SVE2 unpredicated integer multiply ktkachov at gcc dot gnu.org
2023-04-04 14:36 ` [Bug target/109406] " ktkachov at gcc dot gnu.org
2023-04-04 18:40 ` pinskia at gcc dot gnu.org
2023-04-24  9:28 ` cvs-commit at gcc dot gnu.org
2023-04-24  9:29 ` ktkachov 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).