Nicolas Pitre | f741a1a | 2005-10-30 23:08:03 +0000 | [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 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License version 2 as |
| 10 | * published by the Free Software Foundation. |
| 11 | */ |
| 12 | |
| 13 | #include <linux/linkage.h> |
Russell King | 6ebbf2c | 2014-06-30 16:29:12 +0100 | [diff] [blame] | 14 | #include <asm/assembler.h> |
Nicolas Pitre | f741a1a | 2005-10-30 23:08:03 +0000 | [diff] [blame] | 15 | |
| 16 | #ifdef __ARMEB__ |
| 17 | #define xh r0 |
| 18 | #define xl r1 |
| 19 | #define yh r2 |
| 20 | #define yl r3 |
| 21 | #else |
| 22 | #define xl r0 |
| 23 | #define xh r1 |
| 24 | #define yl r2 |
| 25 | #define yh r3 |
| 26 | #endif |
| 27 | |
| 28 | ENTRY(__muldi3) |
Nicolas Pitre | ba95e4e | 2006-01-14 16:18:29 +0000 | [diff] [blame] | 29 | ENTRY(__aeabi_lmul) |
Nicolas Pitre | f741a1a | 2005-10-30 23:08:03 +0000 | [diff] [blame] | 30 | |
| 31 | mul xh, yl, xh |
| 32 | mla xh, xl, yh, xh |
Russell King | 3c8fdae | 2006-03-08 17:25:33 +0000 | [diff] [blame] | 33 | mov ip, xl, lsr #16 |
| 34 | mov yh, yl, lsr #16 |
Nicolas Pitre | f741a1a | 2005-10-30 23:08:03 +0000 | [diff] [blame] | 35 | bic xl, xl, ip, lsl #16 |
| 36 | bic yl, yl, yh, lsl #16 |
| 37 | mla xh, yh, ip, xh |
| 38 | mul yh, xl, yh |
| 39 | mul xl, yl, xl |
| 40 | mul ip, yl, ip |
| 41 | adds xl, xl, yh, lsl #16 |
| 42 | adc xh, xh, yh, lsr #16 |
| 43 | adds xl, xl, ip, lsl #16 |
| 44 | adc xh, xh, ip, lsr #16 |
Russell King | 6ebbf2c | 2014-06-30 16:29:12 +0100 | [diff] [blame] | 45 | ret lr |
Nicolas Pitre | f741a1a | 2005-10-30 23:08:03 +0000 | [diff] [blame] | 46 | |
Catalin Marinas | 93ed397 | 2008-08-28 11:22:32 +0100 | [diff] [blame] | 47 | ENDPROC(__muldi3) |
| 48 | ENDPROC(__aeabi_lmul) |