x86: Inline strncmp only with -minline-all-stringops
authorH.J. Lu <hjl.tools@gmail.com>
Wed, 15 Jul 2020 17:34:54 +0000 (10:34 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Mon, 26 Oct 2020 11:15:47 +0000 (04:15 -0700)
commit4052c05e5b30fee0fb95a51e74e12a56dce29491
treeb022dbf38ce2640fd94a6a90cc0afff50bf01280
parent3edc21af5272194794fbf24b2c5f0981c632e866
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.
gcc/config/i386/i386-expand.c
gcc/testsuite/gcc.target/i386/pr95458-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/pr95458-2.c [new file with mode: 0644]