public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Liu, Hongtao" <hongtao.liu@intel.com>
To: Richard Biener <richard.guenther@gmail.com>,
	"Kong, Lingling" <lingling.kong@intel.com>
Cc: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>,
	Uros Bizjak <ubizjak@gmail.com>
Subject: RE: [PATCH 0/3] [APX CFCMOV] Support APX CFCMOV
Date: Fri, 14 Jun 2024 06:58:50 +0000	[thread overview]
Message-ID: <MW4PR11MB6762A77434538BA77FA131B9E5C22@MW4PR11MB6762.namprd11.prod.outlook.com> (raw)
In-Reply-To: <CAFiYyc0mKthiHzEGWdY=k8c6n5Si-Yeot7xjGy8j=N2wNvOHKQ@mail.gmail.com>



> -----Original Message-----
> From: Richard Biener <richard.guenther@gmail.com>
> Sent: Friday, June 14, 2024 2:52 PM
> To: Kong, Lingling <lingling.kong@intel.com>
> Cc: gcc-patches@gcc.gnu.org; Liu, Hongtao <hongtao.liu@intel.com>; Uros
> Bizjak <ubizjak@gmail.com>
> Subject: Re: [PATCH 0/3] [APX CFCMOV] Support APX CFCMOV
> 
> On Fri, Jun 14, 2024 at 5:12 AM Kong, Lingling <lingling.kong@intel.com>
> 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.
> 
> What's the cost of suppressing a fault?  ISTR that for example fault suppression
> for vector masked load/store is quite expensive, so when this is for example
Yes, avx512 masked load/store, the cost is expensive when memory is invalid.
> done in a loop where there's always a fault that's suppressed you can see
> 1000-fold slowdown.  I would suspect this is similar for cfcmov?  So how is this
> reflected in the decision to if-convert?
But for APXF, we were told the cost of invalid memory is as cheap as valid ones.
(Why else would this instructions be designed?)
> 
> > To enable CFCMOV, we add a target HOOK
> > TARGET_HAVE_CONDITIONAL_MOVE_MEM_NOTRAP
> > in if-conversion pass to allow convert to cmov.
> >
> > All the changes passed bootstrap & regtest x86-64-pc-linux-gnu.
> > We also tested spec with SDE and passed the runtime test.
> >
> > Ok for trunk?
> >
> > [1].https://www.intel.com/content/www/us/en/developer/articles/technic
> > al/advanced-performance-extensions-apx.html
> >
> > Lingling Kong (3):
> >   [APX CFCMOV] Add a new target hook:
> TARGET_HAVE_CONDITIONAL_MOVE_MEM_NOTRAP
> >   [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                      |  33 ++-
> >  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/doc/tm.texi                              |   6 +
> >  gcc/doc/tm.texi.in                           |   2 +
> >  gcc/ifcvt.cc                                 | 247 ++++++++++++++++++-
> >  gcc/target.def                               |  11 +
> >  gcc/targhooks.cc                             |   8 +
> >  gcc/targhooks.h                              |   1 +
> >  gcc/testsuite/gcc.target/i386/apx-cfcmov-1.c |  73 ++++++
> > gcc/testsuite/gcc.target/i386/apx-cfcmov-2.c |  40 +++
> >  15 files changed, 539 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
> >
> > --
> > 2.31.1
> >

  reply	other threads:[~2024-06-14  6:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20240614025749.743388-1-lingling.kong@intel.com>
2024-06-14  3:11 ` Kong, Lingling
2024-06-14  6:52   ` Richard Biener
2024-06-14  6:58     ` Liu, Hongtao [this message]
2024-06-14  8:10       ` Richard Biener
2024-06-14 17:10   ` Alexander Monakov
2024-06-14 17:22     ` Jeff Law
2024-06-17  3:04       ` Hongtao Liu
2024-06-18  7:40         ` [PATCH v2 0/2] " Kong, Lingling
     [not found] ` <20240614025749.743388-2-lingling.kong@intel.com>
2024-06-14  3:11   ` [PATCH 1/3] [APX CFCMOV] Add a new target hook: TARGET_HAVE_CONDITIONAL_MOVE_MEM_NOTRAP Kong, Lingling
     [not found] ` <20240614025749.743388-3-lingling.kong@intel.com>
2024-06-14  3:11   ` [PATCH 2/3] [APX CFCMOV] Support APX CFCMOV in if_convert pass Kong, Lingling
     [not found] ` <20240614025749.743388-4-lingling.kong@intel.com>
2024-06-14  3:11   ` [PATCH 3/3] [APX CFCMOV] Support APX CFCMOV in backend Kong, Lingling

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=MW4PR11MB6762A77434538BA77FA131B9E5C22@MW4PR11MB6762.namprd11.prod.outlook.com \
    --to=hongtao.liu@intel.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=lingling.kong@intel.com \
    --cc=richard.guenther@gmail.com \
    --cc=ubizjak@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).