xref: /openbmc/linux/arch/arm/lib/muldi3.S (revision 82003e04)
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 *  This program is free software; you can redistribute it and/or modify
9 *  it under the terms of the GNU General Public License version 2 as
10 *  published by the Free Software Foundation.
11 */
12
13#include <linux/linkage.h>
14#include <asm/assembler.h>
15#include <asm/export.h>
16
17#ifdef __ARMEB__
18#define xh r0
19#define xl r1
20#define yh r2
21#define yl r3
22#else
23#define xl r0
24#define xh r1
25#define yl r2
26#define yh r3
27#endif
28
29ENTRY(__muldi3)
30ENTRY(__aeabi_lmul)
31
32	mul	xh, yl, xh
33	mla	xh, xl, yh, xh
34	mov	ip, xl, lsr #16
35	mov	yh, yl, lsr #16
36	bic	xl, xl, ip, lsl #16
37	bic	yl, yl, yh, lsl #16
38	mla	xh, yh, ip, xh
39	mul	yh, xl, yh
40	mul	xl, yl, xl
41	mul	ip, yl, ip
42	adds	xl, xl, yh, lsl #16
43	adc	xh, xh, yh, lsr #16
44	adds	xl, xl, ip, lsl #16
45	adc	xh, xh, ip, lsr #16
46	ret	lr
47
48ENDPROC(__muldi3)
49ENDPROC(__aeabi_lmul)
50EXPORT_SYMBOL(__muldi3)
51EXPORT_SYMBOL(__aeabi_lmul)
52