1dnl ARM64 mpn_invert_limb -- Invert a normalized limb. 2 3dnl Contributed to the GNU project by Torbj��rn Granlund. 4 5dnl Copyright 2013 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 ? 37C Cortex-A57 ? 38 39C Compiler generated, mildly edited. Could surely be further optimised. 40 41ASM_START() 42PROLOGUE(mpn_invert_limb) 43 lsr x2, x0, #54 44 LEA_HI( x1, approx_tab) 45 and x2, x2, #0x1fe 46 LEA_LO( x1, approx_tab) 47 ldrh w3, [x1,x2] 48 lsr x4, x0, #24 49 add x4, x4, #1 50 ubfiz x2, x3, #11, #16 51 umull x3, w3, w3 52 mul x3, x3, x4 53 sub x2, x2, #1 54 sub x2, x2, x3, lsr #40 55 lsl x3, x2, #60 56 mul x1, x2, x2 57 msub x1, x1, x4, x3 58 lsl x2, x2, #13 59 add x1, x2, x1, lsr #47 60 and x2, x0, #1 61 neg x3, x2 62 and x3, x3, x1, lsr #1 63 add x2, x2, x0, lsr #1 64 msub x2, x1, x2, x3 65 umulh x2, x2, x1 66 lsl x1, x1, #31 67 add x1, x1, x2, lsr #1 68 mul x3, x1, x0 69 umulh x2, x1, x0 70 adds x4, x3, x0 71 adc x0, x2, x0 72 sub x0, x1, x0 73 ret 74EPILOGUE() 75 76 RODATA 77 ALIGN(2) 78 TYPE( approx_tab, object) 79 SIZE( approx_tab, 512) 80approx_tab: 81forloop(i,256,512-1,dnl 82` .hword eval(0x7fd00/i) 83')dnl 84