From: Patrick Oppenlander <patrick.oppenlander@gmail.com>
To: musl@lists.openwall.com
Subject: Minor arm __syscall_cp_asm optimisation
Date: Thu, 1 Aug 2019 16:00:16 +1000 [thread overview]
Message-ID: <CAEg67GkDW-3rOVHP=hSRyMYxVaMK_mTOJai8vyDkHRj5MYMmSQ@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 431 bytes --]
Hi all,
while debugging something unrelated I noticed a minor optimisation we
can make to __syscall_cp_asm for arm.
Unless I'm missing something the only reason we needed to preserve the
link register was because we were using a branch-link instruction to
branch to __cp_cancel. Replacing this with a branch means we can avoid
the save/restore as the link register is no longer modified.
Patch attached.
Kind regards,
Patrick
[-- Attachment #2: 0001-don-t-unnecessarily-preserve-link-register.patch --]
[-- Type: text/x-patch, Size: 950 bytes --]
From dc8d33fdf483e65ecaa688be6fa2888f914db8cb Mon Sep 17 00:00:00 2001
From: Patrick Oppenlander <patrick.oppenlander@gmail.com>
Date: Thu, 1 Aug 2019 14:34:59 +1000
Subject: [PATCH] don't unnecessarily preserve link register
---
src/thread/arm/syscall_cp.s | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/thread/arm/syscall_cp.s b/src/thread/arm/syscall_cp.s
index a5730c08..e607dd42 100644
--- a/src/thread/arm/syscall_cp.s
+++ b/src/thread/arm/syscall_cp.s
@@ -11,19 +11,19 @@
.type __syscall_cp_asm,%function
__syscall_cp_asm:
mov ip,sp
- stmfd sp!,{r4,r5,r6,r7,lr}
+ stmfd sp!,{r4,r5,r6,r7}
__cp_begin:
ldr r0,[r0]
cmp r0,#0
- blne __cp_cancel
+ bne __cp_cancel
mov r7,r1
mov r0,r2
mov r1,r3
ldmfd ip,{r2,r3,r4,r5,r6}
svc 0
__cp_end:
- ldmfd sp!,{r4,r5,r6,r7,lr}
+ ldmfd sp!,{r4,r5,r6,r7}
bx lr
__cp_cancel:
- ldmfd sp!,{r4,r5,r6,r7,lr}
+ ldmfd sp!,{r4,r5,r6,r7}
b __cancel
--
2.22.0
next reply other threads:[~2019-08-01 6:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-01 6:00 Patrick Oppenlander [this message]
2019-08-06 13:07 ` Szabolcs Nagy
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='CAEg67GkDW-3rOVHP=hSRyMYxVaMK_mTOJai8vyDkHRj5MYMmSQ@mail.gmail.com' \
--to=patrick.oppenlander@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).