[hurd,commited] x86-64: Use 32-bit zero idiom for shorter encoding

Samuel Thibault samuel.thibault@ens-lyon.org
Mon Feb 9 19:23:35 GMT 2026


From: George Hu <integral@archlinux.org>

Replace the 64-bit zero idiom with the 32-bit form. In 64-bit mode,
zeroing the lower 32 bits of a GPR implicitly clears the entire
register. The 32-bit encoding is one byte shorter while preserving
identical semantics.

Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 sysdeps/mach/hurd/x86_64/static-start.S    | 2 +-
 sysdeps/mach/hurd/x86_64/tst-sig-redzone.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sysdeps/mach/hurd/x86_64/static-start.S b/sysdeps/mach/hurd/x86_64/static-start.S
index ec9c50239e..d670d45210 100644
--- a/sysdeps/mach/hurd/x86_64/static-start.S
+++ b/sysdeps/mach/hurd/x86_64/static-start.S
@@ -27,7 +27,7 @@ _start:
 
 	movq %rsp, %rdi
 	call _hurd_stack_setup
-	xorq %rdx, %rdx
+	xorl %edx, %edx
 	jmp _start1
 
 #define _start _start1
diff --git a/sysdeps/mach/hurd/x86_64/tst-sig-redzone.c b/sysdeps/mach/hurd/x86_64/tst-sig-redzone.c
index 32c7ab90f4..24b510c0aa 100644
--- a/sysdeps/mach/hurd/x86_64/tst-sig-redzone.c
+++ b/sysdeps/mach/hurd/x86_64/tst-sig-redzone.c
@@ -103,7 +103,7 @@ asm (
 "repe	scasq\n"
 "	jne	fail\n"
 
-"	xor	%rax,%rax\n"
+"	xor	%eax,%eax\n"
 "	ret\n"
 "fail:\n"
 "	movq	$1,%rax\n"
-- 
2.51.0



More information about the Libc-alpha mailing list