Gabe Black | 169c0df | 2013-10-08 18:24:10 -0700 | [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 | #if defined __GNUC__ |
| 14 | |
| 15 | #include <arch/asm.h> |
| 16 | |
| 17 | #ifdef __ARMEB__ |
| 18 | #define xh r0 |
| 19 | #define xl r1 |
| 20 | #define yh r2 |
| 21 | #define yl r3 |
| 22 | #else |
| 23 | #define xl r0 |
| 24 | #define xh r1 |
| 25 | #define yl r2 |
| 26 | #define yh r3 |
| 27 | #endif |
| 28 | |
| 29 | ENTRY(__muldi3) |
Julius Werner | 7c6e489 | 2014-01-24 16:23:08 -0800 | [diff] [blame] | 30 | .global __aeabi_lmul |
| 31 | __aeabi_lmul: |
Gabe Black | 169c0df | 2013-10-08 18:24:10 -0700 | [diff] [blame] | 32 | |
| 33 | mul xh, yl, xh |
| 34 | mla xh, xl, yh, xh |
| 35 | mov ip, xl, lsr #16 |
| 36 | mov yh, yl, lsr #16 |
| 37 | bic xl, xl, ip, lsl #16 |
| 38 | bic yl, yl, yh, lsl #16 |
| 39 | mla xh, yh, ip, xh |
| 40 | mul yh, xl, yh |
| 41 | mul xl, yl, xl |
| 42 | mul ip, yl, ip |
| 43 | adds xl, xl, yh, lsl #16 |
| 44 | adc xh, xh, yh, lsr #16 |
| 45 | adds xl, xl, ip, lsl #16 |
| 46 | adc xh, xh, ip, lsr #16 |
| 47 | mov pc, lr |
| 48 | |
Julius Werner | 7c6e489 | 2014-01-24 16:23:08 -0800 | [diff] [blame] | 49 | .type __aeabi_lmul, %function |
| 50 | .size __aeabi_lmul, .-__aeabi_lmul |
Gabe Black | 169c0df | 2013-10-08 18:24:10 -0700 | [diff] [blame] | 51 | ENDPROC(__muldi3) |
Gabe Black | 169c0df | 2013-10-08 18:24:10 -0700 | [diff] [blame] | 52 | |
| 53 | #endif |