1dnl ARM64 mpn_mul_1 2 3dnl Contributed to the GNU project by Torbj��rn Granlund. 4 5dnl Copyright 2013, 2015, 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 7.5-8 37C Cortex-A57 7 38C Cortex-A72 39C X-Gene 4 40 41C TODO 42C * Start first multiply earlier. 43 44changecom(blah) 45 46define(`rp', `x0') 47define(`up', `x1') 48define(`n', `x2') 49define(`v0', `x3') 50 51 52PROLOGUE(mpn_mul_1c) 53 adds xzr, xzr, xzr C clear cy flag 54 b L(com) 55EPILOGUE() 56 57PROLOGUE(mpn_mul_1) 58 adds x4, xzr, xzr C clear register and cy flag 59L(com): lsr x18, n, #2 60 tbnz n, #0, L(bx1) 61 62L(bx0): mov x11, x4 63 tbz n, #1, L(b00) 64 65L(b10): ldp x4, x5, [up] 66 mul x8, x4, v0 67 umulh x10, x4, v0 68 cbz x18, L(2) 69 ldp x6, x7, [up,#16]! 70 mul x9, x5, v0 71 b L(mid)-8 72 73L(2): mul x9, x5, v0 74 b L(2e) 75 76L(bx1): ldr x7, [up],#8 77 mul x9, x7, v0 78 umulh x11, x7, v0 79 adds x9, x9, x4 80 str x9, [rp],#8 81 tbnz n, #1, L(b10) 82 83L(b01): cbz x18, L(1) 84 85L(b00): ldp x6, x7, [up] 86 mul x8, x6, v0 87 umulh x10, x6, v0 88 ldp x4, x5, [up,#16] 89 mul x9, x7, v0 90 adcs x12, x8, x11 91 umulh x11, x7, v0 92 add rp, rp, #16 93 sub x18, x18, #1 94 cbz x18, L(end) 95 96 ALIGN(16) 97L(top): mul x8, x4, v0 98 ldp x6, x7, [up,#32]! 99 adcs x13, x9, x10 100 umulh x10, x4, v0 101 mul x9, x5, v0 102 stp x12, x13, [rp,#-16] 103 adcs x12, x8, x11 104 umulh x11, x5, v0 105L(mid): mul x8, x6, v0 106 ldp x4, x5, [up,#16] 107 adcs x13, x9, x10 108 umulh x10, x6, v0 109 mul x9, x7, v0 110 stp x12, x13, [rp],#32 111 adcs x12, x8, x11 112 umulh x11, x7, v0 113 sub x18, x18, #1 114 cbnz x18, L(top) 115 116L(end): mul x8, x4, v0 117 adcs x13, x9, x10 118 umulh x10, x4, v0 119 mul x9, x5, v0 120 stp x12, x13, [rp,#-16] 121L(2e): adcs x12, x8, x11 122 umulh x11, x5, v0 123 adcs x13, x9, x10 124 stp x12, x13, [rp] 125L(1): adc x0, x11, xzr 126 ret 127EPILOGUE() 128