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