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