Blame sysdeps/sparc/sparc32/rshift.S
|
Packit |
6c4009 |
! sparc __mpn_rshift --
|
|
Packit |
6c4009 |
!
|
|
Packit |
6c4009 |
! Copyright (C) 1995-2018 Free Software Foundation, Inc.
|
|
Packit |
6c4009 |
!
|
|
Packit |
6c4009 |
! This file is part of the GNU MP Library.
|
|
Packit |
6c4009 |
!
|
|
Packit |
6c4009 |
! The GNU MP Library is free software; you can redistribute it and/or modify
|
|
Packit |
6c4009 |
! it under the terms of the GNU Lesser General Public License as published by
|
|
Packit |
6c4009 |
! the Free Software Foundation; either version 2.1 of the License, or (at your
|
|
Packit |
6c4009 |
! option) any later version.
|
|
Packit |
6c4009 |
!
|
|
Packit |
6c4009 |
! The GNU MP Library is distributed in the hope that it will be useful, but
|
|
Packit |
6c4009 |
! WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
Packit |
6c4009 |
! or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
|
Packit |
6c4009 |
! License for more details.
|
|
Packit |
6c4009 |
!
|
|
Packit |
6c4009 |
! You should have received a copy of the GNU Lesser General Public License
|
|
Packit |
6c4009 |
! along with the GNU MP Library; see the file COPYING.LIB. If not,
|
|
Packit |
6c4009 |
! see <http://www.gnu.org/licenses/>.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
! INPUT PARAMETERS
|
|
Packit |
6c4009 |
! RES_PTR %o0
|
|
Packit |
6c4009 |
! SRC_PTR %o1
|
|
Packit |
6c4009 |
! SIZE %o2
|
|
Packit |
6c4009 |
! CNT %o3
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#include <sysdep.h>
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
ENTRY(__mpn_rshift)
|
|
Packit |
6c4009 |
ld [%o1],%g2 ! load first limb
|
|
Packit |
6c4009 |
sub %g0,%o3,%o5 ! negate shift count
|
|
Packit |
6c4009 |
add %o2,-1,%o2
|
|
Packit |
6c4009 |
andcc %o2,4-1,%g4 ! number of limbs in first loop
|
|
Packit |
6c4009 |
sll %g2,%o5,%g1 ! compute function result
|
|
Packit |
6c4009 |
be LOC(0) ! if multiple of 4 limbs, skip first loop
|
|
Packit |
6c4009 |
st %g1,[%sp+80]
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
sub %o2,%g4,%o2 ! adjust count for main loop
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
LOC(loop0):
|
|
Packit |
6c4009 |
ld [%o1+4],%g3
|
|
Packit |
6c4009 |
add %o0,4,%o0
|
|
Packit |
6c4009 |
add %o1,4,%o1
|
|
Packit |
6c4009 |
addcc %g4,-1,%g4
|
|
Packit |
6c4009 |
srl %g2,%o3,%o4
|
|
Packit |
6c4009 |
sll %g3,%o5,%g1
|
|
Packit |
6c4009 |
mov %g3,%g2
|
|
Packit |
6c4009 |
or %o4,%g1,%o4
|
|
Packit |
6c4009 |
bne LOC(loop0)
|
|
Packit |
6c4009 |
st %o4,[%o0-4]
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
LOC(0): tst %o2
|
|
Packit |
6c4009 |
be LOC(end)
|
|
Packit |
6c4009 |
nop
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
LOC(loop):
|
|
Packit |
6c4009 |
ld [%o1+4],%g3
|
|
Packit |
6c4009 |
add %o0,16,%o0
|
|
Packit |
6c4009 |
addcc %o2,-4,%o2
|
|
Packit |
6c4009 |
srl %g2,%o3,%o4
|
|
Packit |
6c4009 |
sll %g3,%o5,%g1
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
ld [%o1+8],%g2
|
|
Packit |
6c4009 |
srl %g3,%o3,%g4
|
|
Packit |
6c4009 |
or %o4,%g1,%o4
|
|
Packit |
6c4009 |
st %o4,[%o0-16]
|
|
Packit |
6c4009 |
sll %g2,%o5,%g1
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
ld [%o1+12],%g3
|
|
Packit |
6c4009 |
srl %g2,%o3,%o4
|
|
Packit |
6c4009 |
or %g4,%g1,%g4
|
|
Packit |
6c4009 |
st %g4,[%o0-12]
|
|
Packit |
6c4009 |
sll %g3,%o5,%g1
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
ld [%o1+16],%g2
|
|
Packit |
6c4009 |
srl %g3,%o3,%g4
|
|
Packit |
6c4009 |
or %o4,%g1,%o4
|
|
Packit |
6c4009 |
st %o4,[%o0-8]
|
|
Packit |
6c4009 |
sll %g2,%o5,%g1
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
add %o1,16,%o1
|
|
Packit |
6c4009 |
or %g4,%g1,%g4
|
|
Packit |
6c4009 |
bne LOC(loop)
|
|
Packit |
6c4009 |
st %g4,[%o0-4]
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
LOC(end):
|
|
Packit |
6c4009 |
srl %g2,%o3,%g2
|
|
Packit |
6c4009 |
st %g2,[%o0-0]
|
|
Packit |
6c4009 |
retl
|
|
Packit |
6c4009 |
ld [%sp+80],%o0
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
END(__mpn_rshift)
|