1 Star 0 Fork 152

hwzjyggsddu/glibc

forked from src-openEuler/glibc 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Fix-avx2-strncmp-offset-compare-condition-check-BZ-2.patch 1.63 KB
一键复制 编辑 原始数据 按行查看 历史
wangshuo 提交于 2020-07-03 19:35 . add filelist and backport many patch
From 75870237ff3bb363447b03f4b0af100227570910 Mon Sep 17 00:00:00 2001
From: Sunil K Pandey <[email protected]>
Date: Fri, 12 Jun 2020 08:57:16 -0700
Subject: [PATCH] Fix avx2 strncmp offset compare condition check [BZ #25933]
strcmp-avx2.S: In avx2 strncmp function, strings are compared in
chunks of 4 vector size(i.e. 32x4=128 byte for avx2). After first 4
vector size comparison, code must check whether it already passed
the given offset. This patch implement avx2 offset check condition
for strncmp function, if both string compare same for first 4 vector
size.
---
sysdeps/x86_64/multiarch/strcmp-avx2.S | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/sysdeps/x86_64/multiarch/strcmp-avx2.S b/sysdeps/x86_64/multiarch/strcmp-avx2.S
index 5f88a68262..d42b04b54f 100644
--- a/sysdeps/x86_64/multiarch/strcmp-avx2.S
+++ b/sysdeps/x86_64/multiarch/strcmp-avx2.S
@@ -591,7 +591,14 @@ L(loop_cross_page_2_vec):
movl $(PAGE_SIZE / (VEC_SIZE * 4) - 1), %esi
testq %rdi, %rdi
+# ifdef USE_AS_STRNCMP
+ /* At this point, if %rdi value is 0, it already tested
+ VEC_SIZE*4+%r10 byte starting from %rax. This label
+ checks whether strncmp maximum offset reached or not. */
+ je L(string_nbyte_offset_check)
+# else
je L(back_to_loop)
+# endif
tzcntq %rdi, %rcx
addq %r10, %rcx
/* Adjust for number of bytes skipped. */
@@ -627,6 +634,14 @@ L(loop_cross_page_2_vec):
VZEROUPPER
ret
+# ifdef USE_AS_STRNCMP
+L(string_nbyte_offset_check):
+ leaq (VEC_SIZE * 4)(%r10), %r10
+ cmpq %r10, %r11
+ jbe L(zero)
+ jmp L(back_to_loop)
+# endif
+
.p2align 4
L(cross_page_loop):
/* Check one byte/dword at a time. */
--
2.19.1
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/hwzjyggsddu/glibc.git
[email protected]:hwzjyggsddu/glibc.git
hwzjyggsddu
glibc
glibc
openEuler-20.03-LTS

搜索帮助