On Tue, Dec 23, 2025 at 5:44 PM Andrew Pinski <[email protected]> wrote: > > I noticed that on x86_64 and aarch64, noce_try_cond_zero_arith > would produce worse code than noce_try_cmove_arith. > So we should do noce_try_cond_zero_arith last instead > of before noce_try_cmove_arith. > > Pushed as obvious after bootstrap/test on x86_64-linux-gnu. > Also checked to make sure riscv testcases still work.
I will revert this for now and will file a bug report about the missed optimization dealing with AND. Thanks, Andrew > > gcc/ChangeLog: > > * ifcvt.cc (noce_process_if_block): Move noce_try_cond_zero_arith > last. > > Signed-off-by: Andrew Pinski <[email protected]> > --- > gcc/ifcvt.cc | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/gcc/ifcvt.cc b/gcc/ifcvt.cc > index 75d959f652c..97033aad482 100644 > --- a/gcc/ifcvt.cc > +++ b/gcc/ifcvt.cc > @@ -4404,14 +4404,14 @@ noce_process_if_block (struct noce_if_info *if_info) > goto success; > if (noce_try_store_flag_mask (if_info)) > goto success; > - if (HAVE_conditional_move > - && noce_try_cond_zero_arith (if_info)) > - goto success; > if (HAVE_conditional_move > && noce_try_cmove_arith (if_info)) > goto success; > if (noce_try_sign_mask (if_info)) > goto success; > + if (HAVE_conditional_move > + && noce_try_cond_zero_arith (if_info)) > + goto success; > } > > if (!else_bb && set_b) > -- > 2.43.0 >
