blob: d7c93e702ecfd81c4f8d6b822e03a6779345a9f8 [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
Stephen Warren14d74b02016-06-03 13:05:11 -060026.pushsection .text.__muldi3, "ax"
Marek Vasuteb91a462016-05-26 18:01:44 +020027ENTRY(__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 ret lr
45
Marek Vasuteb91a462016-05-26 18:01:44 +020046ENDPROC(__muldi3)
47ENDPROC(__aeabi_lmul)
Stephen Warren14d74b02016-06-03 13:05:11 -060048.popsection