1dnl ARM64 mpn_addlshC_n, mpn_sublshC_n, mpn_rsblshC_n. 2 3dnl Contributed to the GNU project by Torbj��rn Granlund. 4 5dnl Copyright 2017 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 Cortex-A53 3.25-3.75 37C Cortex-A57 2.18 38C X-Gene 2.5 39 40changecom(blah) 41 42define(`rp', `x0') 43define(`up', `x1') 44define(`vp', `x2') 45define(`n', `x3') 46 47ifdef(`DO_add', ` 48 define(`ADDSUB', `adds $1, $2, $3') 49 define(`ADDSUBC', `adcs $1, $2, $3') 50 define(`CLRRCY', `adds $1, xzr, xzr') 51 define(`RETVAL', `adc x0, $1, xzr') 52 define(`func_n', mpn_addlsh`'LSH`'_n)') 53ifdef(`DO_sub', ` 54 define(`ADDSUB', `subs $1, $3, $2') 55 define(`ADDSUBC', `sbcs $1, $3, $2') 56 define(`CLRRCY', `subs $1, xzr, xzr') 57 define(`RETVAL', `cinc x0, $1, cc') 58 define(`func_n', mpn_sublsh`'LSH`'_n)') 59ifdef(`DO_rsb', ` 60 define(`ADDSUB', `subs $1, $2, $3') 61 define(`ADDSUBC', `sbcs $1, $2, $3') 62 define(`CLRRCY', `subs $1, xzr, xzr') 63 define(`RETVAL', `sbc x0, $1, xzr') 64 define(`func_n', mpn_rsblsh`'LSH`'_n)') 65 66ASM_START() 67PROLOGUE(func_n) 68 lsr x18, n, #2 69 tbz n, #0, L(bx0) 70 71L(bx1): ldr x5, [up] 72 tbnz n, #1, L(b11) 73 74L(b01): ldr x11, [vp] 75 cbz x18, L(1) 76 ldp x8, x9, [vp,#8] 77 lsl x13, x11, #LSH 78 ADDSUB( x15, x13, x5) 79 str x15, [rp],#8 80 sub up, up, #24 81 sub vp, vp, #8 82 b L(mid) 83 84L(1): lsl x13, x11, #LSH 85 ADDSUB( x15, x13, x5) 86 str x15, [rp] 87 lsr x0, x11, RSH 88 RETVAL( x0, x1) 89 ret 90 91L(b11): ldr x9, [vp] 92 ldp x10, x11, [vp,#8]! 93 lsl x13, x9, #LSH 94 ADDSUB( x17, x13, x5) 95 str x17, [rp],#8 96 sub up, up, #8 97 cbz x18, L(end) 98 b L(top) 99 100L(bx0): tbnz n, #1, L(b10) 101 102L(b00): CLRRCY( x11) 103 ldp x8, x9, [vp],#-16 104 sub up, up, #32 105 b L(mid) 106 107L(b10): CLRRCY( x9) 108 ldp x10, x11, [vp] 109 sub up, up, #16 110 cbz x18, L(end) 111 112 ALIGN(16) 113L(top): ldp x4, x5, [up,#16] 114 extr x12, x10, x9, #RSH 115 ldp x8, x9, [vp,#16] 116 extr x13, x11, x10, #RSH 117 ADDSUBC(x14, x12, x4) 118 ADDSUBC(x15, x13, x5) 119 stp x14, x15, [rp],#16 120L(mid): ldp x4, x5, [up,#32]! 121 extr x12, x8, x11, #RSH 122 ldp x10, x11, [vp,#32]! 123 extr x13, x9, x8, #RSH 124 ADDSUBC(x16, x12, x4) 125 ADDSUBC(x17, x13, x5) 126 stp x16, x17, [rp],#16 127 sub x18, x18, #1 128 cbnz x18, L(top) 129 130L(end): ldp x4, x5, [up,#16] 131 extr x12, x10, x9, #RSH 132 extr x13, x11, x10, #RSH 133 ADDSUBC(x14, x12, x4) 134 ADDSUBC(x15, x13, x5) 135 stp x14, x15, [rp] 136 lsr x0, x11, RSH 137 RETVAL( x0, x1) 138 ret 139EPILOGUE() 140