Thomas Gleixner | d2912cb | 2019-06-04 10:11:33 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Nicolas Pitre | f741a1a | 2005-10-30 23:08:03 +0000 | [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. |
Nicolas Pitre | f741a1a | 2005-10-30 23:08:03 +0000 | [diff] [blame] | 8 | */ |
| 9 | |
| 10 | #include <linux/linkage.h> |
Russell King | 6ebbf2c | 2014-06-30 16:29:12 +0100 | [diff] [blame] | 11 | #include <asm/assembler.h> |
Nicolas Pitre | f741a1a | 2005-10-30 23:08:03 +0000 | [diff] [blame] | 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 | |
| 25 | ENTRY(__muldi3) |
Nicolas Pitre | ba95e4e | 2006-01-14 16:18:29 +0000 | [diff] [blame] | 26 | ENTRY(__aeabi_lmul) |
Nicolas Pitre | f741a1a | 2005-10-30 23:08:03 +0000 | [diff] [blame] | 27 | |
| 28 | mul xh, yl, xh |
| 29 | mla xh, xl, yh, xh |
Russell King | 3c8fdae | 2006-03-08 17:25:33 +0000 | [diff] [blame] | 30 | mov ip, xl, lsr #16 |
| 31 | mov yh, yl, lsr #16 |
Nicolas Pitre | f741a1a | 2005-10-30 23:08:03 +0000 | [diff] [blame] | 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 |
Russell King | 6ebbf2c | 2014-06-30 16:29:12 +0100 | [diff] [blame] | 42 | ret lr |
Nicolas Pitre | f741a1a | 2005-10-30 23:08:03 +0000 | [diff] [blame] | 43 | |
Catalin Marinas | 93ed397 | 2008-08-28 11:22:32 +0100 | [diff] [blame] | 44 | ENDPROC(__muldi3) |
| 45 | ENDPROC(__aeabi_lmul) |