]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
arm: lib: add __gnu_thumb1_case_si
authorFrancis Laniel <francis.laniel@amarulasolutions.com>
Sat, 1 Apr 2023 21:54:39 +0000 (22:54 +0100)
committerTom Rini <trini@konsulko.com>
Thu, 6 Apr 2023 23:10:08 +0000 (19:10 -0400)
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>
arch/arm/lib/lib1funcs.S

index de15d09e36058978b61d1235b943aa19a3b82015..a1f44d94541c96c0da2355e9bae86a908b13c898 100644 (file)
@@ -419,4 +419,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