public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/95458] New: Inline strncmp is *much* slower than glibc
@ 2020-06-01 12:20 hjl.tools at gmail dot com
  2020-07-16 20:54 ` [Bug target/95458] " aoliva at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: hjl.tools at gmail dot com @ 2020-06-01 12:20 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95458

            Bug ID: 95458
           Summary: Inline strncmp is *much* slower than glibc
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hjl.tools at gmail dot com
                CC: crazylht at gmail dot com
        Depends on: 43052
  Target Milestone: ---

Similar to PR 43052, inline strncmp is *much* slower than glibc.  PR 43052
was "fixed" by accident:

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.

strncmp should be inlined only for -minline-all-stringops.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43052
[Bug 43052] [4.9/5/6 Regression] Inline memcmp is *much* slower than glibc's,
no longer expanded inline

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/95458] Inline strncmp is *much* slower than glibc
  2020-06-01 12:20 [Bug target/95458] New: Inline strncmp is *much* slower than glibc hjl.tools at gmail dot com
@ 2020-07-16 20:54 ` aoliva at gcc dot gnu.org
  2020-08-19 13:22 ` hjl.tools at gmail dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: aoliva at gcc dot gnu.org @ 2020-07-16 20:54 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95458

Alexandre Oliva <aoliva at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |aoliva at gcc dot gnu.org

--- Comment #1 from Alexandre Oliva <aoliva at gcc dot gnu.org> ---
https://gcc.gnu.org/legacy-ml/gcc-patches/2019-09/msg00701.html seems relevant

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/95458] Inline strncmp is *much* slower than glibc
  2020-06-01 12:20 [Bug target/95458] New: Inline strncmp is *much* slower than glibc hjl.tools at gmail dot com
  2020-07-16 20:54 ` [Bug target/95458] " aoliva at gcc dot gnu.org
@ 2020-08-19 13:22 ` hjl.tools at gmail dot com
  2020-10-26 11:17 ` cvs-commit at gcc dot gnu.org
  2020-10-26 11:17 ` hjl.tools at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: hjl.tools at gmail dot com @ 2020-08-19 13:22 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95458

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Target Milestone|---                         |11.0
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2020-08-19

--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Alexandre Oliva from comment #1)
> https://gcc.gnu.org/legacy-ml/gcc-patches/2019-09/msg00701.html seems
> relevant

We can improve inlined strncmp.  But the library version still is much
faster.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/95458] Inline strncmp is *much* slower than glibc
  2020-06-01 12:20 [Bug target/95458] New: Inline strncmp is *much* slower than glibc hjl.tools at gmail dot com
  2020-07-16 20:54 ` [Bug target/95458] " aoliva at gcc dot gnu.org
  2020-08-19 13:22 ` hjl.tools at gmail dot com
@ 2020-10-26 11:17 ` cvs-commit at gcc dot gnu.org
  2020-10-26 11:17 ` hjl.tools at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-10-26 11:17 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95458

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by H.J. Lu <hjl@gcc.gnu.org>:

https://gcc.gnu.org/g:4052c05e5b30fee0fb95a51e74e12a56dce29491

commit r11-4380-g4052c05e5b30fee0fb95a51e74e12a56dce29491
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Wed Jul 15 10:34:54 2020 -0700

    x86: Inline strncmp only with -minline-all-stringops

    Expand strncmp to "repz cmpsb" only with -minline-all-stringops since
    "repz cmpsb" can be much slower than strncmp function implemented with
    vector instructions, see

    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43052

    gcc/

            PR target/95458
            * config/i386/i386-expand.c (ix86_expand_cmpstrn_or_cmpmem):
            Return false for -mno-inline-all-stringops.

    gcc/testsuite/

            PR target/95458
            * gcc.target/i386/pr95458-1.c: New test.
            * gcc.target/i386/pr95458-2.c: Likewise.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/95458] Inline strncmp is *much* slower than glibc
  2020-06-01 12:20 [Bug target/95458] New: Inline strncmp is *much* slower than glibc hjl.tools at gmail dot com
                   ` (2 preceding siblings ...)
  2020-10-26 11:17 ` cvs-commit at gcc dot gnu.org
@ 2020-10-26 11:17 ` hjl.tools at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: hjl.tools at gmail dot com @ 2020-10-26 11:17 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95458

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #4 from H.J. Lu <hjl.tools at gmail dot com> ---
Fixed for GCC 11.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-10-26 11:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-01 12:20 [Bug target/95458] New: Inline strncmp is *much* slower than glibc hjl.tools at gmail dot com
2020-07-16 20:54 ` [Bug target/95458] " aoliva at gcc dot gnu.org
2020-08-19 13:22 ` hjl.tools at gmail dot com
2020-10-26 11:17 ` cvs-commit at gcc dot gnu.org
2020-10-26 11:17 ` hjl.tools at gmail dot com

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).