On Sat, Nov 5, 2022 at 12:25 PM Richard Biener <richard.guent...@gmail.com> wrote: > > On Wed, Nov 2, 2022 at 1:46 PM Uros Bizjak <ubiz...@gmail.com> wrote: > > > > On Wed, Nov 2, 2022 at 1:45 PM Robin Dapp <rd...@linux.ibm.com> wrote: > > > > > > > IIRC, I was trying to "fix" modeless operand by giving it a mode, but > > > > since it made no difference for x86, I later dropped the patch. > > > > However, operand with a known mode is preferred, so if it works for > > > > you, just include my patch in your submission. My patch is somehow > > > > trivial if we want operand to have known mode. > > > > > > I'd prefer to push it separately as my patch changes several things in > > > the s390 backend that are kind of unrelated. Is it OK to do an x86 > > > bootstrap and regtest and push it if everything looks good? You can of > > > course also do it yourself :) > > > > It is a middle-end patch, someone will have to approve it. > > The patch is OK
Thanks, pushed with the following ChangeLog: optabs: Use operand[2] mode in can_vec_set_var_idx_p Use operand[2] mode in can_vec_set_var_idx_p when checking vec_set_optab. This change allows non-VOID index operand in vec_set_optab. 2022-11-06 Uroš Bizjak <ubiz...@gmail.com> gcc/ChangeLog: * optabs.cc (can_vec_set_var_idx_p): Use operand[2] mode when checking vec_set_optab. Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}. Uros.
diff --git a/gcc/optabs.cc b/gcc/optabs.cc index c2a6f971d74..9fc9b1fc6e9 100644 --- a/gcc/optabs.cc +++ b/gcc/optabs.cc @@ -4344,12 +4344,17 @@ can_vec_set_var_idx_p (machine_mode vec_mode) return false; machine_mode inner_mode = GET_MODE_INNER (vec_mode); + rtx reg1 = alloca_raw_REG (vec_mode, LAST_VIRTUAL_REGISTER + 1); rtx reg2 = alloca_raw_REG (inner_mode, LAST_VIRTUAL_REGISTER + 2); - rtx reg3 = alloca_raw_REG (VOIDmode, LAST_VIRTUAL_REGISTER + 3); enum insn_code icode = optab_handler (vec_set_optab, vec_mode); + const struct insn_data_d *data = &insn_data[icode]; + machine_mode idx_mode = data->operand[2].mode; + + rtx reg3 = alloca_raw_REG (idx_mode, LAST_VIRTUAL_REGISTER + 3); + return icode != CODE_FOR_nothing && insn_operand_matches (icode, 0, reg1) && insn_operand_matches (icode, 1, reg2) && insn_operand_matches (icode, 2, reg3);