|
Packit |
5c3484 |
dnl ARM64 mpn_add_n and mpn_sub_n
|
|
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 |
changecom(@&*$)
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
define(`rp', `x0')
|
|
Packit |
5c3484 |
define(`up', `x1')
|
|
Packit |
5c3484 |
define(`vp', `x2')
|
|
Packit |
5c3484 |
define(`n', `x3')
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
ifdef(`OPERATION_add_n', `
|
|
Packit |
5c3484 |
define(`ADDSUBC', adcs)
|
|
Packit |
5c3484 |
define(`CLRCY', `cmn xzr, xzr')
|
|
Packit |
5c3484 |
define(`SETCY', `cmp $1, #1')
|
|
Packit |
5c3484 |
define(`RETVAL', `adc x0, xzr, xzr')
|
|
Packit |
5c3484 |
define(`func', mpn_add_n)
|
|
Packit |
5c3484 |
define(`func_nc', mpn_add_nc)')
|
|
Packit |
5c3484 |
ifdef(`OPERATION_sub_n', `
|
|
Packit |
5c3484 |
define(`ADDSUBC', sbcs)
|
|
Packit |
5c3484 |
define(`CLRCY', `cmp xzr, xzr')
|
|
Packit |
5c3484 |
define(`SETCY', `subs $1, xzr, $1')
|
|
Packit |
5c3484 |
define(`RETVAL', `sbc x0, xzr, xzr
|
|
Packit |
5c3484 |
and x0, x0, #1')
|
|
Packit |
5c3484 |
define(`func', mpn_sub_n)
|
|
Packit |
5c3484 |
define(`func_nc', mpn_sub_nc)')
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
MULFUNC_PROLOGUE(mpn_add_n mpn_add_nc mpn_sub_n mpn_sub_nc)
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
ASM_START()
|
|
Packit |
5c3484 |
PROLOGUE(func_nc)
|
|
Packit |
5c3484 |
SETCY( x4)
|
|
Packit |
5c3484 |
b L(ent)
|
|
Packit |
5c3484 |
EPILOGUE()
|
|
Packit |
5c3484 |
PROLOGUE(func)
|
|
Packit |
5c3484 |
CLRCY
|
|
Packit |
5c3484 |
L(ent): tbz n, #0, L(b0)
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
ldr x4, [up],#8
|
|
Packit |
5c3484 |
ldr x6, [vp],#8
|
|
Packit |
5c3484 |
sub n, n, #1
|
|
Packit |
5c3484 |
ADDSUBC x8, x4, x6
|
|
Packit |
5c3484 |
str x8, [rp],#8
|
|
Packit |
5c3484 |
cbz n, L(rt)
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
L(b0): ldp x4, x5, [up],#16
|
|
Packit |
5c3484 |
ldp x6, x7, [vp],#16
|
|
Packit |
5c3484 |
sub n, n, #2
|
|
Packit |
5c3484 |
ADDSUBC x8, x4, x6
|
|
Packit |
5c3484 |
ADDSUBC x9, x5, x7
|
|
Packit |
5c3484 |
cbz n, L(end)
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
L(top): ldp x4, x5, [up],#16
|
|
Packit |
5c3484 |
ldp x6, x7, [vp],#16
|
|
Packit |
5c3484 |
sub n, n, #2
|
|
Packit |
5c3484 |
stp x8, x9, [rp],#16
|
|
Packit |
5c3484 |
ADDSUBC x8, x4, x6
|
|
Packit |
5c3484 |
ADDSUBC x9, x5, x7
|
|
Packit |
5c3484 |
cbnz n, L(top)
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
L(end): stp x8, x9, [rp]
|
|
Packit |
5c3484 |
L(rt): RETVAL
|
|
Packit |
5c3484 |
ret
|
|
Packit |
5c3484 |
EPILOGUE()
|