blob: d89c60615794e7a72c4f5614837939ed0735d62d [file] [log] [blame]
Nicolas Pitref741a1a2005-10-30 23:08:03 +00001/*
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
15#ifdef __ARMEB__
16#define xh r0
17#define xl r1
18#define yh r2
19#define yl r3
20#else
21#define xl r0
22#define xh r1
23#define yl r2
24#define yh r3
25#endif
26
27ENTRY(__muldi3)
Nicolas Pitreba95e4e2006-01-14 16:18:29 +000028ENTRY(__aeabi_lmul)
Nicolas Pitref741a1a2005-10-30 23:08:03 +000029
30 mul xh, yl, xh
31 mla xh, xl, yh, xh
Russell King3c8fdae2006-03-08 17:25:33 +000032 mov ip, xl, lsr #16
33 mov yh, yl, lsr #16
Nicolas Pitref741a1a2005-10-30 23:08:03 +000034 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 mov pc, lr
45