1995-10-16 01:18:40 +00:00
|
|
|
# Alpha 21064 __mpn_rshift --
|
|
|
|
|
2024-01-01 18:12:26 +00:00
|
|
|
# Copyright (C) 1994-2024 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
|
|
|
|
# cnt r19
|
|
|
|
|
|
|
|
# This code runs at 4.8 cycles/limb on the 21064. With infinite unrolling,
|
|
|
|
# it would take 4 cycles/limb. It should be possible to get down to 3
|
|
|
|
# cycles/limb since both ldq and stq can be paired with the other used
|
|
|
|
# instructions. But there are many restrictions in the 21064 pipeline that
|
|
|
|
# makes it hard, if not impossible, to get down to 3 cycles/limb:
|
|
|
|
|
|
|
|
# 1. ldq has a 3 cycle delay, srl and sll have a 2 cycle delay.
|
|
|
|
# 2. Only aligned instruction pairs can be paired.
|
|
|
|
# 3. The store buffer or silo might not be able to deal with the bandwidth.
|
1996-03-01 18:43:45 +00:00
|
|
|
|
1995-10-16 01:18:40 +00:00
|
|
|
.set noreorder
|
|
|
|
.set noat
|
|
|
|
.text
|
|
|
|
.align 3
|
|
|
|
.globl __mpn_rshift
|
|
|
|
.ent __mpn_rshift
|
|
|
|
__mpn_rshift:
|
|
|
|
.frame $30,0,$26,0
|
|
|
|
|
|
|
|
ldq $4,0($17) # load first limb
|
|
|
|
addq $17,8,$17
|
|
|
|
subq $31,$19,$7
|
|
|
|
subq $18,1,$18
|
|
|
|
and $18,4-1,$20 # number of limbs in first loop
|
|
|
|
sll $4,$7,$0 # compute function result
|
|
|
|
|
1996-03-01 18:43:45 +00:00
|
|
|
beq $20,.L0
|
1995-10-16 01:18:40 +00:00
|
|
|
subq $18,$20,$18
|
|
|
|
|
|
|
|
.align 3
|
1996-03-01 18:43:45 +00:00
|
|
|
.Loop0:
|
1995-10-16 01:18:40 +00:00
|
|
|
ldq $3,0($17)
|
|
|
|
addq $16,8,$16
|
|
|
|
addq $17,8,$17
|
|
|
|
subq $20,1,$20
|
|
|
|
srl $4,$19,$5
|
|
|
|
sll $3,$7,$6
|
|
|
|
bis $3,$3,$4
|
|
|
|
bis $5,$6,$8
|
|
|
|
stq $8,-8($16)
|
1996-03-01 18:43:45 +00:00
|
|
|
bne $20,.Loop0
|
1995-10-16 01:18:40 +00:00
|
|
|
|
1996-03-01 18:43:45 +00:00
|
|
|
.L0: beq $18,.Lend
|
1995-10-16 01:18:40 +00:00
|
|
|
|
|
|
|
.align 3
|
1996-03-01 18:43:45 +00:00
|
|
|
.Loop: ldq $3,0($17)
|
1995-10-16 01:18:40 +00:00
|
|
|
addq $16,32,$16
|
|
|
|
subq $18,4,$18
|
|
|
|
srl $4,$19,$5
|
|
|
|
sll $3,$7,$6
|
|
|
|
|
|
|
|
ldq $4,8($17)
|
|
|
|
srl $3,$19,$1
|
|
|
|
bis $5,$6,$8
|
|
|
|
stq $8,-32($16)
|
|
|
|
sll $4,$7,$2
|
|
|
|
|
|
|
|
ldq $3,16($17)
|
|
|
|
srl $4,$19,$5
|
|
|
|
bis $1,$2,$8
|
|
|
|
stq $8,-24($16)
|
|
|
|
sll $3,$7,$6
|
|
|
|
|
|
|
|
ldq $4,24($17)
|
|
|
|
srl $3,$19,$1
|
|
|
|
bis $5,$6,$8
|
|
|
|
stq $8,-16($16)
|
|
|
|
sll $4,$7,$2
|
|
|
|
|
|
|
|
addq $17,32,$17
|
|
|
|
bis $1,$2,$8
|
|
|
|
stq $8,-8($16)
|
|
|
|
|
1996-03-01 18:43:45 +00:00
|
|
|
bgt $18,.Loop
|
1995-10-16 01:18:40 +00:00
|
|
|
|
1996-03-01 18:43:45 +00:00
|
|
|
.Lend: srl $4,$19,$8
|
1995-10-16 01:18:40 +00:00
|
|
|
stq $8,0($16)
|
|
|
|
ret $31,($26),1
|
|
|
|
.end __mpn_rshift
|