[PATCH v2] x86-64: Use 32-bit zero idiom for shorter encoding

Florian Weimer fweimer@redhat.com
Mon Feb 9 08:41:31 GMT 2026


* George Hu:

> 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.
> ---
>  sysdeps/mach/hurd/x86_64/static-start.S          | 2 +-
>  sysdeps/mach/hurd/x86_64/tst-sig-redzone.c       | 2 +-
>  sysdeps/x86_64/multiarch/strcat-sse2-unaligned.S | 2 +-
>  sysdeps/x86_64/multiarch/strchr-sse2-no-bsf.S    | 2 +-
>  sysdeps/x86_64/multiarch/strcpy-sse2-unaligned.S | 4 ++--
>  sysdeps/x86_64/multiarch/strlen-sse2.S           | 2 +-
>  sysdeps/x86_64/multiarch/wcschr-sse2.S           | 2 +-
>  sysdeps/x86_64/multiarch/wcscmp-sse2.S           | 2 +-
>  8 files changed, 9 insertions(+), 9 deletions(-)

Ideally, the changes to the string routines which are not at the very
end of functions would come with some analysis or benchmarking to show
that there is no performance impact due to alignment of loops.

Thanks,
Florian



More information about the Libc-alpha mailing list