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

            Bug ID: 123382
           Summary: [16 Regression] AArch64: ICE at -O3: invalid mask type
                    in 'vec_perm_expr'
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: xxs_chy at outlook dot com
  Target Milestone: ---

Reproducer: https://godbolt.org/z/38adP3h7Y
Testcase:
#define BS_VEC(type, num) type __attribute__((vector_size(num * sizeof(type))))
#include <arm_neon.h>
BS_VEC(uint32_t, 4)
backsmith_snippet_265(uint32_t, uint32_t, BS_VEC(uint64_t, 4), uint64_t);
int64_t backsmith_snippet_1049(uint16_t, BS_VEC(uint16_t, 16), uint32_t) {}
BS_VEC(int8_t, 2) backsmith_pure_2(BS_VEC(int16_t, 4) BS_ARG_0)
{
    int64_t BS_TEMP_135 = backsmith_snippet_1049(
        0,
        __builtin_convertvector(__builtin_shufflevector(BS_ARG_0, BS_ARG_0, 1,
                                                        4, 7, 4, 4, 3, 1, 1, 6,
                                                        6, 2, 5, 4, 2, 4, 0),
                                BS_VEC(uint16_t, 16)),
        0);
    BS_VEC(int8_t, 2)
    BS_TEMP_136 = __builtin_convertvector((BS_VEC(int64_t, 2)){ BS_TEMP_135 },
                                          BS_VEC(int8_t, 2));
    BS_VEC(int8_t, 2)
    BS_TEMP_137 = __builtin_convertvector(
        __builtin_shufflevector(BS_ARG_0, BS_ARG_0, 7, 3), BS_VEC(int8_t, 2));
    BS_VEC(int8_t, 2)
    BS_TEMP_138 = __builtin_convertvector(
        __builtin_shufflevector(BS_ARG_0, BS_ARG_0, 4, 4), BS_VEC(int8_t, 2));
    return (BS_VEC(int8_t, 2)){ BS_TEMP_136[0] ? BS_TEMP_137[0]
                                               : BS_TEMP_138[0] };
}
int64_t backsmith_pure_0(BS_VEC(int32_t, 2), BS_VEC(int64_t, 2))
{
    int8_t BS_VAR_0[71];
    uint8_t BS_VAR_2;
    for (uint16_t BS_INC_0;;)
    {
        if (BS_VAR_2
            & backsmith_snippet_265(
                0, 0,
                __builtin_convertvector((BS_VEC(uint16_t, 4)){},
                                        BS_VEC(uint64_t, 4)),
                0)[3])
            BS_VAR_0[BS_INC_0] = ((BS_VEC(int8_t, 4))0)[0];
        uint64_t BS_TEMP_299;
        for (uint64_t BS_INC_1; BS_INC_1 < BS_TEMP_299; BS_INC_1 += 1)
        {
            if (BS_VAR_0[BS_INC_0])
                backsmith_pure_0(
                    __builtin_convertvector((BS_VEC(uint64_t, 2)){},
                                            BS_VEC(int32_t, 2)),
                    __builtin_convertvector((BS_VEC(uint64_t, 2)){},
                                            BS_VEC(int64_t, 2)));
            __builtin_convertvector((BS_VEC(uint16_t, 32)){},
                                    BS_VEC(int32_t, 32));
            BS_VAR_2 &=
                backsmith_pure_2((BS_VEC(int16_t, 4)) __builtin_convertvector(
                    (BS_VEC(uint64_t, 4)){ BS_INC_1 }, BS_VEC(uint16_t,
4)))[0];
        }
    }
}

Command:
> aarch64-unknown-linux-musl-gcc -O3 a.c
Dump:
<source>: In function 'backsmith_pure_0':
<source>:27:9: error: invalid mask type in 'vec_perm_expr'
   27 | int64_t backsmith_pure_0(BS_VEC(int32_t, 2), BS_VEC(int64_t, 2))
      |         ^~~~~~~~~~~~~~~~
vector(4) short int
vector(4) short int
vector(4) short int
vector(4) ssizetype
_71 = VEC_PERM_EXPR <_48, _48, _72>;
during GIMPLE pass: ifcvt
<source>:27:9: internal compiler error: verify_gimple failed
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
See <https://gcc.gnu.org/bugs/> for instructions.
ASM generation compiler returned: 1
<source>: In function 'backsmith_pure_0':
<source>:27:9: error: invalid mask type in 'vec_perm_expr'
   27 | int64_t backsmith_pure_0(BS_VEC(int32_t, 2), BS_VEC(int64_t, 2))
      |         ^~~~~~~~~~~~~~~~
vector(4) short int
vector(4) short int
vector(4) short int
vector(4) ssizetype
_71 = VEC_PERM_EXPR <_48, _48, _72>;
during GIMPLE pass: ifcvt
<source>:27:9: internal compiler error: verify_gimple failed
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
See <https://gcc.gnu.org/bugs/> for instructions.
Execution build compiler returned: 1
Build failed

Reply via email to