Marek Vasut | eb91a46 | 2016-05-26 18:01:44 +0200 | [diff] [blame] | 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 | * 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 Warren | 14d74b0 | 2016-06-03 13:05:11 -0600 | [diff] [blame] | 26 | .pushsection .text.__muldi3, "ax" |
Marek Vasut | eb91a46 | 2016-05-26 18:01:44 +0200 | [diff] [blame] | 27 | ENTRY(__muldi3) |
| 28 | ENTRY(__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 Vasut | eb91a46 | 2016-05-26 18:01:44 +0200 | [diff] [blame] | 46 | ENDPROC(__muldi3) |
| 47 | ENDPROC(__aeabi_lmul) |
Stephen Warren | 14d74b0 | 2016-06-03 13:05:11 -0600 | [diff] [blame] | 48 | .popsection |