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

--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-14 branch has been updated by LuluCheng
<[email protected]>:

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

commit r14-12243-g9f4a1f84a6d2d2316d73a067497e8ec3d23746d7
Author: Lulu Cheng <[email protected]>
Date:   Mon Jan 12 17:23:41 2026 +0800

    LoongArch: Fix bug123521.

    In the vector initialization process, optimization can be performed
    if it can be determined that all elements are the same, or if the
    upper or lower halves are identical.  However, during this
    optimization, when the identical element is an immediate value
    larger than 10 bits, an internal compiler error (ICE) occurs.
    The reason is that in such cases, the function
    `simplify_gen_subreg (imode, reg_tmp, GET_MODE (reg_tmp), 0)` is
    called, where `imode` is `E_DImode`.  The mode of `reg_tmp` in
    `GET_MODE (reg_tmp)` is taken from the immediate value's mode,
    which is `E_VOIDmode`.  This results in a move from `E_VOIDmode`
    to `E_DImode`, an operation not supported by LoongArch.

            PR target/123521

    gcc/ChangeLog:

            * config/loongarch/loongarch.cc
            (loongarch_expand_vector_init_same): Fixed a bug in the
            vector initialization section..

    gcc/testsuite/ChangeLog:

            * gcc.target/loongarch/vector/lasx/pr123521.c: New test.

    Suggested-by: Xi Ruoyao <[email protected]>

    (cherry picked from commit 1a4eb0479ce0827b55a6190ddf13ade330d619e6)

Reply via email to