glibc/sysdeps/alpha/alphaev5/sub_n.S

148 lines
4.4 KiB
ArmAsm
Raw Normal View History

1996-03-01 18:43:45 +00:00
# Alpha __mpn_sub_n -- Subtract two limb vectors of the same length > 0 and
# store difference in a third limb vector.
# Copyright (C) 1995-2020 Free Software Foundation, Inc.
1996-03-01 18:43:45 +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
1996-03-01 18:43:45 +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
1996-03-01 18:43:45 +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/>.
1996-03-01 18:43:45 +00:00
# INPUT PARAMETERS
# res_ptr $16
# s1_ptr $17
# s2_ptr $18
# size $19
.set noreorder
.set noat
.text
.align 3
.globl __mpn_sub_n
.ent __mpn_sub_n
__mpn_sub_n:
.frame $30,0,$26,0
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)
ldq $5,8($17)
addq $17,32,$17 # update s1_ptr
ldq $2,16($18)
subq $4,$0,$20 # 1st main sub
ldq $3,24($18)
subq $19,4,$19 # decr loop cnt
ldq $6,-16($17)
cmpult $4,$20,$25 # compute cy from last sub
ldq $7,-8($17)
addq $1,$25,$28 # cy add
addq $18,32,$18 # update s2_ptr
subq $5,$28,$21 # 2nd main sub
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
.align 4
.Loop: cmpult $5,$21,$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)
subq $6,$28,$22 # 3rd main sub
ldq $5,8($17)
cmpult $28,$25,$8 # compute cy from last add
cmpult $6,$22,$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
subq $7,$28,$23 # 4th main sub
cmpult $28,$25,$8 # compute cy from last add
cmpult $7,$23,$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)
subq $4,$28,$20 # 1st main sub
ldq $3,24($18)
cmpult $28,$25,$8 # compute cy from last add
ldq $6,-16($17)
cmpult $4,$20,$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)
subq $5,$28,$21 # 2nd main sub
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 $5,$21,$25 # compute cy from last add
or $8,$25,$25 # combine cy from the two adds
addq $2,$25,$28 # cy add
subq $6,$28,$22 # 3rd main sub
cmpult $28,$25,$8 # compute cy from last add
cmpult $6,$22,$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
subq $7,$28,$23 # 4th main sub
cmpult $28,$25,$8 # compute cy from last add
cmpult $7,$23,$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)
subq $4,$28,$20 # main sub
ldq $1,8($17)
addq $18,8,$18
cmpult $28,$25,$8 # compute cy from last add
addq $17,8,$17
stq $20,0($16)
cmpult $4,$20,$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
or $1,$31,$4
bne $19,.Loop0
.Lend0: addq $0,$25,$28 # cy add
subq $4,$28,$20 # main sub
cmpult $28,$25,$8 # compute cy from last add
cmpult $4,$20,$25 # compute cy from last add
stq $20,0($16)
or $8,$25,$25 # combine cy from the two adds
.Lret: or $25,$31,$0 # return cy
ret $31,($26),1
.end __mpn_sub_n