xref: /openbmc/u-boot/arch/arm/lib/muldi3.S (revision 04a993fe)
1/*
2 *  linux/arch/arm/lib/muldi3.S
3 *
4 *  Author:     Nicolas Pitre
5 *  Created:    Oct 19, 2005
6 *  Copyright:  Monta Vista Software, Inc.
7 *
8 *  SPDX-License-Identifier:	GPL-2.0
9 */
10
11#include <linux/linkage.h>
12#include <asm/assembler.h>
13
14#ifdef __ARMEB__
15#define xh r0
16#define xl r1
17#define yh r2
18#define yl r3
19#else
20#define xl r0
21#define xh r1
22#define yl r2
23#define yh r3
24#endif
25
26.pushsection .text.__muldi3, "ax"
27ENTRY(__muldi3)
28ENTRY(__aeabi_lmul)
29
30	mul	xh, yl, xh
31	mla	xh, xl, yh, xh
32	mov	ip, xl, lsr #16
33	mov	yh, yl, lsr #16
34	bic	xl, xl, ip, lsl #16
35	bic	yl, yl, yh, lsl #16
36	mla	xh, yh, ip, xh
37	mul	yh, xl, yh
38	mul	xl, yl, xl
39	mul	ip, yl, ip
40	adds	xl, xl, yh, lsl #16
41	adc	xh, xh, yh, lsr #16
42	adds	xl, xl, ip, lsl #16
43	adc	xh, xh, ip, lsr #16
44	ret	lr
45
46ENDPROC(__muldi3)
47ENDPROC(__aeabi_lmul)
48.popsection
49