On 4/19/23 11:31, Song Gao wrote:
在 2023/4/1 下午1:03, Richard Henderson 写道:
Better to expand imm to max here, rather than both inside gen_vsat_s and the runtime do_vsats_*.

Likewise for the unsigned versions.

I tried to expand imm to max  here  for the unsigned versions.

{

     uint64_t max;

     ...

     static const GVecGen2i op[4] = {
         {
             //.fniv = gen_vsat_u,
             .fnoi = gen_helper_vsat_bu,
             .opt_opc = vecop_list,
             .vece = MO_8
         },
         {
             //.fniv = gen_vsat_u,
             .fnoi = gen_helper_vsat_hu,
             .opt_opc = vecop_list,
             .vece = MO_16
         },
         {
             //.fniv = gen_vsat_u,
             .fnoi = gen_helper_vsat_wu,
             .opt_opc = vecop_list,
             .vece = MO_32
         },
         {
             //.fniv = gen_vsat_u,
             .fnoi = gen_helper_vsat_du,
             .opt_opc = vecop_list,
             .vece = MO_64
         },
     };

     max = (imm == 0x3f) ? UINT64_MAX : (1ull << (imm + 1)) - 1;
     tcg_gen_gvec_2i(vd_ofs, vj_ofs, oprsz, maxsz, max, &op[vece]);

}


and  I got a tcg_debug_assert();


Thread 1 "qemu-loongarch6" received signal SIGABRT, Aborted.
0x00007ffff60b337f in raise () from /lib64/libc.so.6
(gdb) bt
#0  0x00007ffff60b337f in raise () from /lib64/libc.so.6
#1  0x00007ffff609ddb5 in abort () from /lib64/libc.so.6
#2  0x00007ffff609dc89 in __assert_fail_base.cold.0 () from /lib64/libc.so.6
#3  0x00007ffff60aba76 in __assert_fail () from /lib64/libc.so.6
#4  0x0000555555632fcf in simd_desc (oprsz=16, maxsz=16, data=134217727) at ../tcg/tcg-op-gvec.c:91

You should use tcg_gen_gvec_2s, and pass tcg_constant_i64(max).


r~

Reply via email to