summaryrefslogtreecommitdiff
path: root/sysdeps/i386/i686/multiarch/memchr-sse2.S
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2018-12-27 18:56:13 +0000
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2018-12-27 18:57:13 +0000
commit82dd75a7f436a19047325d62182590c9f9e23a78 (patch)
tree60ca20c8cf2b0d178d84725c0715471f76df97e1 /sysdeps/i386/i686/multiarch/memchr-sse2.S
parent0bbb676a2342367c4e52b35e890f24667dabb348 (diff)
parent963c37d5c0eb62b38f8764b23931c0dcdd497a13 (diff)
Merge commit 'refs/top-bases/t/tls' into t/tls
Diffstat (limited to 'sysdeps/i386/i686/multiarch/memchr-sse2.S')
-rw-r--r--sysdeps/i386/i686/multiarch/memchr-sse2.S12
1 files changed, 8 insertions, 4 deletions
diff --git a/sysdeps/i386/i686/multiarch/memchr-sse2.S b/sysdeps/i386/i686/multiarch/memchr-sse2.S
index 83930b7d38..303242ceee 100644
--- a/sysdeps/i386/i686/multiarch/memchr-sse2.S
+++ b/sysdeps/i386/i686/multiarch/memchr-sse2.S
@@ -1,5 +1,5 @@
/* Optimized memchr with sse2 without bsf
- Copyright (C) 2011-2016 Free Software Foundation, Inc.
+ Copyright (C) 2011-2018 Free Software Foundation, Inc.
Contributed by Intel Corporation.
This file is part of the GNU C Library.
@@ -117,9 +117,13 @@ L(crosscache):
# ifndef USE_AS_RAWMEMCHR
jnz L(match_case2_prolog1)
- lea -16(%edx), %edx
- add %ecx, %edx
- jle L(return_null)
+ /* "ecx" is less than 16. Calculate "edx + ecx - 16" by using
+ "edx - (16 - ecx)" instead of "(edx + ecx) - 16" to void
+ possible addition overflow. */
+ neg %ecx
+ add $16, %ecx
+ sub %ecx, %edx
+ jbe L(return_null)
lea 16(%edi), %edi
# else
jnz L(match_case1_prolog1)