x86_64: Use %xmmN with vpxor to clear a vector register

Message ID 20200611194458.216184-1-hjl.tools@gmail.com
State New
Headers show
Series
  • x86_64: Use %xmmN with vpxor to clear a vector register
Related show

Commit Message

Siddhesh Poyarekar via Libc-alpha June 11, 2020, 7:44 p.m.
Since "vpxor %xmmN, %xmmN, %xmmN" clears the whole vector register, use
%xmmN, instead of %ymmN, with vpxor to clear a vector register.
---
 sysdeps/x86_64/multiarch/strcmp-avx2.S  | 4 ++--
 sysdeps/x86_64/multiarch/strrchr-avx2.S | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

-- 
2.26.2

Comments

Siddhesh Poyarekar via Libc-alpha June 17, 2020, 12:28 p.m. | #1
On Thu, Jun 11, 2020 at 12:44 PM H.J. Lu <hjl.tools@gmail.com> wrote:
>

> Since "vpxor %xmmN, %xmmN, %xmmN" clears the whole vector register, use

> %xmmN, instead of %ymmN, with vpxor to clear a vector register.

> ---

>  sysdeps/x86_64/multiarch/strcmp-avx2.S  | 4 ++--

>  sysdeps/x86_64/multiarch/strrchr-avx2.S | 2 +-

>  2 files changed, 3 insertions(+), 3 deletions(-)

>

> diff --git a/sysdeps/x86_64/multiarch/strcmp-avx2.S b/sysdeps/x86_64/multiarch/strcmp-avx2.S

> index 48d03a9f46..5f88a68262 100644

> --- a/sysdeps/x86_64/multiarch/strcmp-avx2.S

> +++ b/sysdeps/x86_64/multiarch/strcmp-avx2.S

> @@ -91,8 +91,8 @@ ENTRY (STRCMP)

>  # endif

>         movl    %edi, %eax

>         xorl    %edx, %edx

> -       /* Make %ymm7 all zeros in this function.  */

> -       vpxor   %ymm7, %ymm7, %ymm7

> +       /* Make %xmm7 (%ymm7) all zeros in this function.  */

> +       vpxor   %xmm7, %xmm7, %xmm7

>         orl     %esi, %eax

>         andl    $(PAGE_SIZE - 1), %eax

>         cmpl    $(PAGE_SIZE - (VEC_SIZE * 4)), %eax

> diff --git a/sysdeps/x86_64/multiarch/strrchr-avx2.S b/sysdeps/x86_64/multiarch/strrchr-avx2.S

> index 23077b4c45..146bdd51d0 100644

> --- a/sysdeps/x86_64/multiarch/strrchr-avx2.S

> +++ b/sysdeps/x86_64/multiarch/strrchr-avx2.S

> @@ -44,7 +44,7 @@ ENTRY (STRRCHR)

>         movl    %edi, %ecx

>         /* Broadcast CHAR to YMM4.  */

>         VPBROADCAST %xmm4, %ymm4

> -       vpxor   %ymm0, %ymm0, %ymm0

> +       vpxor   %xmm0, %xmm0, %xmm0

>

>         /* Check if we may cross page boundary with one vector load.  */

>         andl    $(2 * VEC_SIZE - 1), %ecx

> --

> 2.26.2

>


I am checking it in.

-- 
H.J.

Patch

diff --git a/sysdeps/x86_64/multiarch/strcmp-avx2.S b/sysdeps/x86_64/multiarch/strcmp-avx2.S
index 48d03a9f46..5f88a68262 100644
--- a/sysdeps/x86_64/multiarch/strcmp-avx2.S
+++ b/sysdeps/x86_64/multiarch/strcmp-avx2.S
@@ -91,8 +91,8 @@  ENTRY (STRCMP)
 # endif
 	movl	%edi, %eax
 	xorl	%edx, %edx
-	/* Make %ymm7 all zeros in this function.  */
-	vpxor	%ymm7, %ymm7, %ymm7
+	/* Make %xmm7 (%ymm7) all zeros in this function.  */
+	vpxor	%xmm7, %xmm7, %xmm7
 	orl	%esi, %eax
 	andl	$(PAGE_SIZE - 1), %eax
 	cmpl	$(PAGE_SIZE - (VEC_SIZE * 4)), %eax
diff --git a/sysdeps/x86_64/multiarch/strrchr-avx2.S b/sysdeps/x86_64/multiarch/strrchr-avx2.S
index 23077b4c45..146bdd51d0 100644
--- a/sysdeps/x86_64/multiarch/strrchr-avx2.S
+++ b/sysdeps/x86_64/multiarch/strrchr-avx2.S
@@ -44,7 +44,7 @@  ENTRY (STRRCHR)
 	movl	%edi, %ecx
 	/* Broadcast CHAR to YMM4.  */
 	VPBROADCAST %xmm4, %ymm4
-	vpxor	%ymm0, %ymm0, %ymm0
+	vpxor	%xmm0, %xmm0, %xmm0
 
 	/* Check if we may cross page boundary with one vector load.  */
 	andl	$(2 * VEC_SIZE - 1), %ecx