diff mbox series

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

Message ID 20221020021338.3394281-1-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-avx2.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

H.J. Lu Oct. 20, 2022, 5:02 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-avx2.S | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sysdeps/x86_64/multiarch/strcmp-avx2.S b/sysdeps/x86_64/multiarch/strcmp-avx2.S
> index 4c01d664e8..a24f886a27 100644
> --- a/sysdeps/x86_64/multiarch/strcmp-avx2.S
> +++ b/sysdeps/x86_64/multiarch/strcmp-avx2.S
> @@ -214,7 +214,7 @@ STRCMP:
>  #  else
>         mov     (%LOCALE_REG), %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
>         leaq    _nl_C_LC_CTYPE_tolower + 128 * 4(%rip), TOLOWER_BASE
>  # endif
> --
> 2.34.1
>

LGTM.

Thanks.
diff mbox series

Patch

diff --git a/sysdeps/x86_64/multiarch/strcmp-avx2.S b/sysdeps/x86_64/multiarch/strcmp-avx2.S
index 4c01d664e8..a24f886a27 100644
--- a/sysdeps/x86_64/multiarch/strcmp-avx2.S
+++ b/sysdeps/x86_64/multiarch/strcmp-avx2.S
@@ -214,7 +214,7 @@  STRCMP:
 #  else
 	mov	(%LOCALE_REG), %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
 	leaq	_nl_C_LC_CTYPE_tolower + 128 * 4(%rip), TOLOWER_BASE
 # endif