public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/106326] New: _m and _z version of SVE instrinsics not optimized to predicate-free version
@ 2022-07-16 14:21 yyc1992 at gmail dot com
  2023-11-26 12:24 ` [Bug target/106326] " rsandifo at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: yyc1992 at gmail dot com @ 2022-07-16 14:21 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 106326
           Summary: _m and _z version of SVE instrinsics not optimized to
                    predicate-free version
           Product: gcc
           Version: 12.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: yyc1992 at gmail dot com
  Target Milestone: ---

The following code should generate a predicate-free fadd instruction since all
the predicates are true.

```
svfloat64_t test(svfloat64_t a, svfloat64_t b)
{
    return svadd_m(svptrue_b64(), a, b);
}
```

but gcc instead generates an all-tree predicate and use that instead, i.e.

```
        ptrue   p0.b, all
        fadd    z0.d, p0/m, z0.d, z1.d
```

The same happens for the `_z` version as well with even worse code generated.

```
        ptrue   p0.b, all
        movprfx z0.d, p0/z, z0.d
        fadd    z0.d, p0/m, z0.d, z1.d
```

This optimization is only done for the `_x` variance. Clang optimizes this for
all variance.

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

* [Bug target/106326] _m and _z version of SVE instrinsics not optimized to predicate-free version
  2022-07-16 14:21 [Bug target/106326] New: _m and _z version of SVE instrinsics not optimized to predicate-free version yyc1992 at gmail dot com
@ 2023-11-26 12:24 ` rsandifo at gcc dot gnu.org
  2023-11-27 14:44 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: rsandifo at gcc dot gnu.org @ 2023-11-26 12:24 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Sandiford <rsandifo at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|prathamesh3492 at gcc dot gnu.org  |rsandifo at gcc dot gnu.org
                 CC|                            |rsandifo at gcc dot gnu.org
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2023-11-26
     Ever confirmed|0                           |1

--- Comment #1 from Richard Sandiford <rsandifo at gcc dot gnu.org> ---
Agreed with Prathamesh that I'd take this.  Testing a patch.

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

* [Bug target/106326] _m and _z version of SVE instrinsics not optimized to predicate-free version
  2022-07-16 14:21 [Bug target/106326] New: _m and _z version of SVE instrinsics not optimized to predicate-free version yyc1992 at gmail dot com
  2023-11-26 12:24 ` [Bug target/106326] " rsandifo at gcc dot gnu.org
@ 2023-11-27 14:44 ` cvs-commit at gcc dot gnu.org
  2023-11-27 14:46 ` rsandifo at gcc dot gnu.org
  2023-11-27 14:51 ` rsandifo at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-11-27 14:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Richard Sandiford <rsandifo@gcc.gnu.org>:

https://gcc.gnu.org/g:e09007308c96a036a4a4e6fd4d6c09442b4c4420

commit r14-5881-ge09007308c96a036a4a4e6fd4d6c09442b4c4420
Author: Richard Sandiford <richard.sandiford@arm.com>
Date:   Mon Nov 27 14:44:02 2023 +0000

    aarch64: Remove redundant zeroing/merging in SVE intrinsics [PR106326]

    Many predicated SVE intrinsics provide three forms of predication:
    zeroing, merging, and any/dont-care.  All three are equivalent when
    the predicate is all-true, so this patch drops the zeroing and
    merging in that case.

    gcc/
            PR target/106326
            * config/aarch64/aarch64-sve-builtins.h (is_ptrue): Declare.
            * config/aarch64/aarch64-sve-builtins.cc (is_ptrue): New function.
            (gimple_folder::redirect_pred_x): Likewise.
            (gimple_folder::fold): Use it.

    gcc/testsuite/
            PR target/106326
            * gcc.target/aarch64/sve/acle/general/pr106326_1.c: New test.

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

* [Bug target/106326] _m and _z version of SVE instrinsics not optimized to predicate-free version
  2022-07-16 14:21 [Bug target/106326] New: _m and _z version of SVE instrinsics not optimized to predicate-free version yyc1992 at gmail dot com
  2023-11-26 12:24 ` [Bug target/106326] " rsandifo at gcc dot gnu.org
  2023-11-27 14:44 ` cvs-commit at gcc dot gnu.org
@ 2023-11-27 14:46 ` rsandifo at gcc dot gnu.org
  2023-11-27 14:51 ` rsandifo at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: rsandifo at gcc dot gnu.org @ 2023-11-27 14:46 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Sandiford <rsandifo at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from Richard Sandiford <rsandifo at gcc dot gnu.org> ---
Fixed on trunk.

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

* [Bug target/106326] _m and _z version of SVE instrinsics not optimized to predicate-free version
  2022-07-16 14:21 [Bug target/106326] New: _m and _z version of SVE instrinsics not optimized to predicate-free version yyc1992 at gmail dot com
                   ` (2 preceding siblings ...)
  2023-11-27 14:46 ` rsandifo at gcc dot gnu.org
@ 2023-11-27 14:51 ` rsandifo at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: rsandifo at gcc dot gnu.org @ 2023-11-27 14:51 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Sandiford <rsandifo at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |zhongyunde at huawei dot com

--- Comment #4 from Richard Sandiford <rsandifo at gcc dot gnu.org> ---
*** Bug 111584 has been marked as a duplicate of this bug. ***

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

end of thread, other threads:[~2023-11-27 14:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-16 14:21 [Bug target/106326] New: _m and _z version of SVE instrinsics not optimized to predicate-free version yyc1992 at gmail dot com
2023-11-26 12:24 ` [Bug target/106326] " rsandifo at gcc dot gnu.org
2023-11-27 14:44 ` cvs-commit at gcc dot gnu.org
2023-11-27 14:46 ` rsandifo at gcc dot gnu.org
2023-11-27 14:51 ` rsandifo 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).