blob: bc255c522a4d9ad725715b2a94e73d255ce8cd3d [file] [log] [blame]
Marek Vasuteb91a462016-05-26 18:01:44 +02001/*
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
26ENTRY(__muldi3)
27ENTRY(__aeabi_lmul)
Marek Vasut71cfb332016-05-26 18:01:46 +020028.pushsection .text.__muldi3, "ax"
Marek Vasuteb91a462016-05-26 18:01:44 +020029
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
Marek Vasut71cfb332016-05-26 18:01:46 +020046.popsection
Marek Vasuteb91a462016-05-26 18:01:44 +020047ENDPROC(__muldi3)
48ENDPROC(__aeabi_lmul)