Annotation of OpenXM_contrib/gmp/mpn/cray/mulww.f, Revision 1.1.1.2
1.1 maekawa 1: c Helper for mpn_mul_1, mpn_addmul_1, and mpn_submul_1 for Cray PVP.
2:
1.1.1.2 ! ohara 3: c Copyright 1996, 2000 Free Software Foundation, Inc.
1.1 maekawa 4:
5: c This file is part of the GNU MP Library.
6:
7: c The GNU MP Library is free software; you can redistribute it and/or
8: c modify it under the terms of the GNU Lesser General Public License as
9: c published by the Free Software Foundation; either version 2.1 of the
10: c License, or (at your option) any later version.
11:
12: c The GNU MP Library is distributed in the hope that it will be useful,
13: c but WITHOUT ANY WARRANTY; without even the implied warranty of
14: c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15: c Lesser General Public License for more details.
16:
17: c You should have received a copy of the GNU Lesser General Public
18: c License along with the GNU MP Library; see the file COPYING.LIB. If
19: c not, write to the Free Software Foundation, Inc., 59 Temple Place -
20: c Suite 330, Boston, MA 02111-1307, USA.
21:
22: c p1[] = hi(a[]*s); the upper limbs of each product
23: c p0[] = low(a[]*s); the corresponding lower limbs
24: c n is number of limbs in the vectors
25:
26: subroutine gmpn_mulww(p1,p0,a,n,s)
27: integer*8 p1(0:*),p0(0:*),a(0:*),s
28: integer n
29:
30: integer*8 a0,a1,a2,s0,s1,s2,c
31: integer*8 ai,t0,t1,t2,t3,t4
32:
33: s0 = shiftl(and(s,4194303),24)
34: s1 = shiftl(and(shiftr(s,22),4194303),24)
35: s2 = shiftl(and(shiftr(s,44),4194303),24)
36:
37: do i = 0,n-1
38: ai = a(i)
39: a0 = shiftl(and(ai,4194303),24)
40: a1 = shiftl(and(shiftr(ai,22),4194303),24)
41: a2 = shiftl(and(shiftr(ai,44),4194303),24)
42:
43: t0 = i24mult(a0,s0)
44: t1 = i24mult(a0,s1)+i24mult(a1,s0)
45: t2 = i24mult(a0,s2)+i24mult(a1,s1)+i24mult(a2,s0)
46: t3 = i24mult(a1,s2)+i24mult(a2,s1)
47: t4 = i24mult(a2,s2)
48:
49: p0(i)=shiftl(t2,44)+shiftl(t1,22)+t0
50: c=shiftr(shiftr(t0,22)+and(t1,4398046511103)+
51: $ shiftl(and(t2,1048575),22),42)
52: p1(i)=shiftl(t4,24)+shiftl(t3,2)+shiftr(t2,20)+shiftr(t1,42)+c
53: end do
54: end
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>