github.com/aergoio/aergo@v1.3.1/libtool/src/gmp-6.1.2/mpn/arm64/aors_n.asm (about) 1 dnl ARM64 mpn_add_n and mpn_sub_n 2 3 dnl Contributed to the GNU project by Torbjörn Granlund. 4 5 dnl Copyright 2013 Free Software Foundation, Inc. 6 7 dnl This file is part of the GNU MP Library. 8 dnl 9 dnl The GNU MP Library is free software; you can redistribute it and/or modify 10 dnl it under the terms of either: 11 dnl 12 dnl * the GNU Lesser General Public License as published by the Free 13 dnl Software Foundation; either version 3 of the License, or (at your 14 dnl option) any later version. 15 dnl 16 dnl or 17 dnl 18 dnl * the GNU General Public License as published by the Free Software 19 dnl Foundation; either version 2 of the License, or (at your option) any 20 dnl later version. 21 dnl 22 dnl or both in parallel, as here. 23 dnl 24 dnl The GNU MP Library is distributed in the hope that it will be useful, but 25 dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 26 dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 27 dnl for more details. 28 dnl 29 dnl You should have received copies of the GNU General Public License and the 30 dnl GNU Lesser General Public License along with the GNU MP Library. If not, 31 dnl see https://www.gnu.org/licenses/. 32 33 include(`../config.m4') 34 35 C cycles/limb 36 C Cortex-A53 ? 37 C Cortex-A57 ? 38 39 changecom(@&*$) 40 41 define(`rp', `x0') 42 define(`up', `x1') 43 define(`vp', `x2') 44 define(`n', `x3') 45 46 ifdef(`OPERATION_add_n', ` 47 define(`ADDSUBC', adcs) 48 define(`CLRCY', `cmn xzr, xzr') 49 define(`SETCY', `cmp $1, #1') 50 define(`RETVAL', `adc x0, xzr, xzr') 51 define(`func', mpn_add_n) 52 define(`func_nc', mpn_add_nc)') 53 ifdef(`OPERATION_sub_n', ` 54 define(`ADDSUBC', sbcs) 55 define(`CLRCY', `cmp xzr, xzr') 56 define(`SETCY', `subs $1, xzr, $1') 57 define(`RETVAL', `sbc x0, xzr, xzr 58 and x0, x0, #1') 59 define(`func', mpn_sub_n) 60 define(`func_nc', mpn_sub_nc)') 61 62 MULFUNC_PROLOGUE(mpn_add_n mpn_add_nc mpn_sub_n mpn_sub_nc) 63 64 ASM_START() 65 PROLOGUE(func_nc) 66 SETCY( x4) 67 b L(ent) 68 EPILOGUE() 69 PROLOGUE(func) 70 CLRCY 71 L(ent): tbz n, #0, L(b0) 72 73 ldr x4, [up],#8 74 ldr x6, [vp],#8 75 sub n, n, #1 76 ADDSUBC x8, x4, x6 77 str x8, [rp],#8 78 cbz n, L(rt) 79 80 L(b0): ldp x4, x5, [up],#16 81 ldp x6, x7, [vp],#16 82 sub n, n, #2 83 ADDSUBC x8, x4, x6 84 ADDSUBC x9, x5, x7 85 cbz n, L(end) 86 87 L(top): ldp x4, x5, [up],#16 88 ldp x6, x7, [vp],#16 89 sub n, n, #2 90 stp x8, x9, [rp],#16 91 ADDSUBC x8, x4, x6 92 ADDSUBC x9, x5, x7 93 cbnz n, L(top) 94 95 L(end): stp x8, x9, [rp] 96 L(rt): RETVAL 97 ret 98 EPILOGUE()