Hi,

Thank you for reviewing v1!

Changes in v2:
Removed the target hook and added a new optab for cfcmov.

Lingling Kong (2):
  [APX CFCMOV] Support APX CFCMOV in if_convert pass
  [APX CFCMOV] Support APX CFCMOV in backend

 gcc/config/i386/i386-expand.cc               |  63 +++++
 gcc/config/i386/i386-opts.h                  |   4 +-
 gcc/config/i386/i386.cc                      |  16 +-
 gcc/config/i386/i386.h                       |   1 +
 gcc/config/i386/i386.md                      |  53 +++-
 gcc/config/i386/i386.opt                     |   3 +
 gcc/config/i386/predicates.md                |   7 +
 gcc/ifcvt.cc                                 | 246 ++++++++++++++++++-
 gcc/optabs.def                               |   1 +
 gcc/testsuite/gcc.target/i386/apx-cfcmov-1.c |  73 ++++++ 
 gcc/testsuite/gcc.target/i386/apx-cfcmov-2.c |  40 +++
 11 files changed, 494 insertions(+), 13 deletions(-) 
 create mode 100644 gcc/testsuite/gcc.target/i386/apx-cfcmov-1.c
 create mode 100644 gcc/testsuite/gcc.target/i386/apx-cfcmov-2.c

--

> -----Original Message-----
> From: Hongtao Liu <crazy...@gmail.com>
> Sent: Monday, June 17, 2024 11:05 AM
> To: Jeff Law <jeffreya...@gmail.com>
> Cc: Alexander Monakov <amona...@ispras.ru>; Kong, Lingling
> <lingling.k...@intel.com>; gcc-patches@gcc.gnu.org; Liu, Hongtao
> <hongtao....@intel.com>; Uros Bizjak <ubiz...@gmail.com>
> Subject: Re: [PATCH 0/3] [APX CFCMOV] Support APX CFCMOV
> 
> On Sat, Jun 15, 2024 at 1:22 AM Jeff Law <jeffreya...@gmail.com> wrote:
> >
> >
> >
> > On 6/14/24 11:10 AM, Alexander Monakov wrote:
> > >
> > > On Fri, 14 Jun 2024, Kong, Lingling wrote:
> > >
> > >> APX CFCMOV[1] feature implements conditionally faulting which means
> > >> that all memory faults are suppressed when the condition code
> > >> evaluates to false and load or store a memory operand. Now we could load
> or store a memory operand may trap or fault for conditional move.
> > >>
> > >> In middle-end, now we don't support a conditional move if we knew
> > >> that a load from A or B could trap or fault.
> > >
> > > Predicated loads&stores on Itanium don't trap either. They are
> > > modeled via COND_EXEC on RTL. The late if-conversion pass (the
> > > instance that runs after
> > > reload) is capable of introducing them.
> > >
> > >> To enable CFCMOV, we add a target HOOK
> > >> TARGET_HAVE_CONDITIONAL_MOVE_MEM_NOTRAP
> > >> in if-conversion pass to allow convert to cmov.
> > >
> > > Considering the above, is the new hook really necessary? Can you
> > > model the new instructions via (cond_exec () (set ...)) instead of (set
> (if_then_else ...)) ?
> > Note that turning on cond_exec will turn off some of the cmove support.
> Yes, cfcmov looks more like a cmov than a cond_exec.
> >
> > But the general suggesting of trying to avoid a hook for this is a
> > good one.  In fact, my first reaction to this thread was "do we really
> > need a hook for this".
> Maybe a new optab, .i.e cfmovmodecc, and it differs from movcc for Conditional
> Fault?
> >
> > jeff
> 
> 
> 
> --
> BR,
> Hongtao

Reply via email to