On Mon, May 12, 2025 at 2:36 PM Richard Sandiford
<richard.sandif...@arm.com> wrote:
>
> Andrew Pinski <quic_apin...@quicinc.com> writes:
> > cmov optab was added back in r0-24110-g1c0290eaac4094
> > (https://gcc.gnu.org/pipermail/gcc-patches/1999-September/018596.html)
> > but it was never used. movcc is used instead and since 
> > r0-93453-gf90b7a5a7913cc (cond-optab),
> > movcc becomes what cmov_optab was going to be; in having a combined compare 
> > and move optab.
> >
> > Note the only target which seems to have implemented this optab is aarch64; 
> > will remove
> > that in a different patch.
> >
> > Bootstrapped and tested on x86_64-linux-gnu.
> >
> >       PR middle-end/120230
> > gcc/ChangeLog:
> >
> >       * optabs.cc (can_compare_p): Remove support for ccp_cmov.
> >       * optabs.def (cmov_optab): Remove.
> >       * optabs.h (can_compare_purpose): Remove ccp_cmov.
>
> Huh, good spot.  Funny how many patches over the years have diligently
> updated this code without it ever being used.

Yes and I only noticed because I went to push an approved patch
(testcase) for MIPS (gcc.target/mips/pr54240.c) and decided to look
into the bug report there of remembering how it became a mips specific
testcase and the cmov optab was accidently used inside phiopt (instead
of movcc optab) and there was a comment in the bug report about how we
should remove the cmov optab
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54240#c11) but nobody
acted on that comment back in 2012 either :).

Thanks,
Andrew Pinski

>
> OK, thanks.
>
> Richard
>
> >
> > Signed-off-by: Andrew Pinski <quic_apin...@quicinc.com>
> > ---
> >  gcc/optabs.cc  | 3 ---
> >  gcc/optabs.def | 1 -
> >  gcc/optabs.h   | 3 +--
> >  3 files changed, 1 insertion(+), 6 deletions(-)
> >
> > diff --git a/gcc/optabs.cc b/gcc/optabs.cc
> > index 0a14b1eef8a..fe68a25ffd4 100644
> > --- a/gcc/optabs.cc
> > +++ b/gcc/optabs.cc
> > @@ -4304,9 +4304,6 @@ can_compare_p (enum rtx_code code, machine_mode mode,
> >            && (icode = optab_handler (cstore_optab, mode)) != 
> > CODE_FOR_nothing
> >            && insn_operand_matches (icode, 1, test))
> >       return true;
> > -      if (purpose == ccp_cmov
> > -       && optab_handler (cmov_optab, mode) != CODE_FOR_nothing)
> > -     return true;
> >
> >        mode = GET_MODE_WIDER_MODE (mode).else_void ();
> >        PUT_MODE (test, mode);
> > diff --git a/gcc/optabs.def b/gcc/optabs.def
> > index 23f79235238..0c1435d4ecd 100644
> > --- a/gcc/optabs.def
> > +++ b/gcc/optabs.def
> > @@ -294,7 +294,6 @@ OPTAB_D (cond_len_fnms_optab, "cond_len_fnms$a")
> >  OPTAB_D (cond_len_neg_optab, "cond_len_neg$a")
> >  OPTAB_D (cond_len_one_cmpl_optab, "cond_len_one_cmpl$a")
> >  OPTAB_D (vcond_mask_len_optab, "vcond_mask_len_$a")
> > -OPTAB_D (cmov_optab, "cmov$a6")
> >  OPTAB_D (cstore_optab, "cstore$a4")
> >  OPTAB_D (ctrap_optab, "ctrap$a4")
> >  OPTAB_D (addv4_optab, "addv$I$a4")
> > diff --git a/gcc/optabs.h b/gcc/optabs.h
> > index 23fa77be24e..ae525c848d3 100644
> > --- a/gcc/optabs.h
> > +++ b/gcc/optabs.h
> > @@ -244,11 +244,10 @@ extern void emit_unop_insn (enum insn_code, rtx, rtx, 
> > enum rtx_code);
> >  extern void emit_libcall_block (rtx_insn *, rtx, rtx, rtx);
> >
> >  /* The various uses that a comparison can have; used by can_compare_p:
> > -   jumps, conditional moves, store flag operations.  */
> > +   jumps, store flag operations.  */
> >  enum can_compare_purpose
> >  {
> >    ccp_jump,
> > -  ccp_cmov,
> >    ccp_store_flag
> >  };

Reply via email to