1dnl ARM mpn_mul_1. 2 3dnl Copyright 2012 Free Software Foundation, Inc. 4 5dnl This file is part of the GNU MP Library. 6dnl 7dnl The GNU MP Library is free software; you can redistribute it and/or modify 8dnl it under the terms of either: 9dnl 10dnl * the GNU Lesser General Public License as published by the Free 11dnl Software Foundation; either version 3 of the License, or (at your 12dnl option) any later version. 13dnl 14dnl or 15dnl 16dnl * the GNU General Public License as published by the Free Software 17dnl Foundation; either version 2 of the License, or (at your option) any 18dnl later version. 19dnl 20dnl or both in parallel, as here. 21dnl 22dnl The GNU MP Library is distributed in the hope that it will be useful, but 23dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 24dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 25dnl for more details. 26dnl 27dnl You should have received copies of the GNU General Public License and the 28dnl GNU Lesser General Public License along with the GNU MP Library. If not, 29dnl see https://www.gnu.org/licenses/. 30 31include(`../config.m4') 32 33C cycles/limb 34C StrongARM: - 35C XScale - 36C ARM11 6.4 37C Cortex-A7 5.25 38C Cortex-A8 7 39C Cortex-A9 3.25 40C Cortex-A15 4 41 42C TODO 43C * Micro-optimise feed-in code. 44C * Optimise for n=1,2 by delaying register saving. 45C * Try using ldm/stm. 46 47define(`rp',`r0') 48define(`up',`r1') 49define(`n', `r2') 50define(`v0',`r3') 51 52ASM_START() 53PROLOGUE(mpn_mul_1) 54 stmfd sp!, { r4, r5, r6, r7 } 55 56 ands r6, n, #3 57 mov r12, #0 58 beq L(fi0) 59 cmp r6, #2 60 bcc L(fi1) 61 beq L(fi2) 62 63L(fi3): ldr r4, [up], #4 64 mov r6, #0 65 ldr r5, [up], #4 66 b L(lo3) 67 68L(fi0): ldr r5, [up], #4 69 add rp, rp, #4 70 mov r7, #0 71 ldr r4, [up], #4 72 b L(lo0) 73 74L(fi1): ldr r4, [up], #4 75 mov r6, #0 76 add rp, rp, #8 77 subs n, n, #1 78 beq L(1) 79 ldr r5, [up], #4 80 b L(lo1) 81 82L(fi2): ldr r5, [up], #4 83 add rp, rp, #12 84 mov r7, #0 85 ldr r4, [up], #4 86 b L(lo2) 87 88 ALIGN(16) 89L(top): mov r6, #0 90 ldr r5, [up], #4 91 str r7, [rp, #-12] 92L(lo1): umaal r6, r12, r4, v0 93 mov r7, #0 94 ldr r4, [up], #4 95 str r6, [rp, #-8] 96L(lo0): umaal r7, r12, r5, v0 97 mov r6, #0 98 ldr r5, [up], #4 99 str r7, [rp, #-4] 100L(lo3): umaal r6, r12, r4, v0 101 mov r7, #0 102 ldr r4, [up], #4 103 str r6, [rp], #16 104L(lo2): umaal r7, r12, r5, v0 105 subs n, n, #4 106 bhi L(top) 107 108 mov r6, #0 109 str r7, [rp, #-12] 110L(1): umaal r6, r12, r4, v0 111 str r6, [rp, #-8] 112 mov r0, r12 113 ldmfd sp!, { r4, r5, r6, r7 } 114 bx lr 115EPILOGUE() 116