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

--- Comment #10 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Andrew Pinski <[email protected]>:

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

commit r16-4742-gfcde4c81644aecbb2b03f0b2f470a4d1116706cc
Author: Andrew Pinski <[email protected]>
Date:   Wed Oct 29 11:58:31 2025 -0700

    MATCH: Optimize `VEC_SHL_INSERT (dup (A), A)` to just `dup (A) [PR116075]

    It was noticed if we have `.VEC_SHL_INSERT ({ 0, ... }, 0)` it was not
being
    simplified to just `{ 0, ... }`. This was generated from the autovectorizer
    (maybe even on accident, see PR tree-optmization/116081).

    This adds a few SVE testcases to see if this is optimized since the
    auto-vectorizer or intrinsics are the only two ways of getting this
    produced.

    Changes since:
    * v1: Move the constant case over to fold-const-call.cc.
          Simplify match pattern to use handle vec_duplicate.

    Build and tested for aarch64-linux-gnu with no regressions.

            PR target/116075

    gcc/ChangeLog:

            * fold-const-call.cc (fold_const_vec_shl_insert): New function.
            (fold_const_call): Call fold_const_vec_shl_insert for
CFN_VEC_SHL_INSERT.
            * match.pd (`VEC_SHL_INSERT (dup (A), A)`): New pattern.

    gcc/testsuite/ChangeLog:

            * gcc.target/aarch64/sve/dup-insr-1.c: New test.
            * gcc.target/aarch64/sve/dup-insr-2.c: New test.

    Signed-off-by: Andrew Pinski <[email protected]>

Reply via email to