From: H.J. Lu Date: Fri, 22 Apr 2022 17:53:13 +0000 (-0700) Subject: x86-64: Fix SSE2 memcmp and SSSE3 memmove for x32 X-Git-Tag: glibc-2.36~350 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8ea20ee5f6145de4bff9481d3e09ac36ba9df8f3;p=thirdparty%2Fglibc.git x86-64: Fix SSE2 memcmp and SSSE3 memmove for x32 Clear the upper 32 bits in RDX (memory size) for x32 to fix FAIL: string/tst-size_t-memcmp FAIL: string/tst-size_t-memcmp-2 FAIL: string/tst-size_t-memcpy FAIL: wcsmbs/tst-size_t-wmemcmp on x32 introduced by 8804157ad9 x86: Optimize memcmp SSE2 in memcmp.S 26b2478322 x86: Reduce code size of mem{move|pcpy|cpy}-ssse3 Reviewed-by: Noah Goldstein --- diff --git a/sysdeps/x86_64/memcmp.S b/sysdeps/x86_64/memcmp.S index b1536940482..5718a7da862 100644 --- a/sysdeps/x86_64/memcmp.S +++ b/sysdeps/x86_64/memcmp.S @@ -46,6 +46,10 @@ .text ENTRY(MEMCMP) +# ifdef __ILP32__ + /* Clear the upper 32 bits. */ + movl %edx, %edx +# endif #ifdef USE_AS_WMEMCMP /* Use 0xffff to test for mismatches on pmovmskb bitmask. Store in ecx for code size. This is preferable to using `incw` as diff --git a/sysdeps/x86_64/multiarch/memmove-ssse3.S b/sysdeps/x86_64/multiarch/memmove-ssse3.S index 215583e7bdf..310ff62b86d 100644 --- a/sysdeps/x86_64/multiarch/memmove-ssse3.S +++ b/sysdeps/x86_64/multiarch/memmove-ssse3.S @@ -27,6 +27,10 @@ ENTRY(MEMMOVE_CHK) END(MEMMOVE_CHK) ENTRY_P2ALIGN(MEMMOVE, 6) +# ifdef __ILP32__ + /* Clear the upper 32 bits. */ + movl %edx, %edx +# endif movq %rdi, %rax L(start): cmpq $16, %rdx