public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: Jan Hubicka <hubicka@ucw.cz>
Cc: Uros Bizjak <ubizjak@gmail.com>, Jakub Jelinek <jakub@redhat.com>,
	Jeffrey Law <law@redhat.com>,
	 "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: PING^3 [PATCH] x86: Add cmpmemsi for -minline-all-stringops
Date: Sun, 18 Oct 2020 08:27:30 -0700	[thread overview]
Message-ID: <CAMe9rOrjaLG8Ek5Wt0uT-ukbdRkfM=XxEYhW0MGWmo_XCJyQQA@mail.gmail.com> (raw)
In-Reply-To: <20201018151627.GB70631@kam.mff.cuni.cz>

On Sun, Oct 18, 2020 at 8:16 AM Jan Hubicka <hubicka@ucw.cz> wrote:
>
> > On Fri, Oct 2, 2020 at 6:21 AM H.J. Lu <hjl.tools@gmail.com> wrote:
> > >
> > > On Wed, Sep 16, 2020 at 10:07 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> > > >
> > > > On Wed, Aug 19, 2020 at 6:09 AM H.J. Lu <hjl.tools@gmail.com> wrote:
> > > > >
> > > > > On Tue, May 19, 2020 at 5:14 AM H.J. Lu <hjl.tools@gmail.com> wrote:
> > > > > >
> > > > > > On Tue, May 19, 2020 at 1:48 AM Uros Bizjak <ubizjak@gmail.com> wrote:
> > > > > > >
> > > > > > > On Sun, May 17, 2020 at 7:06 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> > > > > > > >
> > > > > > > > Duplicate the cmpstrn pattern for cmpmem.  The only difference is that
> > > > > > > > the length argument of cmpmem is guaranteed to be less than or equal to
> > > > > > > > lengths of 2 memory areas.  Since "repz cmpsb" can be much slower than
> > > > > > > > memcmp function implemented with vector instruction, see
> > > > > > > >
> > > > > > > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43052
> > > > > > > >
> > > > > > > > expand cmpmem to "repz cmpsb" only with -mgeneral-regs-only.
> > > > > > >
> > > > > > > If there is no benefit compared to the library implementation, then
> > > > > > > enable these patterns only when -minline-all-stringops is used.
> > > > > >
> > > > > > Fixed.
> > > > > >
> > > > > > > Eventually these should be reimplemented with SSE4 string instructions.
> > > > > > >
> > > > > > > Honza is the author of the block handling x86 system, I'll leave the
> > > > > > > review to him.
> > > > > >
> > > > > > We used to expand memcmp to "repz cmpsb" via cmpstrnsi.  It was changed
> > > > > > by
> > > > > >
> > > > > > commit 9b0f6f5e511ca512e4faeabc81d2fd3abad9b02f
> > > > > > Author: Nick Clifton <nickc@redhat.com>
> > > > > > Date:   Fri Aug 12 16:26:11 2011 +0000
> > > > > >
> > > > > >     builtins.c (expand_builtin_memcmp): Do not use cmpstrnsi pattern.
> > > > > >
> > > > > >             * builtins.c (expand_builtin_memcmp): Do not use cmpstrnsi
> > > > > >             pattern.
> > > > > >             * doc/md.texi (cmpstrn): Note that the comparison stops if both
> > > > > >             fetched bytes are zero.
> > > > > >             (cmpstr): Likewise.
> > > > > >             (cmpmem): Note that the comparison does not stop if both of the
> > > > > >             fetched bytes are zero.
> > > > > >
> > > > > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95151
> > > > > >
> > > > > > is a regression.
> > > > > >
> > > > > > Honza, can you take a look at this?
> > > > > >
> > > > >
> > > > > PING:
> > > > >
> > > > > https://gcc.gnu.org/pipermail/gcc-patches/2020-May/546921.html
> > > > >
> > > >
> > > > PING.
> > > >
> > >
> > > PING.
> > >
> >
> > I'd like to check it in next Tuesday if there are no comments.
>
> I still plan to intorduce the two-level optimize_for_size predicates.
> Will try to do that by tuesday.
>

Thanks.

BTW, this patch is about inlining memcmp with -minline-all-stringops.
It is very important for user interrupt codes (UINTR) not to call memcmp
since memcmp in glibc uses vector registers which shouldn't be used in
user interrupt codes.

-- 
H.J.

  reply	other threads:[~2020-10-18 15:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-17 17:06 [PATCH] x86: Add cmpmemsi for -mgeneral-regs-only H.J. Lu
2020-05-19  8:48 ` Uros Bizjak
2020-05-19 12:14   ` [PATCH] x86: Add cmpmemsi for -minline-all-stringops H.J. Lu
2020-08-19 13:09     ` PING " H.J. Lu
2020-09-17  5:07       ` PING^2 " H.J. Lu
2020-10-02 13:21         ` PING^3 " H.J. Lu
2020-10-17 21:18           ` H.J. Lu
2020-10-18 15:16             ` Jan Hubicka
2020-10-18 15:27               ` H.J. Lu [this message]
2020-10-23 12:45               ` H.J. Lu

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='CAMe9rOrjaLG8Ek5Wt0uT-ukbdRkfM=XxEYhW0MGWmo_XCJyQQA@mail.gmail.com' \
    --to=hjl.tools@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hubicka@ucw.cz \
    --cc=jakub@redhat.com \
    --cc=law@redhat.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).