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