1995-10-16 01:18:40 +00:00
|
|
|
# Alpha __mpn_add_n -- Add two limb vectors of the same length > 0 and
|
|
|
|
# store sum in a third limb vector.
|
|
|
|
|
2022-01-01 18:54:23 +00:00
|
|
|
# Copyright (C) 1995-2022 Free Software Foundation, Inc.
|
1995-10-16 01:18:40 +00:00
|
|
|
|
|
|
|
# This file is part of the GNU MP Library.
|
|
|
|
|
|
|
|
# The GNU MP Library is free software; you can redistribute it and/or modify
|
2001-07-07 10:13:33 +00:00
|
|
|
# it under the terms of the GNU Lesser General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2.1 of the License, or (at your
|
1995-10-16 01:18:40 +00:00
|
|
|
# option) any later version.
|
|
|
|
|
|
|
|
# The GNU MP Library is distributed in the hope that it will be useful, but
|
|
|
|
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
2001-07-07 10:13:33 +00:00
|
|
|
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
1995-10-16 01:18:40 +00:00
|
|
|
# License for more details.
|
|
|
|
|
2001-07-07 10:13:33 +00:00
|
|
|
# You should have received a copy of the GNU Lesser General Public License
|
Prefer https to http for gnu.org and fsf.org URLs
Also, change sources.redhat.com to sourceware.org.
This patch was automatically generated by running the following shell
script, which uses GNU sed, and which avoids modifying files imported
from upstream:
sed -ri '
s,(http|ftp)(://(.*\.)?(gnu|fsf|sourceware)\.org($|[^.]|\.[^a-z])),https\2,g
s,(http|ftp)(://(.*\.)?)sources\.redhat\.com($|[^.]|\.[^a-z]),https\2sourceware.org\4,g
' \
$(find $(git ls-files) -prune -type f \
! -name '*.po' \
! -name 'ChangeLog*' \
! -path COPYING ! -path COPYING.LIB \
! -path manual/fdl-1.3.texi ! -path manual/lgpl-2.1.texi \
! -path manual/texinfo.tex ! -path scripts/config.guess \
! -path scripts/config.sub ! -path scripts/install-sh \
! -path scripts/mkinstalldirs ! -path scripts/move-if-change \
! -path INSTALL ! -path locale/programs/charmap-kw.h \
! -path po/libc.pot ! -path sysdeps/gnu/errlist.c \
! '(' -name configure \
-execdir test -f configure.ac -o -f configure.in ';' ')' \
! '(' -name preconfigure \
-execdir test -f preconfigure.ac ';' ')' \
-print)
and then by running 'make dist-prepare' to regenerate files built
from the altered files, and then executing the following to cleanup:
chmod a+x sysdeps/unix/sysv/linux/riscv/configure
# Omit irrelevant whitespace and comment-only changes,
# perhaps from a slightly-different Autoconf version.
git checkout -f \
sysdeps/csky/configure \
sysdeps/hppa/configure \
sysdeps/riscv/configure \
sysdeps/unix/sysv/linux/csky/configure
# Omit changes that caused a pre-commit check to fail like this:
# remote: *** error: sysdeps/powerpc/powerpc64/ppc-mcount.S: trailing lines
git checkout -f \
sysdeps/powerpc/powerpc64/ppc-mcount.S \
sysdeps/unix/sysv/linux/s390/s390-64/syscall.S
# Omit change that caused a pre-commit check to fail like this:
# remote: *** error: sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S: last line does not end in newline
git checkout -f sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S
2019-09-07 05:40:42 +00:00
|
|
|
# along with the GNU MP Library. If not, see <https://www.gnu.org/licenses/>.
|
1995-10-16 01:18:40 +00:00
|
|
|
|
|
|
|
|
|
|
|
# INPUT PARAMETERS
|
|
|
|
# res_ptr $16
|
|
|
|
# s1_ptr $17
|
|
|
|
# s2_ptr $18
|
|
|
|
# size $19
|
|
|
|
|
|
|
|
.set noreorder
|
|
|
|
.set noat
|
|
|
|
.text
|
|
|
|
.align 3
|
|
|
|
.globl __mpn_add_n
|
|
|
|
.ent __mpn_add_n
|
|
|
|
__mpn_add_n:
|
|
|
|
.frame $30,0,$26,0
|
|
|
|
|
1996-03-01 18:43:45 +00:00
|
|
|
or $31,$31,$25 # clear cy
|
|
|
|
subq $19,4,$19 # decr loop cnt
|
|
|
|
blt $19,.Lend2 # if less than 4 limbs, goto 2nd loop
|
|
|
|
# Start software pipeline for 1st loop
|
|
|
|
ldq $0,0($18)
|
|
|
|
ldq $1,8($18)
|
|
|
|
ldq $4,0($17)
|
1995-10-16 01:18:40 +00:00
|
|
|
ldq $5,8($17)
|
1996-03-01 18:43:45 +00:00
|
|
|
addq $17,32,$17 # update s1_ptr
|
|
|
|
ldq $2,16($18)
|
|
|
|
addq $0,$4,$20 # 1st main add
|
|
|
|
ldq $3,24($18)
|
|
|
|
subq $19,4,$19 # decr loop cnt
|
|
|
|
ldq $6,-16($17)
|
|
|
|
cmpult $20,$0,$25 # compute cy from last add
|
|
|
|
ldq $7,-8($17)
|
|
|
|
addq $1,$25,$28 # cy add
|
|
|
|
addq $18,32,$18 # update s2_ptr
|
|
|
|
addq $5,$28,$21 # 2nd main add
|
|
|
|
cmpult $28,$25,$8 # compute cy from last add
|
|
|
|
blt $19,.Lend1 # if less than 4 limbs remain, jump
|
|
|
|
# 1st loop handles groups of 4 limbs in a software pipeline
|
1995-10-16 01:18:40 +00:00
|
|
|
.align 4
|
1996-03-01 18:43:45 +00:00
|
|
|
.Loop: cmpult $21,$28,$25 # compute cy from last add
|
|
|
|
ldq $0,0($18)
|
|
|
|
or $8,$25,$25 # combine cy from the two adds
|
|
|
|
ldq $1,8($18)
|
|
|
|
addq $2,$25,$28 # cy add
|
|
|
|
ldq $4,0($17)
|
|
|
|
addq $28,$6,$22 # 3rd main add
|
1995-10-16 01:18:40 +00:00
|
|
|
ldq $5,8($17)
|
1996-03-01 18:43:45 +00:00
|
|
|
cmpult $28,$25,$8 # compute cy from last add
|
|
|
|
cmpult $22,$28,$25 # compute cy from last add
|
1995-10-16 01:18:40 +00:00
|
|
|
stq $20,0($16)
|
1996-03-01 18:43:45 +00:00
|
|
|
or $8,$25,$25 # combine cy from the two adds
|
1995-10-16 01:18:40 +00:00
|
|
|
stq $21,8($16)
|
1996-03-01 18:43:45 +00:00
|
|
|
addq $3,$25,$28 # cy add
|
|
|
|
addq $28,$7,$23 # 4th main add
|
|
|
|
cmpult $28,$25,$8 # compute cy from last add
|
|
|
|
cmpult $23,$28,$25 # compute cy from last add
|
|
|
|
addq $17,32,$17 # update s1_ptr
|
|
|
|
or $8,$25,$25 # combine cy from the two adds
|
|
|
|
addq $16,32,$16 # update res_ptr
|
|
|
|
addq $0,$25,$28 # cy add
|
|
|
|
ldq $2,16($18)
|
|
|
|
addq $4,$28,$20 # 1st main add
|
|
|
|
ldq $3,24($18)
|
|
|
|
cmpult $28,$25,$8 # compute cy from last add
|
|
|
|
ldq $6,-16($17)
|
|
|
|
cmpult $20,$28,$25 # compute cy from last add
|
|
|
|
ldq $7,-8($17)
|
|
|
|
or $8,$25,$25 # combine cy from the two adds
|
|
|
|
subq $19,4,$19 # decr loop cnt
|
|
|
|
stq $22,-16($16)
|
|
|
|
addq $1,$25,$28 # cy add
|
|
|
|
stq $23,-8($16)
|
|
|
|
addq $5,$28,$21 # 2nd main add
|
|
|
|
addq $18,32,$18 # update s2_ptr
|
|
|
|
cmpult $28,$25,$8 # compute cy from last add
|
|
|
|
bge $19,.Loop
|
|
|
|
# Finish software pipeline for 1st loop
|
|
|
|
.Lend1: cmpult $21,$28,$25 # compute cy from last add
|
|
|
|
or $8,$25,$25 # combine cy from the two adds
|
|
|
|
addq $2,$25,$28 # cy add
|
|
|
|
addq $28,$6,$22 # 3rd main add
|
|
|
|
cmpult $28,$25,$8 # compute cy from last add
|
|
|
|
cmpult $22,$28,$25 # compute cy from last add
|
|
|
|
stq $20,0($16)
|
|
|
|
or $8,$25,$25 # combine cy from the two adds
|
|
|
|
stq $21,8($16)
|
|
|
|
addq $3,$25,$28 # cy add
|
|
|
|
addq $28,$7,$23 # 4th main add
|
|
|
|
cmpult $28,$25,$8 # compute cy from last add
|
|
|
|
cmpult $23,$28,$25 # compute cy from last add
|
|
|
|
or $8,$25,$25 # combine cy from the two adds
|
|
|
|
addq $16,32,$16 # update res_ptr
|
|
|
|
stq $22,-16($16)
|
|
|
|
stq $23,-8($16)
|
|
|
|
.Lend2: addq $19,4,$19 # restore loop cnt
|
|
|
|
beq $19,.Lret
|
|
|
|
# Start software pipeline for 2nd loop
|
|
|
|
ldq $0,0($18)
|
|
|
|
ldq $4,0($17)
|
|
|
|
subq $19,1,$19
|
|
|
|
beq $19,.Lend0
|
|
|
|
# 2nd loop handles remaining 1-3 limbs
|
|
|
|
.align 4
|
|
|
|
.Loop0: addq $0,$25,$28 # cy add
|
|
|
|
ldq $0,8($18)
|
|
|
|
addq $4,$28,$20 # main add
|
|
|
|
ldq $4,8($17)
|
|
|
|
addq $18,8,$18
|
|
|
|
cmpult $28,$25,$8 # compute cy from last add
|
|
|
|
addq $17,8,$17
|
|
|
|
stq $20,0($16)
|
|
|
|
cmpult $20,$28,$25 # compute cy from last add
|
|
|
|
subq $19,1,$19 # decr loop cnt
|
|
|
|
or $8,$25,$25 # combine cy from the two adds
|
|
|
|
addq $16,8,$16
|
|
|
|
bne $19,.Loop0
|
|
|
|
.Lend0: addq $0,$25,$28 # cy add
|
|
|
|
addq $4,$28,$20 # main add
|
|
|
|
cmpult $28,$25,$8 # compute cy from last add
|
|
|
|
cmpult $20,$28,$25 # compute cy from last add
|
|
|
|
stq $20,0($16)
|
|
|
|
or $8,$25,$25 # combine cy from the two adds
|
1995-10-16 01:18:40 +00:00
|
|
|
|
1996-03-01 18:43:45 +00:00
|
|
|
.Lret: or $25,$31,$0 # return cy
|
1995-10-16 01:18:40 +00:00
|
|
|
ret $31,($26),1
|
|
|
|
.end __mpn_add_n
|