|
Packit |
5c3484 |
dnl ARM64 mpn_invert_limb -- Invert a normalized limb.
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
dnl Contributed to the GNU project by Torbjörn Granlund.
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
dnl Copyright 2013 Free Software Foundation, Inc.
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
dnl This file is part of the GNU MP Library.
|
|
Packit |
5c3484 |
dnl
|
|
Packit |
5c3484 |
dnl The GNU MP Library is free software; you can redistribute it and/or modify
|
|
Packit |
5c3484 |
dnl it under the terms of either:
|
|
Packit |
5c3484 |
dnl
|
|
Packit |
5c3484 |
dnl * the GNU Lesser General Public License as published by the Free
|
|
Packit |
5c3484 |
dnl Software Foundation; either version 3 of the License, or (at your
|
|
Packit |
5c3484 |
dnl option) any later version.
|
|
Packit |
5c3484 |
dnl
|
|
Packit |
5c3484 |
dnl or
|
|
Packit |
5c3484 |
dnl
|
|
Packit |
5c3484 |
dnl * the GNU General Public License as published by the Free Software
|
|
Packit |
5c3484 |
dnl Foundation; either version 2 of the License, or (at your option) any
|
|
Packit |
5c3484 |
dnl later version.
|
|
Packit |
5c3484 |
dnl
|
|
Packit |
5c3484 |
dnl or both in parallel, as here.
|
|
Packit |
5c3484 |
dnl
|
|
Packit |
5c3484 |
dnl The GNU MP Library is distributed in the hope that it will be useful, but
|
|
Packit |
5c3484 |
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
Packit |
5c3484 |
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
Packit |
5c3484 |
dnl for more details.
|
|
Packit |
5c3484 |
dnl
|
|
Packit |
5c3484 |
dnl You should have received copies of the GNU General Public License and the
|
|
Packit |
5c3484 |
dnl GNU Lesser General Public License along with the GNU MP Library. If not,
|
|
Packit |
5c3484 |
dnl see https://www.gnu.org/licenses/.
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
include(`../config.m4')
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
C cycles/limb
|
|
Packit |
5c3484 |
C Cortex-A53 ?
|
|
Packit |
5c3484 |
C Cortex-A57 ?
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
C Compiler generated, mildly edited. Could surely be further optimised.
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
ASM_START()
|
|
Packit |
5c3484 |
PROLOGUE(mpn_invert_limb)
|
|
Packit |
5c3484 |
lsr x2, x0, #54
|
|
Packit |
5c3484 |
adrp x1, approx_tab
|
|
Packit |
5c3484 |
and x2, x2, #0x1fe
|
|
Packit |
5c3484 |
add x1, x1, :lo12:approx_tab
|
|
Packit |
5c3484 |
ldrh w3, [x1,x2]
|
|
Packit |
5c3484 |
lsr x4, x0, #24
|
|
Packit |
5c3484 |
add x4, x4, #1
|
|
Packit |
5c3484 |
ubfiz x2, x3, #11, #16
|
|
Packit |
5c3484 |
umull x3, w3, w3
|
|
Packit |
5c3484 |
mul x3, x3, x4
|
|
Packit |
5c3484 |
sub x2, x2, #1
|
|
Packit |
5c3484 |
sub x2, x2, x3, lsr #40
|
|
Packit |
5c3484 |
lsl x3, x2, #60
|
|
Packit |
5c3484 |
mul x1, x2, x2
|
|
Packit |
5c3484 |
msub x1, x1, x4, x3
|
|
Packit |
5c3484 |
lsl x2, x2, #13
|
|
Packit |
5c3484 |
add x1, x2, x1, lsr #47
|
|
Packit |
5c3484 |
and x2, x0, #1
|
|
Packit |
5c3484 |
neg x3, x2
|
|
Packit |
5c3484 |
and x3, x3, x1, lsr #1
|
|
Packit |
5c3484 |
add x2, x2, x0, lsr #1
|
|
Packit |
5c3484 |
msub x2, x1, x2, x3
|
|
Packit |
5c3484 |
umulh x2, x2, x1
|
|
Packit |
5c3484 |
lsl x1, x1, #31
|
|
Packit |
5c3484 |
add x1, x1, x2, lsr #1
|
|
Packit |
5c3484 |
mul x3, x1, x0
|
|
Packit |
5c3484 |
umulh x2, x1, x0
|
|
Packit |
5c3484 |
adds x4, x3, x0
|
|
Packit |
5c3484 |
adc x0, x2, x0
|
|
Packit |
5c3484 |
sub x0, x1, x0
|
|
Packit |
5c3484 |
ret
|
|
Packit |
5c3484 |
EPILOGUE()
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
RODATA
|
|
Packit |
5c3484 |
ALIGN(2)
|
|
Packit |
5c3484 |
TYPE( approx_tab, object)
|
|
Packit |
5c3484 |
SIZE( approx_tab, 512)
|
|
Packit |
5c3484 |
approx_tab:
|
|
Packit |
5c3484 |
forloop(i,256,512-1,dnl
|
|
Packit |
5c3484 |
` .hword eval(0x7fd00/i)
|
|
Packit |
5c3484 |
')dnl
|