On Sun, May 31, 2020 at 4:10 PM H.J. Lu <hjl.to...@gmail.com> wrote:
>
> We used to expand memcmp to "repz cmpsb" via cmpstrnsi.  It was changed
> by
>
> 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.
>
> Duplicate the cmpstrn pattern for cmpmem and expand cmpmem to "repz cmpsb"
> for -minline-all-stringops.  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 cmpmem expander may pass the actual string length
> directly to cmpstrnqi patterns.  Pass a copy of the string length to
> cmpstrnqi patterns to avoid changing the actual string length by cmpstrnqi
> patterns.
>
> Tested on Linux/x86 and Linux/x86-64.  OK for master?
>
> H.J. Lu (2):
>   x86: Pass a copy of the string length to cmpstrnqi
>   x86: Add cmpmemsi for -minline-all-stringops
>
>  gcc/config/i386/i386-expand.c             |  84 ++++++++++++++
>  gcc/config/i386/i386-protos.h             |   1 +
>  gcc/config/i386/i386.md                   |  80 ++++---------
>  gcc/testsuite/gcc.target/i386/pr95151-1.c |  17 +++
>  gcc/testsuite/gcc.target/i386/pr95151-2.c |  10 ++
>  gcc/testsuite/gcc.target/i386/pr95151-3.c |  18 +++
>  gcc/testsuite/gcc.target/i386/pr95151-4.c |  11 ++
>  gcc/testsuite/gcc.target/i386/pr95443-1.c | 130 ++++++++++++++++++++++
>  gcc/testsuite/gcc.target/i386/pr95443-2.c |  79 +++++++++++++
>  9 files changed, 371 insertions(+), 59 deletions(-)
>  create mode 100644 gcc/testsuite/gcc.target/i386/pr95151-1.c
>  create mode 100644 gcc/testsuite/gcc.target/i386/pr95151-2.c
>  create mode 100644 gcc/testsuite/gcc.target/i386/pr95151-3.c
>  create mode 100644 gcc/testsuite/gcc.target/i386/pr95151-4.c
>  create mode 100644 gcc/testsuite/gcc.target/i386/pr95443-1.c
>  create mode 100644 gcc/testsuite/gcc.target/i386/pr95443-2.c
>

PING:

https://gcc.gnu.org/pipermail/gcc-patches/2020-May/546920.html
https://gcc.gnu.org/pipermail/gcc-patches/2020-May/546921.html


-- 
H.J.

Reply via email to