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

            Bug ID: 123107
           Summary: [15/16 Regression] X86-64: ICE at -O2 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/Efv51MKdz
Testcase:
#include <stdint.h>
#define BS_VEC(type, num) type __attribute__((vector_size(num * sizeof(type))))
#include <immintrin.h>
#define BARRIER_v16u8(x)                                                      
\
    (BS_VEC(uint8_t, 16)) _mm_avg_epu8((__m128i)x, (__m128i)x)
uint8_t foo()
{
    BS_VEC(int16_t, 4) BS_VAR_5[20];
    uint16_t BS_VAR_9[9];
    for (;;)
    {
        BS_VEC(int16_t, 16)
        BS_TEMP_206 =
            __builtin_convertvector(BARRIER_v16u8({}), BS_VEC(int16_t, 16)) <
0;
        if (BS_TEMP_206[0] | BS_TEMP_206[1] | BS_TEMP_206[2] | BS_TEMP_206[3]
            | BS_TEMP_206[4] | BS_TEMP_206[5] | BS_TEMP_206[6] | BS_TEMP_206[7]
            | BS_TEMP_206[8] | BS_TEMP_206[9] | BS_TEMP_206[10]
            | BS_TEMP_206[11] | BS_TEMP_206[12] | BS_TEMP_206[13]
            | BS_TEMP_206[14] | BS_TEMP_206[15])
            BS_VAR_9[0] |= BS_VAR_5[6][1];
    }
}

GCC dump:
during RTL pass: expand
<source>: In function 'foo':
<source>:6:9: internal compiler error: in prepare_cmp_insn, at optabs.cc:4597
    6 | uint8_t foo()
      |         ^~~
0x20bd0f5 diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag
(*) [1], diagnostic_t)
        ???:0
0x20ce646 internal_error(char const*, ...)
        ???:0
0x7a56c6 fancy_abort(char const*, int, char const*)
        ???:0
0xcb933d emit_cmp_and_jump_insns(rtx_def*, rtx_def*, rtx_code, rtx_def*,
machine_mode, int, tree_node*, rtx_def*, profile_probability)
        ???:0
0x9a078a do_compare_rtx_and_jump(rtx_def*, rtx_def*, rtx_code, int, tree_node*,
machine_mode, rtx_def*, rtx_code_label*, rtx_code_label*, profile_probability)
        ???: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