public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
* [PATCH, ARM] Fix minor issues in memchr NEON implementation
@ 2017-06-02 10:23 Prakhar Bahuguna
  2017-06-07 10:16 ` Corinna Vinschen
  0 siblings, 1 reply; 2+ messages in thread
From: Prakhar Bahuguna @ 2017-06-02 10:23 UTC (permalink / raw)
  To: newlib; +Cc: nd

[-- Attachment #1: Type: text/plain, Size: 477 bytes --]

The NEON-optimised implementation of memchr has a couple of minor issues - it
does not mask off the higher bits of the input character, and it uses a signed
comparison instead of unsigned within the smallstr loop. This patch addresses
both of these issues.

ChangeLog:

2017-06-02  Prakhar Bahuguna  <prakhar.bahuguna@arm.com>

	* libc/machine/arm/memchr.S: Add and instruction to mask off all but
	the lowest byte.
	Change blt to blo.

Okay for master?

-- 

Prakhar Bahuguna

[-- Attachment #2: 0001-Fix-minor-issues-in-memchr-NEON-implementation.patch --]
[-- Type: text/plain, Size: 924 bytes --]

From ac13527b4d7a5f91088920c59bc53b0a771858e1 Mon Sep 17 00:00:00 2001
From: Prakhar Bahuguna <prakhar.bahuguna@arm.com>
Date: Fri, 2 Jun 2017 10:22:32 +0100
Subject: [PATCH] Fix minor issues in memchr NEON implementation

---
 newlib/libc/machine/arm/memchr.S | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/newlib/libc/machine/arm/memchr.S b/newlib/libc/machine/arm/memchr.S
index b5dcf83c0..7c22b117e 100644
--- a/newlib/libc/machine/arm/memchr.S
+++ b/newlib/libc/machine/arm/memchr.S
@@ -135,10 +135,11 @@ memchr:
 	/* Use a simple loop if there are less than 8 bytes to search.  */
 	cmp	cntin, #7
 	bhi	.Llargestr
+	and	chrin, chrin, #0xff
 
 .Lsmallstr:
 	subs	cntin, cntin, #1
-	blt	.Lnotfound	/* Return not found if reached end.  */
+	blo	.Lnotfound	/* Return not found if reached end.  */
 	ldrb	tmp, [srcin], #1
 	cmp	tmp, chrin
 	bne	.Lsmallstr	/* Loop again if not found.  */
-- 
2.13.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH, ARM] Fix minor issues in memchr NEON implementation
  2017-06-02 10:23 [PATCH, ARM] Fix minor issues in memchr NEON implementation Prakhar Bahuguna
@ 2017-06-07 10:16 ` Corinna Vinschen
  0 siblings, 0 replies; 2+ messages in thread
From: Corinna Vinschen @ 2017-06-07 10:16 UTC (permalink / raw)
  To: newlib

[-- Attachment #1: Type: text/plain, Size: 629 bytes --]

On Jun  2 11:22, Prakhar Bahuguna wrote:
> The NEON-optimised implementation of memchr has a couple of minor issues - it
> does not mask off the higher bits of the input character, and it uses a signed
> comparison instead of unsigned within the smallstr loop. This patch addresses
> both of these issues.
> 
> ChangeLog:
> 
> 2017-06-02  Prakhar Bahuguna  <prakhar.bahuguna@arm.com>
> 
> 	* libc/machine/arm/memchr.S: Add and instruction to mask off all but
> 	the lowest byte.
> 	Change blt to blo.
> 
> Okay for master?

Yes, pushed.


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-06-07 10:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-02 10:23 [PATCH, ARM] Fix minor issues in memchr NEON implementation Prakhar Bahuguna
2017-06-07 10:16 ` Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).