]> git.ipfire.org Git - thirdparty/glibc.git/commit
x86: Optimize strcmp-avx2.S
authorNoah Goldstein <goldstein.w.n@gmail.com>
Mon, 10 Jan 2022 21:35:38 +0000 (15:35 -0600)
committerSunil K Pandey <skpgkp2@gmail.com>
Thu, 5 May 2022 16:17:13 +0000 (09:17 -0700)
commit63d1ff4aa0a1fe686587946e32ce9a6c103a4bfe
treefccbd68daf9041fda83c58d7937548f597f9cec0
parentb002995ea46cff8c742dc7f9e5bcf7f1066accb5
x86: Optimize strcmp-avx2.S

Optimization are primarily to the loop logic and how the page cross
logic interacts with the loop.

The page cross logic is at times more expensive for short strings near
the end of a page but not crossing the page. This is done to retest
the page cross conditions with a non-faulty check and to improve the
logic for entering the loop afterwards. This is only particular cases,
however, and is general made up for by more than 10x improvements on
the transition from the page cross -> loop case.

The non-page cross cases are improved most for smaller sizes [0, 128]
and go about even for (128, 4096]. The loop page cross logic is
improved so some more significant speedup is seen there as well.

test-strcmp, test-strncmp, test-wcscmp, and test-wcsncmp all pass.

Signed-off-by: Noah Goldstein <goldstein.w.n@gmail.com>
(cherry picked from commit b77b06e0e296f1a2276c27a67e1d44f2cfa38d45)
sysdeps/x86_64/multiarch/strcmp-avx2.S