1dnl ARM mpn_addmul_2. 2 3dnl Contributed to the GNU project by Torbjörn Granlund. 4 5dnl Copyright 2012, 2013, 2015 Free Software Foundation, Inc. 6 7dnl This file is part of the GNU MP Library. 8dnl 9dnl The GNU MP Library is free software; you can redistribute it and/or modify 10dnl it under the terms of either: 11dnl 12dnl * the GNU Lesser General Public License as published by the Free 13dnl Software Foundation; either version 3 of the License, or (at your 14dnl option) any later version. 15dnl 16dnl or 17dnl 18dnl * the GNU General Public License as published by the Free Software 19dnl Foundation; either version 2 of the License, or (at your option) any 20dnl later version. 21dnl 22dnl or both in parallel, as here. 23dnl 24dnl The GNU MP Library is distributed in the hope that it will be useful, but 25dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 26dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 27dnl for more details. 28dnl 29dnl You should have received copies of the GNU General Public License and the 30dnl GNU Lesser General Public License along with the GNU MP Library. If not, 31dnl see https://www.gnu.org/licenses/. 32 33include(`../config.m4') 34 35C cycles/limb 36C StrongARM: - 37C XScale - 38C ARM11 4.68 39C Cortex-A5 3.63 40C Cortex-A7 3.65 41C Cortex-A8 4.0 42C Cortex-A9 2.25 43C Cortex-A15 2.5 44C Cortex-A17 2.13 45C Cortex-A53 3.5 46 47define(`rp',`r0') 48define(`up',`r1') 49define(`n', `r2') 50define(`vp',`r3') 51 52define(`v0',`r6') 53define(`v1',`r7') 54define(`u0',`r3') 55define(`u1',`r9') 56 57define(`cya',`r8') 58define(`cyb',`r12') 59 60 61ASM_START() 62PROLOGUE(mpn_addmul_2) 63 push { r4-r9 } 64 65 ldrd v0, v1, [vp, #0] 66 mov cya, #0 67 mov cyb, #0 68 69 tst n, #1 70 beq L(evn) 71 72L(odd): ldr u1, [up, #0] 73 ldr r4, [rp, #0] 74 tst n, #2 75 beq L(fi1) 76L(fi3): sub up, up, #8 77 sub rp, rp, #8 78 b L(lo3) 79L(fi1): sub n, n, #1 80 b L(top) 81 82L(evn): ldr u0, [up, #0] 83 ldr r5, [rp, #0] 84 tst n, #2 85 bne L(fi2) 86L(fi0): sub up, up, #4 87 sub rp, rp, #4 88 b L(lo0) 89L(fi2): sub up, up, #12 90 sub rp, rp, #12 91 b L(lo2) 92 93 ALIGN(16) 94L(top): ldr r5, [rp, #4] 95 umaal r4, cya, u1, v0 96 ldr u0, [up, #4] 97 umaal r5, cyb, u1, v1 98 str r4, [rp, #0] 99L(lo0): ldr r4, [rp, #8] 100 umaal r5, cya, u0, v0 101 ldr u1, [up, #8] 102 umaal r4, cyb, u0, v1 103 str r5, [rp, #4] 104L(lo3): ldr r5, [rp, #12] 105 umaal r4, cya, u1, v0 106 ldr u0, [up, #12] 107 umaal r5, cyb, u1, v1 108 str r4, [rp, #8] 109L(lo2): ldr r4, [rp, #16]! 110 umaal r5, cya, u0, v0 111 ldr u1, [up, #16]! 112 umaal r4, cyb, u0, v1 113 str r5, [rp, #-4] 114 subs n, n, #4 115 bhi L(top) 116 117L(end): umaal r4, cya, u1, v0 118 umaal cya, cyb, u1, v1 119 str r4, [rp, #0] 120 str cya, [rp, #4] 121 mov r0, cyb 122 123 pop { r4-r9 } 124 bx r14 125EPILOGUE() 126