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 <ni...@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

Reply via email to