This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch roland/arm-memchr created. glibc-2.17-378-g7a5fc99


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, roland/arm-memchr has been created
        at  7a5fc99cd1ddf2ab079ae9385b9be6b62cd0157d (commit)

- Log -----------------------------------------------------------------
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=7a5fc99cd1ddf2ab079ae9385b9be6b62cd0157d

commit 7a5fc99cd1ddf2ab079ae9385b9be6b62cd0157d
Author: Roland McGrath <roland@hack.frob.com>
Date:   Mon Mar 11 15:33:38 2013 -0700

    unfinished

diff --git a/ports/sysdeps/arm/armv6t2/memchr.S b/ports/sysdeps/arm/armv6t2/memchr.S
index 6d35f47..9754bbd 100644
--- a/ports/sysdeps/arm/armv6t2/memchr.S
+++ b/ports/sysdeps/arm/armv6t2/memchr.S
@@ -16,6 +16,7 @@
    License along with the GNU C Library.  If not, see
    <http://www.gnu.org/licenses/>.  */
 
+#define NO_THUMB
 #include <sysdep.h>
 
 @ This memchr routine is optimised on a Cortex-A9 and should work on all ARMv7
@@ -41,11 +42,15 @@
 #endif
 	.syntax unified
 
+#define NDWREG r6
+#define PAIR0 r4
+#define PAIR1 r5
+
 	.text
+#ifndef NO_THUMB
 	.thumb
-
-@ ---------------------------------------------------------------------------
 	.thumb_func
+#endif
 	.global memchr
 	.type memchr,%function
 ENTRY(memchr)
@@ -83,20 +88,27 @@ ENTRY(memchr)
 
 	orr	r1, r1, r1, lsl #8	@ expand the match word across to all bytes
 	orr	r1, r1, r1, lsl #16
-	bic	r4, r2, #7	@ Number of double words to work with * 8
+	bic	NDWREG, r2, #7	@ Number of double words to work with * 8
 	mvns	r7, #0		@ all F's
 	movs	r3, #0
 
 15:
-	ldrd 	r5,r6, [r0],#8
-	subs	r4, r4, #8
-	eor	r5,r5, r1	@ Get it so that r5,r6 have 00's where the bytes match the target
-	eor	r6,r6, r1
-	uadd8	r5, r5, r7	@ Parallel add 0xff - sets the GE bits for anything that wasn't 0
-	sel	r5, r3, r7	@ bytes are 00 for none-00 bytes, or ff for 00 bytes - NOTE INVERSION
-	uadd8	r6, r6, r7	@ Parallel add 0xff - sets the GE bits for anything that wasn't 0
-	sel	r6, r5, r7	@ chained....bytes are 00 for none-00 bytes, or ff for 00 bytes - NOTE INVERSION
-	cbnz	r6, 60f
+	ldrd 	PAIR0,PAIR1, [r0],#8
+#ifndef NO_THUMB
+	subs	NDWREG, NDWREG, #8
+#endif
+	eor	PAIR0,PAIR0, r1	@ Get it so that PAIR0,PAIR1 have 00's where the bytes match the target
+	eor	PAIR1,PAIR1, r1
+	uadd8	PAIR0, PAIR0, r7	@ Parallel add 0xff - sets the GE bits for anything that wasn't 0
+	sel	PAIR0, r3, r7	@ bytes are 00 for none-00 bytes, or ff for 00 bytes - NOTE INVERSION
+	uadd8	PAIR1, PAIR1, r7	@ Parallel add 0xff - sets the GE bits for anything that wasn't 0
+	sel	PAIR1, PAIR0, r7	@ chained....bytes are 00 for none-00 bytes, or ff for 00 bytes - NOTE INVERSION
+#ifndef NO_THUMB
+	cbnz	PAIR1, 60f
+#else
+	cmp	PAIR1, #0
+	bne	60f
+#endif
 	bne	15b		@ (Flags from the subs above) If not run out of bytes then go around again
 
 	pop	{r4,r5,r6,r7}
@@ -110,13 +122,24 @@ ENTRY(memchr)
 	and	r2,r2,#7	@ Leave the count remaining as the number after the double words have been done
 
 20:
+#ifndef NO_THUMB
 	cbz	r2, 40f		@ 0 length or hit the end already then not found
+#else
+	cmp	r2, #0
+	beq	40f
+#endif
 
 21:  @ Post aligned section, or just a short call
 	ldrb	r3,[r0],#1
+#ifndef NO_THUMB
 	subs	r2,r2,#1
 	eor	r3,r3,r1	@ r3 = 0 if match - doesn't break flags from sub
 	cbz	r3, 50f
+#else
+	eors	r3, r3, r1
+	beq	50f
+	subs	r2, r2, #1
+#endif
 	bne	21b		@ on r2 flags
 
 40:
@@ -129,22 +152,22 @@ ENTRY(memchr)
 
 60:  @ We're here because the fast path found a hit - now we have to track down exactly which word it was
      @ r0 points to the start of the double word after the one that was tested
-     @ r5 has the 00/ff pattern for the first word, r6 has the chained value
+     @ PAIR0 has the 00/ff pattern for the first word, PAIR1 has the chained value
 	cfi_restore_state
-	cmp	r5, #0
+	cmp	PAIR0, #0
 	itte	eq
-	moveq	r5, r6		@ the end is in the 2nd word
+	moveq	PAIR0, PAIR1		@ the end is in the 2nd word
 	subeq	r0,r0,#3	@ Points to 2nd byte of 2nd word
 	subne	r0,r0,#7	@ or 2nd byte of 1st word
 
 	@ r0 currently points to the 2nd byte of the word containing the hit
-	tst	r5, # CHARTSTMASK(0)	@ 1st character
+	tst	PAIR0, # CHARTSTMASK(0)	@ 1st character
 	bne	61f
 	adds	r0,r0,#1
-	tst	r5, # CHARTSTMASK(1)	@ 2nd character
+	tst	PAIR0, # CHARTSTMASK(1)	@ 2nd character
 	ittt	eq
 	addeq	r0,r0,#1
-	tsteq	r5, # (3<<15)		@ 2nd & 3rd character
+	tsteq	PAIR0, # (3<<15)		@ 2nd & 3rd character
 	@ If not the 3rd must be the last one
 	addeq	r0,r0,#1
 

-----------------------------------------------------------------------


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]