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

            Bug ID: 123779
           Summary: [16 regression] i386: ICE at reload for masked
                    sext/zext pattern.
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hongyuw at gcc dot gnu.org
  Target Milestone: ---

For test

typedef short __v8hi __attribute__((__vector_size__(16)));
typedef char __v16qi __attribute__((__vector_size__(16)));
typedef long __v2di __attribute__((__vector_size__(16)));
long d;
__v2di e, f, g, j, k;
__v2di h (__v2di i)
{
  return (__v2di) __builtin_ia32_pmovzxbw128 ((__v16qi) i)
}

void l() {
    k = (__v2di) ((__v8hi) e < (__v8hi) f);
    __v2di m{d}, n = h(m);
    j = (__v2di) __builtin_ia32_pblendvb128 ((__v16qi) g,
                                             (__v16qi) n,
                                             (__v16qi) k);
}

Compile with -mavx512vl -mavx512bw -O2 will got ICE

error: unable to generate reloads for:
   17 | }
      | ^
(insn 28 26 30 2 (set (reg:V8HI 122)
        (vec_merge:V8HI (zero_extend:V8HI (vec_select:V8QI (subreg:V16QI
(vec_concat:V2DI (mem/c:DI (symbol_ref:DI ("d") [flags 0x2] <var_decl
0x7dbc418cc1c8 d>) [1 d+0 S8 A64])
                            (const_int 0 [0])) 0)
                    (parallel [
                            (const_int 0 [0])
                            (const_int 1 [0x1])
                            (const_int 2 [0x2])
                            (const_int 3 [0x3])
                            (const_int 4 [0x4])
                            (const_int 5 [0x5])
                            (const_int 6 [0x6])
                            (const_int 7 [0x7])
                        ])))
            (mem/c:V8HI (symbol_ref:DI ("g") [flags 0x2] <var_decl
0x7dbc418cc390 g>) [1 g+0 S16 A128])
            (reg:QI 102 [ _5 ]))) "<source>":14:9 8825
{*sse4_1_zero_extendv8qiv8hi2_mask_2}
     (expr_list:REG_DEAD (reg:QI 102 [ _5 ])
        (expr_list:REG_EQUIV (mem/c:V8HI (symbol_ref:DI ("j") [flags 0x2]
<var_decl 0x7dbc418cc428 j>) [1 j+0 S16 A128])
            (nil))))
during RTL pass: reload
<source>:17:1: internal compiler error: in curr_insn_transform, at
lra-constraints.cc:4398
0x2951d88 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
        ???:0
0x2946acb internal_error(char const*, ...)
        ???:0
0xb1fdc6 fancy_abort(char const*, int, char const*)
        ???:0
0x9a3353 _fatal_insn(char const*, rtx_def const*, char const*, int, char
const*)
        ???:0
0x1354c86 lra_constraints(bool)
        ???:0
0x133fa1a lra(_IO_FILE*, int)
        ???:0

See https://godbolt.org/z/fx8bMnPY7

Reply via email to