aboutsummaryrefslogtreecommitdiffstats
path: root/arch/xtensa/lib/lshrdi3.S
diff options
context:
space:
mode:
authorMax Filippov <jcmvbkbc@gmail.com>2021-10-18 04:29:27 -0700
committerMax Filippov <jcmvbkbc@gmail.com>2022-03-09 14:02:40 -0800
commitdbf4ed894c0fd85d421f7b3b9758ce95398d2925 (patch)
treebe741f6adb095349d4128f0b792a5b5637ab53b5 /arch/xtensa/lib/lshrdi3.S
parentxtensa: add missing XCHAL_HAVE_WINDOWED check (diff)
downloadlinux-dev-dbf4ed894c0fd85d421f7b3b9758ce95398d2925.tar.xz
linux-dev-dbf4ed894c0fd85d421f7b3b9758ce95398d2925.zip
xtensa: add helpers for division, remainder and shifts
Don't rely on libgcc presence, build own versions of the helpers with correct ABI. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Diffstat (limited to 'arch/xtensa/lib/lshrdi3.S')
-rw-r--r--arch/xtensa/lib/lshrdi3.S28
1 files changed, 28 insertions, 0 deletions
diff --git a/arch/xtensa/lib/lshrdi3.S b/arch/xtensa/lib/lshrdi3.S
new file mode 100644
index 000000000000..129ef8d1725b
--- /dev/null
+++ b/arch/xtensa/lib/lshrdi3.S
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later WITH GCC-exception-2.0 */
+#include <linux/linkage.h>
+#include <asm/asmmacro.h>
+#include <asm/core.h>
+
+#ifdef __XTENSA_EB__
+#define uh a2
+#define ul a3
+#else
+#define uh a3
+#define ul a2
+#endif /* __XTENSA_EB__ */
+
+ENTRY(__lshrdi3)
+
+ abi_entry_default
+ ssr a4
+ bgei a4, 32, .Lhigh_only
+ src ul, uh, ul
+ srl uh, uh
+ abi_ret_default
+
+.Lhigh_only:
+ srl ul, uh
+ movi uh, 0
+ abi_ret_default
+
+ENDPROC(__lshrdi3)