[AArch64] Fix issue with dst bias in memset

Message ID DB5PR08MB103019058A406665BF08BCB883C50@DB5PR08MB1030.eurprd08.prod.outlook.com
State New
Headers show
Series
  • [AArch64] Fix issue with dst bias in memset
Related show

Commit Message

Wilco Dijkstra Nov. 8, 2018, 3:50 p.m.
This patch fixes an issue in the previous memset loop change. If the
zva size is >= 256 and there are more than 64 bytes left, we could enter
the loop and thus need to rebias dst by 32 as well.

Since no known CPUs use this size this can't be tested natively, so I've
tested it on a simulator initialized with a large zva size.

--

Comments

Richard Earnshaw (lists) Nov. 8, 2018, 4:46 p.m. | #1
On 08/11/2018 15:50, Wilco Dijkstra wrote:
> This patch fixes an issue in the previous memset loop change. If the

> zva size is >= 256 and there are more than 64 bytes left, we could enter

> the loop and thus need to rebias dst by 32 as well.

> 

> Since no known CPUs use this size this can't be tested natively, so I've

> tested it on a simulator initialized with a large zva size.

> 

> --

> 

> diff --git a/newlib/libc/machine/aarch64/memset.S b/newlib/libc/machine/aarch64/memset.S

> index 7c8fe583bf88722d73b90ec470c72b509e5be137..103e3f8bb0f20a5d02578f2379620687eae10a52 100644

> --- a/newlib/libc/machine/aarch64/memset.S

> +++ b/newlib/libc/machine/aarch64/memset.S

> @@ -233,6 +233,7 @@ L(zva_other):

>  	subs	count, count, zva_len

>  	b.hs	3b

>  4:	add	count, count, zva_len

> +	sub	dst, dst, 32		/* Bias dst for tail loop.  */

>  	b	L(tail64)

>  

>  	.size	memset, . - memset

> 



Pushed

Patch

diff --git a/newlib/libc/machine/aarch64/memset.S b/newlib/libc/machine/aarch64/memset.S
index 7c8fe583bf88722d73b90ec470c72b509e5be137..103e3f8bb0f20a5d02578f2379620687eae10a52 100644
--- a/newlib/libc/machine/aarch64/memset.S
+++ b/newlib/libc/machine/aarch64/memset.S
@@ -233,6 +233,7 @@  L(zva_other):
 	subs	count, count, zva_len
 	b.hs	3b
 4:	add	count, count, zva_len
+	sub	dst, dst, 32		/* Bias dst for tail loop.  */
 	b	L(tail64)
 
 	.size	memset, . - memset