blob: 652dacab26b936f12d30ee486dca35f85eaccc87 [file] [log] [blame]
Gabe Black169c0df2013-10-08 18:24:10 -07001/*
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#if defined __GNUC__
14
15#include <arch/asm.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)
Julius Werner7c6e4892014-01-24 16:23:08 -080030.global __aeabi_lmul
31__aeabi_lmul:
Gabe Black169c0df2013-10-08 18:24:10 -070032
33 mul xh, yl, xh
34 mla xh, xl, yh, xh
35 mov ip, xl, lsr #16
36 mov yh, yl, lsr #16
37 bic xl, xl, ip, lsl #16
38 bic yl, yl, yh, lsl #16
39 mla xh, yh, ip, xh
40 mul yh, xl, yh
41 mul xl, yl, xl
42 mul ip, yl, ip
43 adds xl, xl, yh, lsl #16
44 adc xh, xh, yh, lsr #16
45 adds xl, xl, ip, lsl #16
46 adc xh, xh, ip, lsr #16
47 mov pc, lr
48
Julius Werner7c6e4892014-01-24 16:23:08 -080049.type __aeabi_lmul, %function
50.size __aeabi_lmul, .-__aeabi_lmul
Gabe Black169c0df2013-10-08 18:24:10 -070051ENDPROC(__muldi3)
Gabe Black169c0df2013-10-08 18:24:10 -070052
53#endif