u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
From: Francis Laniel <francis.laniel@amarulasolutions.com>
To: u-boot@lists.denx.de
Cc: Michael Nazzareno Trimarchi <michael@amarulasolutions.com>,
	Tony Dinh <mibodhi@gmail.com>,
	Francis Laniel <francis.laniel@amarulasolutions.com>,
	Sergei Antonov <saproj@gmail.com>
Subject: [RFC PATCH v1] arm: lib: add __gnu_thumb1_case_si
Date: Sat,  1 Apr 2023 22:54:39 +0100	[thread overview]
Message-ID: <20230401215439.9107-1-francis.laniel@amarulasolutions.com> (raw)

The assembly for __gnu_thumb1_case_si was taken from upstream gcc and adapted
as width suffix was removed for the add instruction [1].

Signed-off-by: Francis Laniel <francis.laniel@amarulasolutions.com>
Tested-by: Tony Dinh <mibodhi@gmail.com>
[1] https://github.com/gcc-mirror/gcc/blob/4f181f9c7ee3efc509d185fdfda33be9018f1611/libgcc/config/arm/lib1funcs.S#L2156
---
 arch/arm/lib/lib1funcs.S | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/arch/arm/lib/lib1funcs.S b/arch/arm/lib/lib1funcs.S
index 7ff4446dd6..79cedc0aad 100644
--- a/arch/arm/lib/lib1funcs.S
+++ b/arch/arm/lib/lib1funcs.S
@@ -424,4 +424,21 @@ ENTRY(__gnu_thumb1_case_uhi)
 	ret	lr
 ENDPROC(__gnu_thumb1_case_uhi)
 .popsection
+
+/* Taken and adapted from: https://github.com/gcc-mirror/gcc/blob/4f181f9c7ee3efc509d185fdfda33be9018f1611/libgcc/config/arm/lib1funcs.S#L2156 */
+.pushsection .text.__gnu_thumb1_case_si, "ax"
+ENTRY(__gnu_thumb1_case_si)
+	push	{r0, r1}
+	mov	r1, lr
+	adds	r1, r1, #2	/* Align to word.  */
+	lsrs	r1, r1, #2
+	lsls	r0, r0, #2
+	lsls	r1, r1, #2
+	ldr	r0, [r1, r0]
+	adds	r0, r0, r1
+	mov	lr, r0
+	pop	{r0, r1}
+	mov	pc, lr		/* We know we were called from thumb code.  */
+ENDPROC(__gnu_thumb1_case_si)
+.popsection
 #endif
--
2.34.1


             reply	other threads:[~2023-04-01 21:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-01 21:54 Francis Laniel [this message]
2023-04-01 22:17 ` [RFC PATCH v1] arm: lib: add __gnu_thumb1_case_si Tony Dinh
2023-04-02 10:17   ` Pali Rohár
2023-04-04 19:52     ` Tony Dinh
2023-04-07 14:51 ` Tom Rini
2023-04-08 21:57   ` Francis Laniel

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=20230401215439.9107-1-francis.laniel@amarulasolutions.com \
    --to=francis.laniel@amarulasolutions.com \
    --cc=mibodhi@gmail.com \
    --cc=michael@amarulasolutions.com \
    --cc=saproj@gmail.com \
    --cc=u-boot@lists.denx.de \
    /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.
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).