From: Prakhar Bahuguna <prakhar.bahuguna@arm.com>
To: newlib@sourceware.org
Cc: nd@arm.com
Subject: [PATCH, ARM] Fix minor issues in memchr NEON implementation
Date: Fri, 02 Jun 2017 10:23:00 -0000 [thread overview]
Message-ID: <20170602102256.eyeslc2gyznswpvl@e107464-lin.cambridge.arm.com> (raw)
[-- 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
next reply other threads:[~2017-06-02 10:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-02 10:23 Prakhar Bahuguna [this message]
2017-06-07 10:16 ` Corinna Vinschen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170602102256.eyeslc2gyznswpvl@e107464-lin.cambridge.arm.com \
--to=prakhar.bahuguna@arm.com \
--cc=nd@arm.com \
--cc=newlib@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).