summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2014-11-23 14:12:14 -0500
committerRich Felker <dalias@aerifal.cx>2014-11-23 14:12:14 -0500
commit9367fe926196f407705bb07cd29c6e40eb1774dd (patch)
tree67fde01cfd46a13297304de2976928e84802605b
parent27828f7e9adb6b4f93ca56f6f98ef4c44bb5ed4e (diff)
downloadmusl-9367fe926196f407705bb07cd29c6e40eb1774dd.tar.gz
fix build regression in arm asm for memcpy
commit 27828f7e9adb6b4f93ca56f6f98ef4c44bb5ed4e fixed compatibility with clang's internal assembler, but broke compatibility with gas and the traditional arm asm syntax by switching to the arm "unified assembler language" (UAL). recent versions of gas also support UAL, but require the .syntax directive to be used to switch to it. clang on the other hand defaults to UAL. and old versions of gas (still relevant) don't support UAL at all. for the conditional ldm/stm instructions, "ia" is default and can just be omitted, resulting in a mnemonic that's compatible with both traditional and UAL syntax. but for byte/halfword loads and stores, there seems to be no mnemonic compatible with both, and thus .word is used to produce the desired opcode explicitly. the .inst directive is not used because it is not compatible with older assemblers.
-rw-r--r--src/string/armel/memcpy.s60
1 files changed, 30 insertions, 30 deletions
diff --git a/src/string/armel/memcpy.s b/src/string/armel/memcpy.s
index f05183ad..656cad95 100644
--- a/src/string/armel/memcpy.s
+++ b/src/string/armel/memcpy.s
@@ -73,12 +73,12 @@ memcpy:
*/
movs r12, r3, lsl #31
sub r2, r2, r3 /* we know that r3 <= r2 because r2 >= 4 */
- ldrbmi r3, [r1], #1
- ldrbcs r4, [r1], #1
- ldrbcs r12,[r1], #1
- strbmi r3, [r0], #1
- strbcs r4, [r0], #1
- strbcs r12,[r0], #1
+ .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 */
src_aligned:
@@ -101,10 +101,10 @@ src_aligned:
/* conditionnaly copies 0 to 7 words (length in r3) */
movs r12, r3, lsl #28
- ldmiacs r1!, {r4, r5, r6, r7} /* 16 bytes */
- ldmiami r1!, {r8, r9} /* 8 bytes */
- stmiacs r0!, {r4, r5, r6, r7}
- stmiami r0!, {r8, r9}
+ ldmcs r1!, {r4, r5, r6, r7} /* 16 bytes */
+ ldmmi r1!, {r8, r9} /* 8 bytes */
+ stmcs r0!, {r4, r5, r6, r7}
+ stmmi r0!, {r8, r9}
tst r3, #0x4
ldrne r10,[r1], #4 /* 4 bytes */
strne r10,[r0], #4
@@ -171,18 +171,18 @@ less_than_32_left:
/* conditionnaly copies 0 to 31 bytes */
movs r12, r2, lsl #28
- ldmiacs r1!, {r4, r5, r6, r7} /* 16 bytes */
- ldmiami r1!, {r8, r9} /* 8 bytes */
- stmiacs r0!, {r4, r5, r6, r7}
- stmiami r0!, {r8, r9}
+ ldmcs r1!, {r4, r5, r6, r7} /* 16 bytes */
+ ldmmi r1!, {r8, r9} /* 8 bytes */
+ stmcs r0!, {r4, r5, r6, r7}
+ stmmi r0!, {r8, r9}
movs r12, r2, lsl #30
ldrcs r3, [r1], #4 /* 4 bytes */
- ldrhmi r4, [r1], #2 /* 2 bytes */
+ .word 0x40d140b2 /* ldrhmi r4, [r1], #2 */ /* 2 bytes */
strcs r3, [r0], #4
- strhmi r4, [r0], #2
+ .word 0x40c040b2 /* strhmi r4, [r0], #2 */
tst r2, #0x1
- ldrbne r3, [r1] /* last byte */
- strbne r3, [r0]
+ .word 0x15d13000 /* ldrbne r3, [r1] */ /* last byte */
+ .word 0x15c03000 /* strbne r3, [r0] */
/* we're done! restore everything and return */
1: ldmfd sp!, {r5-r11}
@@ -224,11 +224,11 @@ non_congruent:
* becomes aligned to 32 bits (r5 = nb of words to copy for alignment)
*/
movs r5, r5, lsl #31
- strbmi r3, [r0], #1
+ .word 0x44c03001 /* strbmi r3, [r0], #1 */
movmi r3, r3, lsr #8
- strbcs r3, [r0], #1
+ .word 0x24c03001 /* strbcs r3, [r0], #1 */
movcs r3, r3, lsr #8
- strbcs r3, [r0], #1
+ .word 0x24c03001 /* strbcs r3, [r0], #1 */
movcs r3, r3, lsr #8
cmp r2, #4
@@ -355,23 +355,23 @@ less_than_thirtytwo:
partial_word_tail:
/* we have a partial word in the input buffer */
movs r5, lr, lsl #(31-3)
- strbmi r3, [r0], #1
+ .word 0x44c03001 /* strbmi r3, [r0], #1 */
movmi r3, r3, lsr #8
- strbcs r3, [r0], #1
+ .word 0x24c03001 /* strbcs r3, [r0], #1 */
movcs r3, r3, lsr #8
- strbcs r3, [r0], #1
+ .word 0x24c03001 /* 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 */
- ldrbmi r2, [r1], #1
- ldrbcs r3, [r1], #1
- ldrbcs r12,[r1]
- strbmi r2, [r0], #1
- strbcs r3, [r0], #1
- strbcs r12,[r0]
+ .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] */
/* we're done! restore sp and spilled registers and return */
add sp, sp, #28