|
Packit |
6c4009 |
/* SPARC v9 __mpn_addmul_1 -- Multiply a limb vector with a single limb and
|
|
Packit |
6c4009 |
add the product to a second limb vector.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
Copyright (C) 1996-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 |
#include <sysdep.h>
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* INPUT PARAMETERS
|
|
Packit |
6c4009 |
res_ptr o0
|
|
Packit |
6c4009 |
s1_ptr o1
|
|
Packit |
6c4009 |
size o2
|
|
Packit |
6c4009 |
s2_limb o3 */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
ENTRY(__mpn_addmul_1)
|
|
Packit |
6c4009 |
save %sp,-192,%sp
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
sub %g0,%i2,%o7
|
|
Packit |
6c4009 |
mov 0,%o0 ! zero cy_limb
|
|
Packit |
6c4009 |
sllx %o7,3,%o7
|
|
Packit |
6c4009 |
sethi %hi(0x80000000),%o2
|
|
Packit |
6c4009 |
srl %i3,0,%o1 ! extract low 32 bits of s2_limb
|
|
Packit |
6c4009 |
sub %i1,%o7,%o3
|
|
Packit |
6c4009 |
srlx %i3,32,%i3 ! extract high 32 bits of s2_limb
|
|
Packit |
6c4009 |
sub %i0,%o7,%o4
|
|
Packit |
6c4009 |
add %o2,%o2,%o2 ! o2 = 0x100000000
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
! hi !
|
|
Packit |
6c4009 |
! mid-1 !
|
|
Packit |
6c4009 |
! mid-2 !
|
|
Packit |
6c4009 |
! lo !
|
|
Packit |
6c4009 |
1:
|
|
Packit |
6c4009 |
ldx [%o3+%o7],%g5
|
|
Packit |
6c4009 |
srl %g5,0,%i0 ! zero hi bits
|
|
Packit |
6c4009 |
ldx [%o4+%o7],%l1
|
|
Packit |
6c4009 |
srlx %g5,32,%g5
|
|
Packit |
6c4009 |
mulx %o1,%i0,%i4 ! lo product
|
|
Packit |
6c4009 |
mulx %i3,%i0,%i1 ! mid-1 product
|
|
Packit |
6c4009 |
mulx %o1,%g5,%l2 ! mid-2 product
|
|
Packit |
6c4009 |
mulx %i3,%g5,%i5 ! hi product
|
|
Packit |
6c4009 |
srlx %i4,32,%i0 ! extract high 32 bits of lo product...
|
|
Packit |
6c4009 |
add %i1,%i0,%i1 ! ...and add it to the mid-1 product
|
|
Packit |
6c4009 |
addcc %i1,%l2,%i1 ! add mid products
|
|
Packit |
6c4009 |
mov 0,%l0 ! we need the carry from that add...
|
|
Packit |
6c4009 |
movcs %xcc,%o2,%l0 ! ...compute it and...
|
|
Packit |
6c4009 |
sllx %i1,32,%i0 ! align low bits of mid product
|
|
Packit |
6c4009 |
add %i5,%l0,%i5 ! ...add to bit 32 of the hi product
|
|
Packit |
6c4009 |
srl %i4,0,%g5 ! zero high 32 bits of lo product
|
|
Packit |
6c4009 |
add %i0,%g5,%i0 ! combine into low 64 bits of result
|
|
Packit |
6c4009 |
srlx %i1,32,%i1 ! extract high bits of mid product...
|
|
Packit |
6c4009 |
addcc %i0,%o0,%i0 ! add cy_limb to low 64 bits of result
|
|
Packit |
6c4009 |
add %i5,%i1,%i1 ! ...and add them to the high result
|
|
Packit |
6c4009 |
mov 0,%g5
|
|
Packit |
6c4009 |
movcs %xcc,1,%g5
|
|
Packit |
6c4009 |
addcc %l1,%i0,%i0
|
|
Packit |
6c4009 |
stx %i0,[%o4+%o7]
|
|
Packit |
6c4009 |
add %g5,1,%l1
|
|
Packit |
6c4009 |
movcs %xcc,%l1,%g5
|
|
Packit |
6c4009 |
addcc %o7,8,%o7
|
|
Packit |
6c4009 |
bne,pt %xcc,1b
|
|
Packit |
6c4009 |
add %i1,%g5,%o0 ! compute new cy_limb
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
jmpl %i7+8, %g0
|
|
Packit |
6c4009 |
restore %o0,%g0,%o0
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
END(__mpn_addmul_1)
|