aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoah Goldstein <goldstein.w.n@gmail.com>2022-06-14 15:37:28 -0700
committerAndreas K. Hüttel <dilfridge@gentoo.org>2022-09-03 22:20:15 +0200
commite83ba54d196d38effffac9b4143d5c5e50f23dc2 (patch)
tree713c466742e5e179ee64401dc979accd1f5e9ea9 /sysdeps
parentx86: Fix misordered logic for setting `rep_movsb_stop_threshold` (diff)
downloadglibc-e83ba54d196d38effffac9b4143d5c5e50f23dc2.tar.gz
glibc-e83ba54d196d38effffac9b4143d5c5e50f23dc2.tar.bz2
glibc-e83ba54d196d38effffac9b4143d5c5e50f23dc2.zip
x86: Add sse42 implementation to strcmp's ifunc
This has been missing since the the ifuncs where added. The performance of SSE4.2 is preferable to to SSE2. Measured on Tigerlake with N = 20 runs. Geometric Mean of all benchmarks SSE4.2 / SSE2: 0.906 (cherry picked from commit ff439c47173565fbff4f0f78d07b0f14e4a7db05) (cherry picked from commit 232b7adb14b7ce36f1c25a88dfc834392acac393)
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/x86_64/multiarch/strcmp.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/sysdeps/x86_64/multiarch/strcmp.c b/sysdeps/x86_64/multiarch/strcmp.c
index 68cb73baad..08638e2632 100644
--- a/sysdeps/x86_64/multiarch/strcmp.c
+++ b/sysdeps/x86_64/multiarch/strcmp.c
@@ -29,6 +29,7 @@
extern __typeof (REDIRECT_NAME) OPTIMIZE (sse2) attribute_hidden;
extern __typeof (REDIRECT_NAME) OPTIMIZE (sse2_unaligned) attribute_hidden;
extern __typeof (REDIRECT_NAME) OPTIMIZE (ssse3) attribute_hidden;
+extern __typeof (REDIRECT_NAME) OPTIMIZE (sse42) attribute_hidden;
extern __typeof (REDIRECT_NAME) OPTIMIZE (avx2) attribute_hidden;
extern __typeof (REDIRECT_NAME) OPTIMIZE (avx2_rtm) attribute_hidden;
extern __typeof (REDIRECT_NAME) OPTIMIZE (evex) attribute_hidden;
@@ -53,6 +54,10 @@ IFUNC_SELECTOR (void)
return OPTIMIZE (avx2);
}
+ if (CPU_FEATURE_USABLE_P (cpu_features, SSE4_2)
+ && !CPU_FEATURES_ARCH_P (cpu_features, Slow_SSE4_2))
+ return OPTIMIZE (sse42);
+
if (CPU_FEATURES_ARCH_P (cpu_features, Fast_Unaligned_Load))
return OPTIMIZE (sse2_unaligned);