mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Andre McCurdy <armccurdy@gmail.com>
To: musl@lists.openwall.com
Cc: Andre McCurdy <armccurdy@gmail.com>
Subject: [PATCH 1/2] Add Thumb2 support to ARM assembler memcpy
Date: Fri, 13 Sep 2019 11:44:31 -0700	[thread overview]
Message-ID: <20190913184432.29753-1-armccurdy@gmail.com> (raw)

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.
---
 src/string/arm/memcpy.c    |  2 +-
 src/string/arm/memcpy_le.S | 17 ++++++++++-------
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/src/string/arm/memcpy.c b/src/string/arm/memcpy.c
index f703c9bd..041614f4 100644
--- a/src/string/arm/memcpy.c
+++ b/src/string/arm/memcpy.c
@@ -1,3 +1,3 @@
-#if __ARMEB__ || __thumb__
+#if __ARMEB__
 #include "../memcpy.c"
 #endif
diff --git a/src/string/arm/memcpy_le.S b/src/string/arm/memcpy_le.S
index 9cfbcb2a..64bc5f9e 100644
--- a/src/string/arm/memcpy_le.S
+++ b/src/string/arm/memcpy_le.S
@@ -1,4 +1,4 @@
-#if !__ARMEB__ && !__thumb__
+#if !__ARMEB__
 
 /*
  * Copyright (C) 2008 The Android Open Source Project
@@ -40,8 +40,9 @@
  * 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
  * code safely callable from thumb mode, adjusting the return
- * instructions to be compatible with pre-thumb ARM cpus, and removal
- * of prefetch code that is not compatible with older cpus.
+ * instructions to be compatible with pre-thumb ARM cpus, removal of
+ * prefetch code that is not compatible with older cpus and support for
+ * building as thumb 2.
  */
 
 .syntax unified
@@ -241,8 +242,9 @@ non_congruent:
 	beq     2f
 	ldr     r5, [r1], #4
 	sub     r2, r2, #4
-	orr     r4, r3, r5,             lsl lr
-	mov     r3, r5,                 lsr r12
+	mov     r4, r5, lsl lr
+	orr     r4, r4, r3
+	mov     r3, r5, lsr r12
 	str     r4, [r0], #4
 	cmp     r2, #4
 	bhs     1b
@@ -348,8 +350,9 @@ less_than_thirtytwo:
 
 1:      ldr     r5, [r1], #4
 	sub     r2, r2, #4
-	orr     r4, r3, r5,             lsl lr
-	mov     r3,     r5,                     lsr r12
+	mov     r4, r5, lsl lr
+	orr     r4, r4, r3
+	mov     r3, r5, lsr r12
 	str     r4, [r0], #4
 	cmp     r2, #4
 	bhs     1b
-- 
2.23.0



             reply	other threads:[~2019-09-13 18:44 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-13 18:44 Andre McCurdy [this message]
2019-09-13 18:44 ` [PATCH 2/2] Add big-endian " Andre McCurdy
2019-09-13 18:59   ` Rich Felker
2019-09-13 20:38     ` Andre McCurdy
2020-01-15 15:45       ` [musl] " Rich Felker
2020-01-15 18:41         ` Andre McCurdy
2020-01-15 19:22           ` Rich Felker
2020-01-15 20:54             ` Andre McCurdy
2020-01-16 15:21           ` Natanael Copa
2020-01-15 16:35 ` [musl] [PATCH 1/2] Add Thumb2 " Rich Felker
2020-01-15 18:49   ` Andre McCurdy
2020-01-15 19:24     ` Rich Felker
2020-01-15 20:20       ` Andre McCurdy
2020-01-15 20:38         ` Rich Felker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190913184432.29753-1-armccurdy@gmail.com \
    --to=armccurdy@gmail.com \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).