PING^4 [PATCH] x86: Inline strncmp only with -minline-all-stringops

H.J. Lu hjl.tools@gmail.com
Fri Oct 23 12:51:32 GMT 2020


On Fri, Oct 2, 2020 at 6:23 AM Jan Hubicka <hubicka@ucw.cz> wrote:
>
> > > > diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
> > > > index fb677e17817..f3fbed81c4a 100644
> > > > --- a/gcc/config/i386/i386.md
> > > > +++ b/gcc/config/i386/i386.md
> > > > @@ -18007,7 +18007,13 @@ (define_expand "cmpstrnsi"
> > > >  {
> > > >    rtx addr1, addr2, countreg, align, out;
> > > >
> > > > -  if (optimize_insn_for_size_p () && !TARGET_INLINE_ALL_STRINGOPS)
> > > > +  /* Expand strncmp only with -minline-all-stringops since
> > > > +     "repz cmpsb" can be much slower than strncmp functions
> > > > +     implemented with vector instructions, see
> > > > +
> > > > +     https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43052
> > > > +   */
> > > > +  if (!TARGET_INLINE_ALL_STRINGOPS)
> > > >      FAIL;
>
> I think this is hitting the more general problem that we want to have
> two levels of optimization for size (at least internally). One for parts
> of program guessed to be cold and do not perform such extreme changes
> (i.e. translate stringops, division etc.) and other when we really want
> top optimize for size.
>
> I will try to push out patches for two-state optimize_size next week.
>

As of r11-4314, GCC still inlines strncmp without -minline-all-stringops.
If  there are no comments,  I will check in my patch:

https://gcc.gnu.org/pipermail/gcc-patches/2020-August/552237.html

next Monday.

-- 
H.J.


More information about the Gcc-patches mailing list