• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/* SPDX-License-Identifier: GPL-2.0-only */
2/* Based on linux/arch/arm/lib/muldi3.S */
3
4#if defined __GNUC__
5
6#include <arch/asm.h>
7
8#ifdef __ARMEB__
9#define xh r0
10#define xl r1
11#define yh r2
12#define yl r3
13#else
14#define xl r0
15#define xh r1
16#define yl r2
17#define yh r3
18#endif
19
20ENTRY(__muldi3)
21.global __aeabi_lmul
22__aeabi_lmul:
23
24	mul	xh, yl, xh
25	mla	xh, xl, yh, xh
26	mov	ip, xl, lsr #16
27	mov	yh, yl, lsr #16
28	bic	xl, xl, ip, lsl #16
29	bic	yl, yl, yh, lsl #16
30	mla	xh, yh, ip, xh
31	mul	yh, xl, yh
32	mul	xl, yl, xl
33	mul	ip, yl, ip
34	adds	xl, xl, yh, lsl #16
35	adc	xh, xh, yh, lsr #16
36	adds	xl, xl, ip, lsl #16
37	adc	xh, xh, ip, lsr #16
38	mov	pc, lr
39
40.type __aeabi_lmul, %function
41.size __aeabi_lmul, .-__aeabi_lmul
42ENDPROC(__muldi3)
43
44#endif
45