1995-10-16 01:18:40 +00:00
|
|
|
# Alpha 21064 __mpn_addmul_1 -- Multiply a limb vector with a limb and add
|
|
|
|
# the result to a second limb vector.
|
|
|
|
|
2022-01-01 18:54:23 +00:00
|
|
|
# Copyright (C) 1992-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 r16
|
|
|
|
# s1_ptr r17
|
|
|
|
# size r18
|
|
|
|
# s2_limb r19
|
|
|
|
|
1996-03-01 18:43:45 +00:00
|
|
|
# This code runs at 42 cycles/limb on EV4 and 18 cycles/limb on EV5.
|
1995-10-16 01:18:40 +00:00
|
|
|
|
|
|
|
.set noreorder
|
|
|
|
.set noat
|
|
|
|
.text
|
|
|
|
.align 3
|
|
|
|
.globl __mpn_addmul_1
|
|
|
|
.ent __mpn_addmul_1 2
|
|
|
|
__mpn_addmul_1:
|
|
|
|
.frame $30,0,$26
|
|
|
|
|
|
|
|
ldq $2,0($17) # $2 = s1_limb
|
|
|
|
addq $17,8,$17 # s1_ptr++
|
|
|
|
subq $18,1,$18 # size--
|
|
|
|
mulq $2,$19,$3 # $3 = prod_low
|
|
|
|
ldq $5,0($16) # $5 = *res_ptr
|
|
|
|
umulh $2,$19,$0 # $0 = prod_high
|
1996-03-01 18:43:45 +00:00
|
|
|
beq $18,.Lend1 # jump if size was == 1
|
1995-10-16 01:18:40 +00:00
|
|
|
ldq $2,0($17) # $2 = s1_limb
|
|
|
|
addq $17,8,$17 # s1_ptr++
|
|
|
|
subq $18,1,$18 # size--
|
|
|
|
addq $5,$3,$3
|
|
|
|
cmpult $3,$5,$4
|
|
|
|
stq $3,0($16)
|
|
|
|
addq $16,8,$16 # res_ptr++
|
1996-03-01 18:43:45 +00:00
|
|
|
beq $18,.Lend2 # jump if size was == 2
|
1995-10-16 01:18:40 +00:00
|
|
|
|
|
|
|
.align 3
|
1996-03-01 18:43:45 +00:00
|
|
|
.Loop: mulq $2,$19,$3 # $3 = prod_low
|
1995-10-16 01:18:40 +00:00
|
|
|
ldq $5,0($16) # $5 = *res_ptr
|
|
|
|
addq $4,$0,$0 # cy_limb = cy_limb + 'cy'
|
|
|
|
subq $18,1,$18 # size--
|
|
|
|
umulh $2,$19,$4 # $4 = cy_limb
|
|
|
|
ldq $2,0($17) # $2 = s1_limb
|
|
|
|
addq $17,8,$17 # s1_ptr++
|
|
|
|
addq $3,$0,$3 # $3 = cy_limb + prod_low
|
|
|
|
cmpult $3,$0,$0 # $0 = carry from (cy_limb + prod_low)
|
|
|
|
addq $5,$3,$3
|
|
|
|
cmpult $3,$5,$5
|
|
|
|
stq $3,0($16)
|
|
|
|
addq $16,8,$16 # res_ptr++
|
|
|
|
addq $5,$0,$0 # combine carries
|
1996-03-01 18:43:45 +00:00
|
|
|
bne $18,.Loop
|
1995-10-16 01:18:40 +00:00
|
|
|
|
1996-03-01 18:43:45 +00:00
|
|
|
.Lend2: mulq $2,$19,$3 # $3 = prod_low
|
1995-10-16 01:18:40 +00:00
|
|
|
ldq $5,0($16) # $5 = *res_ptr
|
|
|
|
addq $4,$0,$0 # cy_limb = cy_limb + 'cy'
|
|
|
|
umulh $2,$19,$4 # $4 = cy_limb
|
|
|
|
addq $3,$0,$3 # $3 = cy_limb + prod_low
|
|
|
|
cmpult $3,$0,$0 # $0 = carry from (cy_limb + prod_low)
|
|
|
|
addq $5,$3,$3
|
|
|
|
cmpult $3,$5,$5
|
|
|
|
stq $3,0($16)
|
|
|
|
addq $5,$0,$0 # combine carries
|
|
|
|
addq $4,$0,$0 # cy_limb = prod_high + cy
|
|
|
|
ret $31,($26),1
|
1996-03-01 18:43:45 +00:00
|
|
|
.Lend1: addq $5,$3,$3
|
1995-10-16 01:18:40 +00:00
|
|
|
cmpult $3,$5,$5
|
|
|
|
stq $3,0($16)
|
|
|
|
addq $0,$5,$0
|
|
|
|
ret $31,($26),1
|
|
|
|
|
|
|
|
.end __mpn_addmul_1
|