From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/8691 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: [PATCH] convert arm memcpy asm to UAL, remove .word hacks Date: Sun, 18 Oct 2015 20:17:43 -0400 Message-ID: <20151019001743.GA4363@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="LZvS9be/3tNcYl/X" X-Trace: ger.gmane.org 1445213887 10031 80.91.229.3 (19 Oct 2015 00:18:07 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 19 Oct 2015 00:18:07 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-8703-gllmg-musl=m.gmane.org@lists.openwall.com Mon Oct 19 02:18:07 2015 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1Zny9N-0001LP-Qf for gllmg-musl@m.gmane.org; Mon, 19 Oct 2015 02:18:05 +0200 Original-Received: (qmail 10075 invoked by uid 550); 19 Oct 2015 00:18:01 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 9967 invoked from network); 19 Oct 2015 00:17:56 -0000 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:8691 Archived-At: --LZvS9be/3tNcYl/X Content-Type: text/plain; charset=us-ascii Content-Disposition: inline I've found that, contrary to the message in commit 9367fe926196f407705bb07cd29c6e40eb1774dd, all relevant gas versions actually do support .syntax unified, and assemble memcpy.s successfully with the attached patch applied. If there are no objections I'd like to go ahead and commit it. The only remaining .word hacks I'm aware of are in setjmp and longjmp, but they may still be needed to avoid wrongly flagging plain EABI (softfloat) binaries as needing hardfloat. I'd really like some feedback on what the issues with that are and how to best avoid problems. Hopefully we can make the transition to UAL syntax quickly in the next release cycle and get Cortex-M support (with the new ARM FDPIC ABI). Rich --LZvS9be/3tNcYl/X Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="arm-ual1.diff" diff --git a/src/string/armel/memcpy.s b/src/string/armel/memcpy.s index 9c5e38d..5416403 100644 --- a/src/string/armel/memcpy.s +++ b/src/string/armel/memcpy.s @@ -42,6 +42,8 @@ * of prefetch code that is not compatible with older cpus. */ +.syntax unified + .global memcpy .type memcpy,%function memcpy: @@ -73,12 +75,12 @@ memcpy: */ movs r12, r3, lsl #31 sub r2, r2, r3 /* we know that r3 <= r2 because r2 >= 4 */ - .word 0x44d13001 /* ldrbmi r3, [r1], #1 */ - .word 0x24d14001 /* ldrbcs r4, [r1], #1 */ - .word 0x24d1c001 /* ldrbcs r12,[r1], #1 */ - .word 0x44c03001 /* strbmi r3, [r0], #1 */ - .word 0x24c04001 /* strbcs r4, [r0], #1 */ - .word 0x24c0c001 /* strbcs r12,[r0], #1 */ + ldrbmi r3, [r1], #1 + ldrbcs r4, [r1], #1 + ldrbcs r12,[r1], #1 + strbmi r3, [r0], #1 + strbcs r4, [r0], #1 + strbcs r12,[r0], #1 src_aligned: @@ -177,12 +179,12 @@ less_than_32_left: stmmi r0!, {r8, r9} movs r12, r2, lsl #30 ldrcs r3, [r1], #4 /* 4 bytes */ - .word 0x40d140b2 /* ldrhmi r4, [r1], #2 */ /* 2 bytes */ + ldrhmi r4, [r1], #2 /* 2 bytes */ strcs r3, [r0], #4 - .word 0x40c040b2 /* strhmi r4, [r0], #2 */ + strhmi r4, [r0], #2 tst r2, #0x1 - .word 0x15d13000 /* ldrbne r3, [r1] */ /* last byte */ - .word 0x15c03000 /* strbne r3, [r0] */ + ldrbne r3, [r1] /* last byte */ + strbne r3, [r0] /* we're done! restore everything and return */ 1: ldmfd sp!, {r5-r11} @@ -224,11 +226,11 @@ non_congruent: * becomes aligned to 32 bits (r5 = nb of words to copy for alignment) */ movs r5, r5, lsl #31 - .word 0x44c03001 /* strbmi r3, [r0], #1 */ + strbmi r3, [r0], #1 movmi r3, r3, lsr #8 - .word 0x24c03001 /* strbcs r3, [r0], #1 */ + strbcs r3, [r0], #1 movcs r3, r3, lsr #8 - .word 0x24c03001 /* strbcs r3, [r0], #1 */ + strbcs r3, [r0], #1 movcs r3, r3, lsr #8 cmp r2, #4 @@ -355,23 +357,23 @@ less_than_thirtytwo: partial_word_tail: /* we have a partial word in the input buffer */ movs r5, lr, lsl #(31-3) - .word 0x44c03001 /* strbmi r3, [r0], #1 */ + strbmi r3, [r0], #1 movmi r3, r3, lsr #8 - .word 0x24c03001 /* strbcs r3, [r0], #1 */ + strbcs r3, [r0], #1 movcs r3, r3, lsr #8 - .word 0x24c03001 /* strbcs r3, [r0], #1 */ + strbcs r3, [r0], #1 /* Refill spilled registers from the stack. Don't update sp. */ ldmfd sp, {r5-r11} copy_last_3_and_return: movs r2, r2, lsl #31 /* copy remaining 0, 1, 2 or 3 bytes */ - .word 0x44d12001 /* ldrbmi r2, [r1], #1 */ - .word 0x24d13001 /* ldrbcs r3, [r1], #1 */ - .word 0x25d1c000 /* ldrbcs r12,[r1] */ - .word 0x44c02001 /* strbmi r2, [r0], #1 */ - .word 0x24c03001 /* strbcs r3, [r0], #1 */ - .word 0x25c0c000 /* strbcs r12,[r0] */ + ldrbmi r2, [r1], #1 + ldrbcs r3, [r1], #1 + ldrbcs r12,[r1] + strbmi r2, [r0], #1 + strbcs r3, [r0], #1 + strbcs r12,[r0] /* we're done! restore sp and spilled registers and return */ add sp, sp, #28 --LZvS9be/3tNcYl/X--