|
|
190885 |
From 238aa7dce4d9684b6326665c79eabad72d5679bf Mon Sep 17 00:00:00 2001
|
|
|
190885 |
From: "H.J. Lu" <hjl.tools@gmail.com>
|
|
|
190885 |
Date: Wed, 2 Mar 2022 16:21:12 -0800
|
|
|
190885 |
Subject: [PATCH] x86: Set rep_movsb_threshold to 2112 on processors with FSRM
|
|
|
190885 |
|
|
|
190885 |
The glibc memcpy benchmark on Intel Core i7-1065G7 (Ice Lake) showed
|
|
|
190885 |
that REP MOVSB became faster after 2112 bytes:
|
|
|
190885 |
|
|
|
190885 |
Vector Move REP MOVSB
|
|
|
190885 |
length=2112, align1=0, align2=0: 24.20 24.40
|
|
|
190885 |
length=2112, align1=1, align2=0: 26.07 23.13
|
|
|
190885 |
length=2112, align1=0, align2=1: 27.18 28.13
|
|
|
190885 |
length=2112, align1=1, align2=1: 26.23 25.16
|
|
|
190885 |
length=2176, align1=0, align2=0: 23.18 22.52
|
|
|
190885 |
length=2176, align1=2, align2=0: 25.45 22.52
|
|
|
190885 |
length=2176, align1=0, align2=2: 27.14 27.82
|
|
|
190885 |
length=2176, align1=2, align2=2: 22.73 25.56
|
|
|
190885 |
length=2240, align1=0, align2=0: 24.62 24.25
|
|
|
190885 |
length=2240, align1=3, align2=0: 29.77 27.15
|
|
|
190885 |
length=2240, align1=0, align2=3: 35.55 29.93
|
|
|
190885 |
length=2240, align1=3, align2=3: 34.49 25.15
|
|
|
190885 |
length=2304, align1=0, align2=0: 34.75 26.64
|
|
|
190885 |
length=2304, align1=4, align2=0: 32.09 22.63
|
|
|
190885 |
length=2304, align1=0, align2=4: 28.43 31.24
|
|
|
190885 |
|
|
|
190885 |
Use REP MOVSB for data size > 2112 bytes in memcpy on processors with
|
|
|
190885 |
fast short REP MOVSB (FSRM).
|
|
|
190885 |
|
|
|
190885 |
* sysdeps/x86/dl-cacheinfo.h (dl_init_cacheinfo): Set
|
|
|
190885 |
rep_movsb_threshold to 2112 on processors with fast short REP
|
|
|
190885 |
MOVSB (FSRM).
|
|
|
190885 |
|
|
|
190885 |
(cherry picked from commit cf2c57526ba4b57e6863ad4db8a868e2678adce8)
|
|
|
190885 |
---
|
|
|
190885 |
sysdeps/x86/cacheinfo.h | 6 ++++++
|
|
|
190885 |
1 file changed, 6 insertions(+)
|
|
|
190885 |
|
|
|
190885 |
diff --git a/sysdeps/x86/cacheinfo.h b/sysdeps/x86/cacheinfo.h
|
|
|
190885 |
index f72f634a..cc3941d3 100644
|
|
|
190885 |
--- a/sysdeps/x86/cacheinfo.h
|
|
|
190885 |
+++ b/sysdeps/x86/cacheinfo.h
|
|
|
190885 |
@@ -430,6 +430,12 @@ init_cacheinfo (void)
|
|
|
190885 |
rep_movsb_threshold = 2048 * (16 / 16);
|
|
|
190885 |
minimum_rep_movsb_threshold = 16 * 8;
|
|
|
190885 |
}
|
|
|
190885 |
+
|
|
|
190885 |
+ /* NB: The default REP MOVSB threshold is 2112 on processors with fast
|
|
|
190885 |
+ short REP MOVSB (FSRM). */
|
|
|
190885 |
+ if (CPU_FEATURE_USABLE_P (cpu_features, FSRM))
|
|
|
190885 |
+ rep_movsb_threshold = 2112;
|
|
|
190885 |
+
|
|
|
190885 |
if (cpu_features->rep_movsb_threshold > minimum_rep_movsb_threshold)
|
|
|
190885 |
__x86_rep_movsb_threshold = cpu_features->rep_movsb_threshold;
|
|
|
190885 |
else
|
|
|
190885 |
--
|
|
|
190885 |
GitLab
|
|
|
190885 |
|