On Mon, Jun 10, 2024 at 9:35 AM Robin Dapp <rdapp....@gmail.com> wrote: > > Hi, > > despite looking good on cfarm185 and Linaro's pre-commit CI > gcc-15-638-g7ca35f2e430 now appears to have caused several > regressions on arm-eabi cortex-m55 as found by Linaro's CI: > > https://linaro.atlassian.net/browse/GNU-1252 > > I'm assuming this target is not tested as regularly and thus > the failures went unnoticed until now. > > So it looks like we do need the insn_operand_matches after all?
But why does expand_vec_cond_optab_fn get away without? (note we want to get rid of that variant) Almost no other expander checks this either, though some can_* functions validate. It's not exactly clear to me whether we are just lucky and really always need to validate or whether it's a bug in the target? Richard. > This patch only forces to register if the respective operands > do not already match. > > Bootstrap and regtest on aarch64 and x86 in progress. > Regtested on riscv64. > > Regards > Robin > > gcc/ChangeLog: > > * internal-fn.cc (expand_vec_cond_mask_optab_fn): Only force to > reg if operand does not already match. > --- > gcc/internal-fn.cc | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/gcc/internal-fn.cc b/gcc/internal-fn.cc > index 4948b48bde8..fa85fa69f5a 100644 > --- a/gcc/internal-fn.cc > +++ b/gcc/internal-fn.cc > @@ -3162,7 +3162,13 @@ expand_vec_cond_mask_optab_fn (internal_fn, gcall > *stmt, convert_optab optab) > gcc_assert (icode != CODE_FOR_nothing); > > mask = expand_normal (op0); > + if (!insn_operand_matches (icode, 3, mask)) > + mask = force_reg (mask_mode, mask); > + > rtx_op1 = expand_normal (op1); > + if (!insn_operand_matches (icode, 1, rtx_op1)) > + rtx_op1 = force_reg (mode, rtx_op1); > + > rtx_op2 = expand_normal (op2); > > rtx target = expand_expr (lhs, NULL_RTX, VOIDmode, EXPAND_WRITE); > -- > 2.45.1