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

            Bug ID: 123585
           Summary: [13/14/15/16 Regression] X86 avx2: ICE at -O1 during
                    RTL pass: combine
           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: during RTL pass: combine
Testcase:
#include <stdint.h>
#define BS_VEC(type, num) type __attribute__((vector_size(num * sizeof(type))))
inline int32_t backsmith_snippet_1141(BS_VEC(uint16_t, 32),
                                      BS_VEC(int32_t, 4) BS_ARG_1) {
  BS_ARG_1[0] = 2;
  BS_ARG_1 = __builtin_convertvector(
      __builtin_shufflevector(
          __builtin_shufflevector(
              (BS_VEC(uint8_t, 2)){},
              __builtin_convertvector(
                  __builtin_shufflevector(
                      BS_ARG_1, BS_ARG_1, 7, 3, 3, 7, 4, 2, 0, 3, 4, 2, 5, 0,
0,
                      1, 7, 7, 0, 2, 2, 3, 5, 4, 2, 6, 2, 3, 3, 7, 3, 1, 7, 3),
                  BS_VEC(uint8_t, 32)),
              0, 3, 3, 1, 2, 8, 1, 2, 5, 5, 0, 2, 0, 3, 6, 8),
          __builtin_shufflevector(
              (BS_VEC(uint8_t, 2)){},
              __builtin_convertvector(
                  __builtin_shufflevector(
                      BS_ARG_1, BS_ARG_1, 7, 3, 3, 7, 4, 2, 0, 3, 4, 2, 5, 0,
0,
                      1, 7, 7, 0, 2, 2, 3, 5, 4, 2, 6, 2, 3, 3, 7, 3, 1, 7, 3),
                  BS_VEC(uint8_t, 32)),
              0, 3, 3, 1, 2, 8, 1, 2, 5, 5, 0, 2, 0, 3, 6, 8),
          5, 9, 6, 6),
      BS_VEC(int32_t, 4));
  BS_ARG_1[4 ? BS_ARG_1[3] : 0] = 0;
  return BS_ARG_1[2];
}
int64_t backsmith_snippet_82(BS_VEC(uint64_t, 4), uint64_t, BS_VEC(uint32_t,
8),
                             BS_VEC(int8_t, 32));
uint64_t backsmith_pure_5(BS_VEC(uint32_t, 2) BS_ARG_0) {
  int64_t BS_VAR_2;
  uint32_t BS_VAR_3[8];
  BS_VEC(uint32_t, 32) BS_VAR_7;
  BS_VEC(int64_t, 4) BS_VAR_9;
  BS_VEC(int32_t, 4)
  BS_TEMP_132 = __builtin_convertvector(
      __builtin_shufflevector(BS_ARG_0, BS_ARG_0, 1, 0, 3, 0),
      BS_VEC(int32_t, 4));
  BS_VAR_3[8 ? backsmith_snippet_1141(
                   __builtin_convertvector(BS_VAR_7, BS_VEC(uint16_t, 32)),
                   (BS_VEC(int32_t, 4)){BS_TEMP_132[0], BS_TEMP_132[1],
                                        BS_TEMP_132[2], BS_TEMP_132[3]})
             : 0] |= 107245995;
  uint64_t BS_TEMP_134;
  uint32_t BS_TEMP_135 = __builtin_sub_overflow(
      0,
      backsmith_snippet_82(
          __builtin_convertvector(BS_VAR_9, BS_VEC(uint64_t, 4)), 0,
          __builtin_shufflevector(BS_VAR_7, BS_VAR_7, 8, 8, 4, 4, 5, 0, 5, 0),
          (BS_VEC(int8_t, 32)){}),
      &BS_TEMP_134);
  uint32_t BS_TEMP_136 = BS_TEMP_135 ? BS_VAR_3[0] : 0;
  uint32_t BS_TEMP_137 = BS_TEMP_136;
  for (; BS_TEMP_137;)
    ;
}

Command:
> gcc -O1 -mavx2 test.c
Dump:
during RTL pass: combine
<source>: In function 'backsmith_pure_5':
<source>:57:1: internal compiler error: in simplify_binary_operation_1, at
simplify-rtx.cc:5011
   57 | }
      | ^
0x25d2d88 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
        ???:0
0x25c7b4b internal_error(char const*, ...)
        ???:0
0xa1e02e fancy_abort(char const*, int, char const*)
        ???:0
0x11a5515 simplify_context::simplify_binary_operation(rtx_code, machine_mode,
rtx_def*, rtx_def*)
        ???: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