Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Marek Vasut | 0bf65c6 | 2016-05-26 18:01:44 +0200 | [diff] [blame] | 2 | /* |
| 3 | * linux/arch/arm/lib/muldi3.S |
| 4 | * |
| 5 | * Author: Nicolas Pitre |
| 6 | * Created: Oct 19, 2005 |
| 7 | * Copyright: Monta Vista Software, Inc. |
Marek Vasut | 0bf65c6 | 2016-05-26 18:01:44 +0200 | [diff] [blame] | 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 | |
Stephen Warren | b2f1858 | 2016-06-03 13:05:11 -0600 | [diff] [blame] | 25 | .pushsection .text.__muldi3, "ax" |
Marek Vasut | 0bf65c6 | 2016-05-26 18:01:44 +0200 | [diff] [blame] | 26 | ENTRY(__muldi3) |
| 27 | ENTRY(__aeabi_lmul) |
| 28 | |
| 29 | mul xh, yl, xh |
| 30 | mla xh, xl, yh, xh |
| 31 | mov ip, xl, lsr #16 |
| 32 | mov yh, yl, lsr #16 |
| 33 | bic xl, xl, ip, lsl #16 |
| 34 | bic yl, yl, yh, lsl #16 |
| 35 | mla xh, yh, ip, xh |
| 36 | mul yh, xl, yh |
| 37 | mul xl, yl, xl |
| 38 | mul ip, yl, ip |
| 39 | adds xl, xl, yh, lsl #16 |
| 40 | adc xh, xh, yh, lsr #16 |
| 41 | adds xl, xl, ip, lsl #16 |
| 42 | adc xh, xh, ip, lsr #16 |
| 43 | ret lr |
| 44 | |
Marek Vasut | 0bf65c6 | 2016-05-26 18:01:44 +0200 | [diff] [blame] | 45 | ENDPROC(__muldi3) |
| 46 | ENDPROC(__aeabi_lmul) |
Stephen Warren | b2f1858 | 2016-06-03 13:05:11 -0600 | [diff] [blame] | 47 | .popsection |