[Bug tree-optimization/126592] [13/14/15/16/17 Regression] Wrong code with compex mul vectorisation and is_linear_load_p

"cvs-commit at gcc dot gnu.org via Gcc-bugs" <[email protected]> Tue, 04 Aug 2026 14:27:38 +0000
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D126592

--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tamar Christina <[email protected]=
>:

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

commit r17-2948-gc3ceac8d1e1645cb5e7a2502ff17d9effce70699
Author: Tamar Christina <[email protected]>
Date:   Tue Aug 4 15:27:12 2026 +0100

    vect: simplify is_linear_load_p using vec_perm_builder and reject inval=
id
[PR126592]

    is_linear_load_p is supposed to test for valid permutations of lanes of
complex
    arithmetic.  It was written as a manual loop that iteratively discredit=
ed
    what a permutation could be and returned the permute.

    However the code is a bit hard to prove correct and as PR1265992 points=
 out
it
    accepts at least one invalid permute [0 2 2 2].

    To fix this and simplify the code to prevent other issues I have rewrit=
ten
it to
    use vec_perm_indices and use the convenient helper series_p ();

    gcc/ChangeLog:

            PR tree-optimization/126592
            * tree-vect-slp-patterns.cc (is_linear_load_p): Rewrite using
            vec_perm_indices.

    gcc/testsuite/ChangeLog:

            PR tree-optimization/126592
            * gcc.target/aarch64/pr126592.c: New test.=