提交 91e662d1 编写于 作者: A Andre McCurdy 提交者: Rich Felker

add thumb2 support to arm assembler memcpy

For Thumb2 compatibility, replace two instances of a single
instruction "orr with a variable shift" with the two instruction
equivalent. Neither of the replacements are in a performance critical
loop.
上级 0ff18be2
#if __ARMEB__ || __thumb__ #if __ARMEB__
#include "../memcpy.c" #include "../memcpy.c"
#endif #endif
#if !__ARMEB__ && !__thumb__ #if !__ARMEB__
/* /*
* Copyright (C) 2008 The Android Open Source Project * Copyright (C) 2008 The Android Open Source Project
...@@ -40,8 +40,9 @@ ...@@ -40,8 +40,9 @@
* This file has been modified from the original for use in musl libc. * This file has been modified from the original for use in musl libc.
* The main changes are: addition of .type memcpy,%function to make the * The main changes are: addition of .type memcpy,%function to make the
* code safely callable from thumb mode, adjusting the return * code safely callable from thumb mode, adjusting the return
* instructions to be compatible with pre-thumb ARM cpus, and removal * instructions to be compatible with pre-thumb ARM cpus, removal of
* of prefetch code that is not compatible with older cpus. * prefetch code that is not compatible with older cpus and support for
* building as thumb 2.
*/ */
.syntax unified .syntax unified
...@@ -241,7 +242,8 @@ non_congruent: ...@@ -241,7 +242,8 @@ non_congruent:
beq 2f beq 2f
ldr r5, [r1], #4 ldr r5, [r1], #4
sub r2, r2, #4 sub r2, r2, #4
orr r4, r3, r5, lsl lr mov r4, r5, lsl lr
orr r4, r4, r3
mov r3, r5, lsr r12 mov r3, r5, lsr r12
str r4, [r0], #4 str r4, [r0], #4
cmp r2, #4 cmp r2, #4
...@@ -348,7 +350,8 @@ less_than_thirtytwo: ...@@ -348,7 +350,8 @@ less_than_thirtytwo:
1: ldr r5, [r1], #4 1: ldr r5, [r1], #4
sub r2, r2, #4 sub r2, r2, #4
orr r4, r3, r5, lsl lr mov r4, r5, lsl lr
orr r4, r4, r3
mov r3, r5, lsr r12 mov r3, r5, lsr r12
str r4, [r0], #4 str r4, [r0], #4
cmp r2, #4 cmp r2, #4
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册