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

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

https://gcc.gnu.org/g:779eed50ec701e84137a007f1afcafa9936fb9b7

commit r17-2890-g779eed50ec701e84137a007f1afcafa9936fb9b7
Author: Souradipto Das <[email protected]>
Date:   Sun Aug 2 21:58:01 2026 -0600

    [PATCH v2] RISC-V: Reject non-monotonic shuffle masks in slide patterns
[PR126411]

    shuffle_slide_patterns did not verify that the endpoints of a combined
    slideup+slidedown sequence actually correspond to OP0's and OP1's
    expected positions, allowing a non-monotonic shuffle mask to be
    accepted as a valid slide pattern. This produced wrong code at -O0
    for masks such as { 7, 0, 7, 0 } on a 4-element vector, as reported
    in PR target/126411.

    This patch checks that d->perm[0] and d->perm[vlen - 1] correspond
    to the expected OP0/OP1 boundary positions (vlen - slideup_cnt and
    2 * vlen - 1 - slideup_cnt respectively), and rejects the pattern
    otherwise. need_slideup_p is also added to the existing second-pivot
    rejection check.

            PR target/126411
    gcc/ChangeLog:

            * config/riscv/riscv-v.cc (shuffle_slide_patterns): Check that
            the sequence endpoints correspond to OP0's and OP1's expected
            positions and also reject a second pivot when need_slideup_p is
set.

    gcc/testsuite/ChangeLog:

            * gcc.target/riscv/rvv/base/bug126411.c: New test.

    Suggested-by: Raphael M Zinsly <[email protected]>
    Signed-off-by: Souradipto Das <[email protected]>

Reply via email to