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

            Bug ID: 111832
           Summary: RISC-V: ICE on dynamic LMUL
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: juzhe.zhong at rivai dot ai
  Target Milestone: ---

#include <stdint-gcc.h>

#define INDEX16 int16_t

#define TEST_LOOP(DATA_TYPE, BITS)                                            
\
  void __attribute__ ((noinline, noclone))                                    
\
  f_##DATA_TYPE (DATA_TYPE *restrict dest, DATA_TYPE *restrict src,           
\
                 INDEX##BITS *restrict indices, INDEX##BITS *restrict cond)   
\
  {                                                                           
\
    for (int i = 0; i < 128; ++i)                                             
\
      if (cond[i])                                                            
\
        dest[i] += src[indices[i]];                                           
\
  }

#define TEST_ALL(T)                                                           
\
  T (int8_t, 16)                                                              
\

TEST_ALL (TEST_LOOP)

ICE with --param=riscv-autovec-lmul=dynamic

ump file: auto.c.175t.vect
auto.c: In function 'f_int8_t':
auto.c:7:3: internal compiler error: in compute_nregs_for_mode, at
config/riscv/riscv-vector-costs.cc:269
    7 |   f_##DATA_TYPE (DATA_TYPE *restrict dest, DATA_TYPE *restrict src,    
       \
      |   ^~
auto.c:16:3: note: in expansion of macro 'TEST_LOOP'
   16 |   T (int8_t, 16)                                                       
       \
      |   ^
auto.c:18:1: note: in expansion of macro 'TEST_ALL'
   18 | TEST_ALL (TEST_LOOP)
      | ^~~~~~~~
0x1ed4cc0 compute_nregs_for_mode
        ../../../../gcc/gcc/config/riscv/riscv-vector-costs.cc:269
0x1ed4ebc max_number_of_live_regs
        ../../../../gcc/gcc/config/riscv/riscv-vector-costs.cc:304
0x1ed634b riscv_vector::costs::preferred_new_lmul_p(vector_costs const*) const
        ../../../../gcc/gcc/config/riscv/riscv-vector-costs.cc:600
0x1ed658f riscv_vector::costs::better_main_loop_than_p(vector_costs const*)
const
        ../../../../gcc/gcc/config/riscv/riscv-vector-costs.cc:641
0x1bd7658 vect_better_loop_vinfo_p
        ../../../../gcc/gcc/tree-vect-loop.cc:3296
0x1bd7680 vect_joust_loop_vinfos
        ../../../../gcc/gcc/tree-vect-loop.cc:3306
0x1bd8438 vect_analyze_loop(loop*, vec_info_shared*)
        ../../../../gcc/gcc/tree-vect-loop.cc:3518
0x1c4b5dd try_vectorize_loop_1
        ../../../../gcc/gcc/tree-vectorizer.cc:1064
0x1c4baee try_vectorize_loop
        ../../../../gcc/gcc/tree-vectorizer.cc:1182
0x1c4bd9d execute
        ../../../../gcc/gcc/tree-vectorizer.cc:1296


Reference:
https://gcc.godbolt.org/z/e8oEjsa89

Reply via email to