1dnl ARM mpn_addmul_1 -- Multiply a limb vector with a limb and add the result 2dnl to a second limb vector. 3 4dnl Copyright 1998, 2000, 2001, 2003 Free Software Foundation, Inc. 5 6dnl This file is part of the GNU MP Library. 7 8dnl The GNU MP Library is free software; you can redistribute it and/or modify 9dnl it under the terms of the GNU Lesser General Public License as published 10dnl by the Free Software Foundation; either version 3 of the License, or (at 11dnl your option) any later version. 12 13dnl The GNU MP Library is distributed in the hope that it will be useful, but 14dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 15dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 16dnl License for more details. 17 18dnl You should have received a copy of the GNU Lesser General Public License 19dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. 20 21include(`../config.m4') 22 23C cycles/limb 24C StrongARM: 7.75-9.75 (dependent on vl value) 25C XScale: 8-9 (dependent on vl value, estimated) 26 27define(`rp',`r0') 28define(`up',`r1') 29define(`n',`r2') 30define(`vl',`r3') 31define(`rl',`r12') 32define(`ul',`r6') 33define(`r',`lr') 34 35 36ASM_START() 37PROLOGUE(mpn_addmul_1) 38 stmfd sp!, { r4-r6, lr } 39 mov r4, #0 C clear r4 40 adds r0, r0, #0 C clear cy 41 tst n, #1 42 beq L(skip1) 43 ldr ul, [up], #4 44 ldr rl, [rp, #0] 45 umull r5, r4, ul, vl 46 adds r, rl, r5 47 str r, [rp], #4 48L(skip1): 49 tst n, #2 50 beq L(skip2) 51 ldr ul, [up], #4 52 ldr rl, [rp, #0] 53 mov r5, #0 54 umlal r4, r5, ul, vl 55 ldr ul, [up], #4 56 adcs r, rl, r4 57 ldr rl, [rp, #4] 58 mov r4, #0 59 umlal r5, r4, ul, vl 60 str r, [rp], #4 61 adcs r, rl, r5 62 str r, [rp], #4 63L(skip2): 64 bics r, n, #3 65 beq L(return) 66 67 ldr ul, [up], #4 68 ldr rl, [rp, #0] 69 mov r5, #0 70 umlal r4, r5, ul, vl 71 b L(in) 72 73L(loop): 74 ldr ul, [up], #4 75 adcs r, rl, r5 76 ldr rl, [rp, #4] 77 mov r5, #0 78 umlal r4, r5, ul, vl 79 str r, [rp], #4 80L(in): ldr ul, [up], #4 81 adcs r, rl, r4 82 ldr rl, [rp, #4] 83 mov r4, #0 84 umlal r5, r4, ul, vl 85 str r, [rp], #4 86 ldr ul, [up], #4 87 adcs r, rl, r5 88 ldr rl, [rp, #4] 89 mov r5, #0 90 umlal r4, r5, ul, vl 91 str r, [rp], #4 92 ldr ul, [up], #4 93 adcs r, rl, r4 94 ldr rl, [rp, #4] 95 mov r4, #0 96 umlal r5, r4, ul, vl 97 str r, [rp], #4 98 sub n, n, #4 99 bics r, n, #3 100 bne L(loop) 101 102 adcs r, rl, r5 103 str r, [rp], #4 104L(return): 105 adc r0, r4, #0 106 ldmfd sp!, { r4-r6, pc } 107EPILOGUE(mpn_addmul_1) 108