diff mbox series

[v1,4/4] x86: Use `testb` for FSRM check in memmove-vec-unaligned-erms

Message ID 20221020021338.3394281-4-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/memmove-vec-unaligned-erms.S | 4 ++++
 1 file changed, 4 insertions(+)

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/memmove-vec-unaligned-erms.S | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S b/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S
> index 5b758cae5e..f6d7f3e88b 100644
> --- a/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S
> +++ b/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S
> @@ -616,7 +616,11 @@ L(movsb):
>         jae     L(large_memcpy_2x_check)
>  # if AVOID_SHORT_DISTANCE_REP_MOVSB || ALIGN_MOVSB
>         /* Only avoid short movsb if CPU has FSRM.  */
> +#  if X86_STRING_CONTROL_AVOID_SHORT_DISTANCE_REP_MOVSB < 256
> +       testb   $X86_STRING_CONTROL_AVOID_SHORT_DISTANCE_REP_MOVSB, __x86_string_control(%rip)
> +#  else
>         testl   $X86_STRING_CONTROL_AVOID_SHORT_DISTANCE_REP_MOVSB, __x86_string_control(%rip)
> +#  endif
>         jz      L(skip_short_movsb_check)
>  #  if AVOID_SHORT_DISTANCE_REP_MOVSB
>         /* Avoid "rep movsb" if RCX, the distance between source and
> --
> 2.34.1
>

LGTM.

Thanks.
diff mbox series

Patch

diff --git a/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S b/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S
index 5b758cae5e..f6d7f3e88b 100644
--- a/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S
+++ b/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S
@@ -616,7 +616,11 @@  L(movsb):
 	jae	L(large_memcpy_2x_check)
 # if AVOID_SHORT_DISTANCE_REP_MOVSB || ALIGN_MOVSB
 	/* Only avoid short movsb if CPU has FSRM.  */
+#  if X86_STRING_CONTROL_AVOID_SHORT_DISTANCE_REP_MOVSB < 256
+	testb	$X86_STRING_CONTROL_AVOID_SHORT_DISTANCE_REP_MOVSB, __x86_string_control(%rip)
+#  else
 	testl	$X86_STRING_CONTROL_AVOID_SHORT_DISTANCE_REP_MOVSB, __x86_string_control(%rip)
+#  endif
 	jz	L(skip_short_movsb_check)
 #  if AVOID_SHORT_DISTANCE_REP_MOVSB
 	/* Avoid "rep movsb" if RCX, the distance between source and