diff mbox series

[v1,3/4] x86: Use `testb` for case-locale check in str{n}casecmp-sse42

Message ID 20221020021338.3394281-3-goldstein.w.n@gmail.com
State New
Headers show
Series [v1,1/4] x86: Use `testb` for case-locale check in str{n}casecmp-avx2 | expand

Commit Message

Noah Goldstein Oct. 20, 2022, 2:13 a.m. UTC
`testb` saves a bit of code size is the imm-operand can be encoded
1-bytes.

Tested on x86-64.
---
 sysdeps/x86_64/multiarch/strcmp-sse4_2.S | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

H.J. Lu Oct. 20, 2022, 5:03 p.m. UTC | #1
On Wed, Oct 19, 2022 at 7:14 PM Noah Goldstein <goldstein.w.n@gmail.com> wrote:
>
> `testb` saves a bit of code size is the imm-operand can be encoded
> 1-bytes.
>
> Tested on x86-64.
> ---
>  sysdeps/x86_64/multiarch/strcmp-sse4_2.S | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/sysdeps/x86_64/multiarch/strcmp-sse4_2.S b/sysdeps/x86_64/multiarch/strcmp-sse4_2.S
> index dc6fc90e14..6b540ff894 100644
> --- a/sysdeps/x86_64/multiarch/strcmp-sse4_2.S
> +++ b/sysdeps/x86_64/multiarch/strcmp-sse4_2.S
> @@ -119,7 +119,7 @@ STRCMP:
>  #  else
>         mov     (%rdx), %RAX_LP
>  #  endif
> -       testl   $1, LOCALE_DATA_VALUES+_NL_CTYPE_NONASCII_CASE*SIZEOF_VALUES(%rax)
> +       testb   $1, LOCALE_DATA_VALUES+_NL_CTYPE_NONASCII_CASE*SIZEOF_VALUES(%rax)
>         jne     __strcasecmp_l_nonascii
>  # endif
>  # ifdef USE_AS_STRNCASECMP_L
> @@ -130,7 +130,7 @@ STRCMP:
>  #  else
>         mov     (%rcx), %RAX_LP
>  #  endif
> -       testl   $1, LOCALE_DATA_VALUES+_NL_CTYPE_NONASCII_CASE*SIZEOF_VALUES(%rax)
> +       testb   $1, LOCALE_DATA_VALUES+_NL_CTYPE_NONASCII_CASE*SIZEOF_VALUES(%rax)
>         jne     __strncasecmp_l_nonascii
>  # endif
>
> --
> 2.34.1
>

LGTM.

Thanks.
diff mbox series

Patch

diff --git a/sysdeps/x86_64/multiarch/strcmp-sse4_2.S b/sysdeps/x86_64/multiarch/strcmp-sse4_2.S
index dc6fc90e14..6b540ff894 100644
--- a/sysdeps/x86_64/multiarch/strcmp-sse4_2.S
+++ b/sysdeps/x86_64/multiarch/strcmp-sse4_2.S
@@ -119,7 +119,7 @@  STRCMP:
 #  else
 	mov	(%rdx), %RAX_LP
 #  endif
-	testl	$1, LOCALE_DATA_VALUES+_NL_CTYPE_NONASCII_CASE*SIZEOF_VALUES(%rax)
+	testb	$1, LOCALE_DATA_VALUES+_NL_CTYPE_NONASCII_CASE*SIZEOF_VALUES(%rax)
 	jne	__strcasecmp_l_nonascii
 # endif
 # ifdef USE_AS_STRNCASECMP_L
@@ -130,7 +130,7 @@  STRCMP:
 #  else
 	mov	(%rcx), %RAX_LP
 #  endif
-	testl	$1, LOCALE_DATA_VALUES+_NL_CTYPE_NONASCII_CASE*SIZEOF_VALUES(%rax)
+	testb	$1, LOCALE_DATA_VALUES+_NL_CTYPE_NONASCII_CASE*SIZEOF_VALUES(%rax)
 	jne	__strncasecmp_l_nonascii
 # endif