public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] x86-64: Fix SSE2 memcmp and SSSE3 memmove for x32
@ 2022-04-22 17:58 H.J. Lu
  2022-04-22 18:06 ` Noah Goldstein
  0 siblings, 1 reply; 3+ messages in thread
From: H.J. Lu @ 2022-04-22 17:58 UTC (permalink / raw)
  To: libc-alpha

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
---
 sysdeps/x86_64/memcmp.S                  | 4 ++++
 sysdeps/x86_64/multiarch/memmove-ssse3.S | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/sysdeps/x86_64/memcmp.S b/sysdeps/x86_64/memcmp.S
index b153694048..5718a7da86 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 215583e7bd..310ff62b86 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
-- 
2.35.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-05-12 20:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-22 17:58 [PATCH] x86-64: Fix SSE2 memcmp and SSSE3 memmove for x32 H.J. Lu
2022-04-22 18:06 ` Noah Goldstein
2022-05-12 20:12   ` Sunil Pandey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).