|
Packit |
5c3484 |
c Helper for mpn_mul_1, mpn_addmul_1, and mpn_submul_1 for Cray PVP.
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
c Copyright 1996, 2000 Free Software Foundation, Inc.
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
c This file is part of the GNU MP Library.
|
|
Packit |
5c3484 |
c
|
|
Packit |
5c3484 |
c The GNU MP Library is free software; you can redistribute it and/or modify
|
|
Packit |
5c3484 |
c it under the terms of either:
|
|
Packit |
5c3484 |
c
|
|
Packit |
5c3484 |
c * the GNU Lesser General Public License as published by the Free
|
|
Packit |
5c3484 |
c Software Foundation; either version 3 of the License, or (at your
|
|
Packit |
5c3484 |
c option) any later version.
|
|
Packit |
5c3484 |
c
|
|
Packit |
5c3484 |
c or
|
|
Packit |
5c3484 |
c
|
|
Packit |
5c3484 |
c * the GNU General Public License as published by the Free Software
|
|
Packit |
5c3484 |
c Foundation; either version 2 of the License, or (at your option) any
|
|
Packit |
5c3484 |
c later version.
|
|
Packit |
5c3484 |
c
|
|
Packit |
5c3484 |
c or both in parallel, as here.
|
|
Packit |
5c3484 |
c
|
|
Packit |
5c3484 |
c The GNU MP Library is distributed in the hope that it will be useful, but
|
|
Packit |
5c3484 |
c WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
Packit |
5c3484 |
c or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
Packit |
5c3484 |
c for more details.
|
|
Packit |
5c3484 |
c
|
|
Packit |
5c3484 |
c You should have received copies of the GNU General Public License and the
|
|
Packit |
5c3484 |
c GNU Lesser General Public License along with the GNU MP Library. If not,
|
|
Packit |
5c3484 |
c see https://www.gnu.org/licenses/.
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
c p1[] = hi(a[]*s); the upper limbs of each product
|
|
Packit |
5c3484 |
c p0[] = low(a[]*s); the corresponding lower limbs
|
|
Packit |
5c3484 |
c n is number of limbs in the vectors
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
subroutine gmpn_mulww(p1,p0,a,n,s)
|
|
Packit |
5c3484 |
integer*8 p1(0:*),p0(0:*),a(0:*),s
|
|
Packit |
5c3484 |
integer n
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
integer*8 a0,a1,a2,s0,s1,s2,c
|
|
Packit |
5c3484 |
integer*8 ai,t0,t1,t2,t3,t4
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
s0 = shiftl(and(s,4194303),24)
|
|
Packit |
5c3484 |
s1 = shiftl(and(shiftr(s,22),4194303),24)
|
|
Packit |
5c3484 |
s2 = shiftl(and(shiftr(s,44),4194303),24)
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
do i = 0,n-1
|
|
Packit |
5c3484 |
ai = a(i)
|
|
Packit |
5c3484 |
a0 = shiftl(and(ai,4194303),24)
|
|
Packit |
5c3484 |
a1 = shiftl(and(shiftr(ai,22),4194303),24)
|
|
Packit |
5c3484 |
a2 = shiftl(and(shiftr(ai,44),4194303),24)
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
t0 = i24mult(a0,s0)
|
|
Packit |
5c3484 |
t1 = i24mult(a0,s1)+i24mult(a1,s0)
|
|
Packit |
5c3484 |
t2 = i24mult(a0,s2)+i24mult(a1,s1)+i24mult(a2,s0)
|
|
Packit |
5c3484 |
t3 = i24mult(a1,s2)+i24mult(a2,s1)
|
|
Packit |
5c3484 |
t4 = i24mult(a2,s2)
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
p0(i)=shiftl(t2,44)+shiftl(t1,22)+t0
|
|
Packit |
5c3484 |
c=shiftr(shiftr(t0,22)+and(t1,4398046511103)+
|
|
Packit |
5c3484 |
$ shiftl(and(t2,1048575),22),42)
|
|
Packit |
5c3484 |
p1(i)=shiftl(t4,24)+shiftl(t3,2)+shiftr(t2,20)+shiftr(t1,42)+c
|
|
Packit |
5c3484 |
end do
|
|
Packit |
5c3484 |
end
|