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

            Bug ID: 123521
           Summary: [14/15/16 Regression] LoongArch64: ICE at -O1/O2/O3
                    during RTL pass: expand
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: xxs_chy at outlook dot com
  Target Milestone: ---

Reproducer:https://godbolt.org/z/srd98hcTW
Testcase:
#include <stdint.h>
#define BS_VEC(type, num) type __attribute__((vector_size(num * sizeof(type))))
BS_VEC(uint32_t, 2) backsmith_snippet_54(int8_t, BS_VEC(uint32_t, 2) BS_ARG_1)
{
    uint32_t BS_TEMP_1 = BS_ARG_1[0];
    BS_VEC(uint32_t, 2) BS_TEMP_2 = BS_ARG_1;
    BS_VEC(uint32_t, 2) BS_TEMP_3 = { BS_TEMP_1, BS_TEMP_1 };
    BS_VEC(uint32_t, 2) BS_TEMP_4 = BS_ARG_1;
    BS_VEC(uint32_t, 2)
    BS_TEMP_7 = { BS_TEMP_4[0], BS_TEMP_2[1] ? BS_TEMP_3[1] : 0 };
    BS_ARG_1 = (BS_VEC(uint32_t, 2)){ BS_TEMP_7[0], BS_TEMP_7[1] };
    return __builtin_convertvector(
        __builtin_convertvector(BS_ARG_1, BS_VEC(uint64_t, 2)),
        BS_VEC(uint32_t, 2));
}
BS_VEC(uint64_t, 2) backsmith_pure_7(int16_t, BS_VEC(int8_t, 8), int64_t);
int32_t g_92[];
static uint8_t func_70(int32_t);
uint32_t func_1()
{
    uint32_t l_72 = 8;
    func_70(l_72);
}
int func_70_l_154;
uint8_t func_70(int32_t p_71)
{
    uint16_t BS_VAR_4 = 978;
    BS_VEC(int8_t, 2) BS_VAR_6;
    int32_t l_75;
    int32_t *l_120 = &g_92[3];
    for (; l_75;)
    {
        if (p_71)
            ;
        else
            BS_VAR_4 -= *l_120 = func_70_l_154;
    BS_LABEL_1:
    }
    for (uint32_t BS_TEMP_791; BS_TEMP_791 < 2; BS_TEMP_791++) l_120 = &p_71;
    backsmith_pure_7(
        0,
        (BS_VEC(int8_t, 8)) __builtin_convertvector(
            __builtin_shufflevector(BS_VAR_6, BS_VAR_6, 0, 1, 0, 2, 3, 0, 1,
2),
            BS_VEC(uint8_t, 8)),
        backsmith_snippet_54(
            0,
            __builtin_convertvector((BS_VEC(uint16_t, 2)){ BS_VAR_4, BS_VAR_4
},
                                    BS_VEC(uint32_t, 2)))[1]);
    goto BS_LABEL_1;
}

Command:
> loongarch64-unknown-linux-musl-gcc -mlsx -O1 a.c
Dump:
during RTL pass: expand
In function 'func_70',
    inlined from 'func_1' at <source>:22:5:
<source>:40:5: internal compiler error: in simplify_subreg, at
simplify-rtx.cc:7549
   40 |     backsmith_pure_7(
      |     ^~~~~~~~~~~~~~~~~
   41 |         0,
      |         ~~
   42 |         (BS_VEC(int8_t, 8)) __builtin_convertvector(
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   43 |             __builtin_shufflevector(BS_VAR_6, BS_VAR_6, 0, 1, 0, 2, 3,
0, 1, 2),
      |            
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   44 |             BS_VEC(uint8_t, 8)),
      |             ~~~~~~~~~~~~~~~~~~~~
   45 |         backsmith_snippet_54(
      |         ~~~~~~~~~~~~~~~~~~~~~
   46 |             0,
      |             ~~
   47 |             __builtin_convertvector((BS_VEC(uint16_t, 2)){ BS_VAR_4,
BS_VAR_4 },
      |            
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   48 |                                     BS_VEC(uint32_t, 2)))[1]);
      |                                     ~~~~~~~~~~~~~~~~~~~~~~~~~
0x7927b3029e3f __libc_start_main
        ???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Compiler returned: 1

Reply via email to