Hi Robin,
>> + /* Use xt.vile/xt.vilo + vrgather when XXTVarith is available. */
>
> Is this always better than our regular sequence for your uarch, also
> with LMUL > 1 (i.e. in case the gather scales badly)?
Yes, because vcompress also scales badly... However, so far I think the best
sequence with LMUL > 1 for our uarch has been vnsrl+vmv (no need to use slides)
if that's possible. As the LMUL>1 subreg issue seems still not fully resolved,
xt.vil + vrgather is fine.
>
>> + if (TARGET_XXTVARITH)
>> + {
>> + rtx tmp = gen_reg_rtx (vmode);
>> + insn_code vil_icode = even ? code_for_xt_pred (UNSPEC_XT_VILE, vmode)
>> + : code_for_xt_pred (UNSPEC_XT_VILO, vmode);
>> + rtx vil_ops[] = {tmp, d->op0, d->op1};
>> + emit_vlmax_insn (vil_icode, (unsigned) __NORMAL_OP_TA2 | BINARY_OP_P,
>> + vil_ops);
>> +
>> + machine_mode sel_mode = related_int_vector_mode (vmode).require ();
>> + machine_mode idx_mode = GET_MODE_INNER (sel_mode);
>> + rvv_builder v (sel_mode, vlen, 1);
>> + for (int i = 0; i < vlen / 2; i++)
>> + v.quick_push (gen_int_mode (i * 2, idx_mode));
>> + for (int i = 0; i < vlen / 2; i++)
>> + v.quick_push (gen_int_mode (i * 2 + 1, idx_mode));
>> + rtx idx = v.build ();
>> +
>> + emit_vlmax_gather_insn (d->target, tmp, idx);
>
> Does get_gather_index_mode work here?
Yes. I somehow had thought incorrectly that `emit_vlmax_gather_insn` would
do that job. get_gather_index_mode should work here. I'll use that in v2.
Thanks,
Bohan