u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH v1] arm: lib: add __gnu_thumb1_case_si
@ 2023-04-01 21:54 Francis Laniel
  2023-04-01 22:17 ` Tony Dinh
  2023-04-07 14:51 ` Tom Rini
  0 siblings, 2 replies; 6+ messages in thread
From: Francis Laniel @ 2023-04-01 21:54 UTC (permalink / raw)
  To: u-boot
  Cc: Michael Nazzareno Trimarchi, Tony Dinh, Francis Laniel, Sergei Antonov

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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [RFC PATCH v1] arm: lib: add __gnu_thumb1_case_si
  2023-04-01 21:54 [RFC PATCH v1] arm: lib: add __gnu_thumb1_case_si Francis Laniel
@ 2023-04-01 22:17 ` Tony Dinh
  2023-04-02 10:17   ` Pali Rohár
  2023-04-07 14:51 ` Tom Rini
  1 sibling, 1 reply; 6+ messages in thread
From: Tony Dinh @ 2023-04-01 22:17 UTC (permalink / raw)
  To: Francis Laniel, Tom Rini, Pali Rohár, Stefan Roese
  Cc: u-boot, Michael Nazzareno Trimarchi, Sergei Antonov

Hi Francis,

On Sat, Apr 1, 2023 at 2:55 PM Francis Laniel
<francis.laniel@amarulasolutions.com> wrote:
>
> 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

Thanks for the patch! I've added Tom, Pali, and Stefan.

I think we need to do some more testing for other boards that have
CONFIG_HAS_THUMB2 and CONFIG_SPL_SYS_THUMB_BUILD. My test target
(Marvell Armada 385 SoC) is somewhat broken right now. So it will take
some time for me to get that back running to run this test.

All the best,
Tony

> ---
>  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
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFC PATCH v1] arm: lib: add __gnu_thumb1_case_si
  2023-04-01 22:17 ` Tony Dinh
@ 2023-04-02 10:17   ` Pali Rohár
  2023-04-04 19:52     ` Tony Dinh
  0 siblings, 1 reply; 6+ messages in thread
From: Pali Rohár @ 2023-04-02 10:17 UTC (permalink / raw)
  To: Tony Dinh
  Cc: Francis Laniel, Tom Rini, Stefan Roese, u-boot,
	Michael Nazzareno Trimarchi, Sergei Antonov

On Saturday 01 April 2023 15:17:59 Tony Dinh wrote:
> Hi Francis,
> 
> On Sat, Apr 1, 2023 at 2:55 PM Francis Laniel
> <francis.laniel@amarulasolutions.com> wrote:
> >
> > 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
> 
> Thanks for the patch! I've added Tom, Pali, and Stefan.

Looks good,

Acked-by: Pali Rohár <pali@kernel.org>

> I think we need to do some more testing for other boards that have
> CONFIG_HAS_THUMB2 and CONFIG_SPL_SYS_THUMB_BUILD. My test target
> (Marvell Armada 385 SoC) is somewhat broken right now. So it will take
> some time for me to get that back running to run this test.
> 
> All the best,
> Tony
> 
> > ---
> >  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
> >

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFC PATCH v1] arm: lib: add __gnu_thumb1_case_si
  2023-04-02 10:17   ` Pali Rohár
@ 2023-04-04 19:52     ` Tony Dinh
  0 siblings, 0 replies; 6+ messages in thread
From: Tony Dinh @ 2023-04-04 19:52 UTC (permalink / raw)
  To: Pali Rohár
  Cc: Francis Laniel, Tom Rini, Stefan Roese, u-boot,
	Michael Nazzareno Trimarchi, Sergei Antonov

Hi Francis,

On Sun, Apr 2, 2023 at 3:17 AM Pali Rohár <pali@kernel.org> wrote:
>
> On Saturday 01 April 2023 15:17:59 Tony Dinh wrote:
> > Hi Francis,
> >
> > On Sat, Apr 1, 2023 at 2:55 PM Francis Laniel
> > <francis.laniel@amarulasolutions.com> wrote:
> > >
> > > 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
> >
> > Thanks for the patch! I've added Tom, Pali, and Stefan.
>
> Looks good,
>
> Acked-by: Pali Rohár <pali@kernel.org>
>
> > I think we need to do some more testing for other boards that have
> > CONFIG_HAS_THUMB2 and CONFIG_SPL_SYS_THUMB_BUILD. My test target
> > (Marvell Armada 385 SoC) is somewhat broken right now. So it will take
> > some time for me to get that back running to run this test.

I've done some more testing with other boards. I'm seeing some
problems with LTO in gcc-12, but it is not related to this patch.

Acked-by:  Tony Dinh <mibodhi@gmail.com>

Thanks,
Tony

> >
> > All the best,
> > Tony
> >
> > > ---
> > >  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
> > >

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFC PATCH v1] arm: lib: add __gnu_thumb1_case_si
  2023-04-01 21:54 [RFC PATCH v1] arm: lib: add __gnu_thumb1_case_si Francis Laniel
  2023-04-01 22:17 ` Tony Dinh
@ 2023-04-07 14:51 ` Tom Rini
  2023-04-08 21:57   ` Francis Laniel
  1 sibling, 1 reply; 6+ messages in thread
From: Tom Rini @ 2023-04-07 14:51 UTC (permalink / raw)
  To: Francis Laniel
  Cc: u-boot, Michael Nazzareno Trimarchi, Tony Dinh, Sergei Antonov

[-- Attachment #1: Type: text/plain, Size: 585 bytes --]

On Sat, Apr 01, 2023 at 10:54:39PM +0100, Francis Laniel wrote:

> 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
> Acked-by: Pali Rohár <pali@kernel.org>
> Acked-by:  Tony Dinh <mibodhi@gmail.com>

Applied to u-boot/master, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFC PATCH v1] arm: lib: add __gnu_thumb1_case_si
  2023-04-07 14:51 ` Tom Rini
@ 2023-04-08 21:57   ` Francis Laniel
  0 siblings, 0 replies; 6+ messages in thread
From: Francis Laniel @ 2023-04-08 21:57 UTC (permalink / raw)
  To: Tom Rini; +Cc: u-boot, Michael Nazzareno Trimarchi, Tony Dinh, Sergei Antonov

Le vendredi 7 avril 2023, 15:51:09 WEST Tom Rini a écrit :
> On Sat, Apr 01, 2023 at 10:54:39PM +0100, Francis Laniel wrote:
> > 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/4f181f9c7ee3efc509d185fdfda33be901
> > 8f1611/libgcc/config/arm/lib1funcs.S#L2156 Acked-by: Pali Rohár
> > <pali@kernel.org>
> > Acked-by:  Tony Dinh <mibodhi@gmail.com>
> 
> Applied to u-boot/master, thanks!

Thank you for the merge!




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-04-08 21:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-01 21:54 [RFC PATCH v1] arm: lib: add __gnu_thumb1_case_si Francis Laniel
2023-04-01 22:17 ` 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

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).