From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20993 invoked by alias); 12 Mar 2013 17:08:33 -0000 Received: (qmail 20978 invoked by uid 22791); 12 Mar 2013 17:08:30 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,TW_CB,TW_DR,TW_XF X-Spam-Check-By: sourceware.org Received: from toast.topped-with-meat.com (HELO topped-with-meat.com) (204.197.218.159) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 12 Mar 2013 17:08:14 +0000 Received: by topped-with-meat.com (Postfix, from userid 5281) id 10BD22C074; Tue, 12 Mar 2013 10:08:14 -0700 (PDT) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit From: Roland McGrath To: "Joseph S. Myers" Cc: Richard Henderson , Subject: [PATCH 2/2 roland/arm-memchr] ARM: Make armv6t2 memchr implementation usable without Thumb. In-Reply-To: Joseph S. Myers's message of Tuesday, 12 March 2013 15:58:09 +0000 References: <20130311233120.C2F1B2C083@topped-with-meat.com> <513EC685.1020803@twiddle.net> Message-Id: <20130312170814.10BD22C074@topped-with-meat.com> Date: Tue, 12 Mar 2013 17:08:00 -0000 X-CMAE-Score: 0 X-CMAE-Analysis: v=2.1 cv=LYSvtFvi c=1 sm=1 tr=0 a=WkljmVdYkabdwxfqvArNOQ==:117 a=14OXPxybAAAA:8 a=JCm5hV_9LGMA:10 a=Z6MIti7PxpgA:10 a=kj9zAlcOel0A:10 a=hOe2yjtxAAAA:8 a=Yq6XFD40IeMA:10 a=HzncNHhRjYCLl_hpIdEA:9 a=8ttTW0v9Cs_Q071R:21 a=OYmBLk58OxVYwmW5:21 a=CjuIK1q_8ugA:10 X-IsSubscribed: yes Mailing-List: contact libc-ports-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: libc-ports-owner@sourceware.org X-SW-Source: 2013-03/txt/msg00116.txt.bz2 ports/ChangeLog.arm * sysdeps/arm/armv6t2/memchr.S [NO_THUMB]: Use .arm rather than .thumb, .thumb_func. Avoid cbz/cnbz instructions. --- a/ports/sysdeps/arm/armv6t2/memchr.S +++ b/ports/sysdeps/arm/armv6t2/memchr.S @@ -42,10 +42,12 @@ .syntax unified .text +#ifdef NO_THUMB + .arm +#else .thumb - -@ --------------------------------------------------------------------------- .thumb_func +#endif .global memchr .type memchr,%function ENTRY(memchr) @@ -89,14 +91,22 @@ ENTRY(memchr) 15: ldrd r4,r5, [r0],#8 +#ifndef NO_THUMB subs r6, r6, #8 +#endif eor r4,r4, r1 @ Get it so that r4,r5 have 00's where the bytes match the target eor r5,r5, r1 uadd8 r4, r4, r7 @ Parallel add 0xff - sets the GE bits for anything that wasn't 0 sel r4, r3, r7 @ bytes are 00 for none-00 bytes, or ff for 00 bytes - NOTE INVERSION uadd8 r5, r5, r7 @ Parallel add 0xff - sets the GE bits for anything that wasn't 0 sel r5, r4, r7 @ chained....bytes are 00 for none-00 bytes, or ff for 00 bytes - NOTE INVERSION +#ifndef NO_THUMB cbnz r5, 60f +#else + cmp r5, #0 + bne 60f + subs r6, r6, #8 +#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 +120,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: