diff options
author | Ian Lynagh <igloo@earth.li> | 2007-07-05 21:52:40 +0000 |
---|---|---|
committer | Ian Lynagh <igloo@earth.li> | 2007-07-05 21:52:40 +0000 |
commit | fdf1cd0399158308769fcb2ab7e46e215a68d865 (patch) | |
tree | f6681f1e4c419db48133e66e2279255b6d4cb17e /rts/gmp/mpn/cray | |
parent | e552cfc427d2734b9a9629f2ab1d22f493e775f6 (diff) | |
download | haskell-fdf1cd0399158308769fcb2ab7e46e215a68d865.tar.gz |
Update the in-tree GMP; fixes trac #832
gmp is now in a top-level directory and we only have the tarball in the
darcs repo. It gets untarred if it is needed.
Diffstat (limited to 'rts/gmp/mpn/cray')
-rw-r--r-- | rts/gmp/mpn/cray/README | 14 | ||||
-rw-r--r-- | rts/gmp/mpn/cray/add_n.c | 96 | ||||
-rw-r--r-- | rts/gmp/mpn/cray/addmul_1.c | 46 | ||||
-rw-r--r-- | rts/gmp/mpn/cray/gmp-mparam.h | 27 | ||||
-rw-r--r-- | rts/gmp/mpn/cray/mul_1.c | 44 | ||||
-rw-r--r-- | rts/gmp/mpn/cray/mulww.f | 54 | ||||
-rw-r--r-- | rts/gmp/mpn/cray/mulww.s | 245 | ||||
-rw-r--r-- | rts/gmp/mpn/cray/sub_n.c | 97 | ||||
-rw-r--r-- | rts/gmp/mpn/cray/submul_1.c | 46 |
9 files changed, 0 insertions, 669 deletions
diff --git a/rts/gmp/mpn/cray/README b/rts/gmp/mpn/cray/README deleted file mode 100644 index 8195c67e21..0000000000 --- a/rts/gmp/mpn/cray/README +++ /dev/null @@ -1,14 +0,0 @@ -The (poorly optimized) code in this directory was originally written for a -j90 system, but finished on a c90. It should work on all Cray vector -computers. For the T3E and T3D systems, the `alpha' subdirectory at the -same level as the directory containing this file, is much better. - -* `+' seems to be faster than `|' when combining carries. - -* It is possible that the best multiply performance would be achived by - storing only 24 bits per element, and using lazy carry propagation. Before - calling i24mult, full carry propagation would be needed. - -* Supply tasking versions of the C loops. - - diff --git a/rts/gmp/mpn/cray/add_n.c b/rts/gmp/mpn/cray/add_n.c deleted file mode 100644 index 1fdb394993..0000000000 --- a/rts/gmp/mpn/cray/add_n.c +++ /dev/null @@ -1,96 +0,0 @@ -/* mpn_add_n -- Add two limb vectors of equal, non-zero length. - For Cray vector processors. - - Copyright (C) 1996, 2000 Free Software Foundation, Inc. - - This file is part of the GNU MP Library. - - The GNU MP Library is free software; you can redistribute it and/or modify - 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 - 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 - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with the GNU MP Library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA. */ - -#include "gmp.h" -#include "gmp-impl.h" - -mp_limb_t -mpn_add_n (c, a, b, n) - mp_ptr c; - mp_srcptr a, b; - mp_size_t n; -{ - mp_size_t i; - mp_size_t nm1 = n - 1; - int more_carries = 0; - int carry_out; - - /* For small operands the non-vector code is faster. */ - if (n < 16) - goto sequential; - - if (a == c || b == c) - { - TMP_DECL (marker); - TMP_MARK (marker); - if (c == a) - { - /* allocate temp space for a */ - mp_ptr ax = (mp_ptr) TMP_ALLOC (n * BYTES_PER_MP_LIMB); - MPN_COPY (ax, a, n); - a = (mp_srcptr) ax; - } - if (c == b) - { - /* allocate temp space for b */ - mp_ptr bx = (mp_ptr) TMP_ALLOC (n * BYTES_PER_MP_LIMB); - MPN_COPY (bx, b, n); - b = (mp_srcptr) bx; - } - carry_out = mpn_add_n (c, a, b, n); - TMP_FREE (marker); - return carry_out; - } - - carry_out = a[nm1] + b[nm1] < a[nm1]; - -#pragma _CRI ivdep /* Cray PVP systems */ - for (i = nm1; i > 0; i--) - { - int cy_in; - cy_in = a[i - 1] + b[i - 1] < a[i - 1]; - c[i] = a[i] + b[i] + cy_in; - more_carries += c[i] < cy_in; - } - c[0] = a[0] + b[0]; - - if (more_carries) - { - /* This won't vectorize, but we should come here rarely. */ - int cy; - sequential: - cy = 0; - for (i = 0; i < n; i++) - { - mp_limb_t ai, ci, t; - ai = a[i]; - t = b[i] + cy; - cy = t < cy; - ci = ai + t; - cy += ci < ai; - c[i] = ci; - } - carry_out = cy; - } - - return carry_out; -} diff --git a/rts/gmp/mpn/cray/addmul_1.c b/rts/gmp/mpn/cray/addmul_1.c deleted file mode 100644 index 031b4e8e8d..0000000000 --- a/rts/gmp/mpn/cray/addmul_1.c +++ /dev/null @@ -1,46 +0,0 @@ -/* mpn_addmul_1 for Cray PVP. - -Copyright (C) 1996, 2000 Free Software Foundation, Inc. - -This file is part of the GNU MP Library. - -The GNU MP Library is free software; you can redistribute it and/or modify -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 -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 -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public -License for more details. - -You should have received a copy of the GNU Lesser General Public License -along with the GNU MP Library; see the file COPYING.LIB. If not, write to -the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -MA 02111-1307, USA. */ - - -#include "gmp.h" -#include "gmp-impl.h" - -mp_limb_t -mpn_addmul_1 (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_limb_t limb) -{ - mp_ptr p0, p1, tp; - mp_limb_t cy_limb; - TMP_DECL (marker); - TMP_MARK (marker); - - p1 = TMP_ALLOC (n * BYTES_PER_MP_LIMB); - p0 = TMP_ALLOC (n * BYTES_PER_MP_LIMB); - tp = TMP_ALLOC (n * BYTES_PER_MP_LIMB); - - GMPN_MULWW (p1, p0, up, &n, &limb); - cy_limb = mpn_add_n (tp, rp, p0, n); - rp[0] = tp[0]; - cy_limb += mpn_add_n (rp + 1, tp + 1, p1, n - 1); - cy_limb += p1[n - 1]; - - TMP_FREE (marker); - return cy_limb; -} diff --git a/rts/gmp/mpn/cray/gmp-mparam.h b/rts/gmp/mpn/cray/gmp-mparam.h deleted file mode 100644 index 14f7b8e05b..0000000000 --- a/rts/gmp/mpn/cray/gmp-mparam.h +++ /dev/null @@ -1,27 +0,0 @@ -/* gmp-mparam.h -- Compiler/machine parameter header file. - -Copyright (C) 1991, 1993, 1994, 1996 Free Software Foundation, Inc. - -This file is part of the GNU MP Library. - -The GNU MP Library is free software; you can redistribute it and/or modify -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 -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 -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public -License for more details. - -You should have received a copy of the GNU Lesser General Public License -along with the GNU MP Library; see the file COPYING.LIB. If not, write to -the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -MA 02111-1307, USA. */ - -#define BITS_PER_MP_LIMB 64 -#define BYTES_PER_MP_LIMB 8 -#define BITS_PER_LONGINT 64 -#define BITS_PER_INT 64 -#define BITS_PER_SHORTINT 32 -#define BITS_PER_CHAR 8 diff --git a/rts/gmp/mpn/cray/mul_1.c b/rts/gmp/mpn/cray/mul_1.c deleted file mode 100644 index 0c8750b4ac..0000000000 --- a/rts/gmp/mpn/cray/mul_1.c +++ /dev/null @@ -1,44 +0,0 @@ -/* mpn_mul_1 for Cray PVP. - -Copyright (C) 1996, 2000 Free Software Foundation, Inc. - -This file is part of the GNU MP Library. - -The GNU MP Library is free software; you can redistribute it and/or modify -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 -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 -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public -License for more details. - -You should have received a copy of the GNU Lesser General Public License -along with the GNU MP Library; see the file COPYING.LIB. If not, write to -the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -MA 02111-1307, USA. */ - - -#include "gmp.h" -#include "gmp-impl.h" - -mp_limb_t -mpn_mul_1 (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_limb_t limb) -{ - mp_ptr p0, p1; - mp_limb_t cy_limb; - TMP_DECL (marker); - TMP_MARK (marker); - - p1 = TMP_ALLOC (n * BYTES_PER_MP_LIMB); - p0 = TMP_ALLOC (n * BYTES_PER_MP_LIMB); - - GMPN_MULWW (p1, p0, up, &n, &limb); - rp[0] = p0[0]; - cy_limb = mpn_add_n (rp + 1, p0 + 1, p1, n - 1); - cy_limb += p1[n - 1]; - - TMP_FREE (marker); - return cy_limb; -} diff --git a/rts/gmp/mpn/cray/mulww.f b/rts/gmp/mpn/cray/mulww.f deleted file mode 100644 index 99507c1e44..0000000000 --- a/rts/gmp/mpn/cray/mulww.f +++ /dev/null @@ -1,54 +0,0 @@ -c Helper for mpn_mul_1, mpn_addmul_1, and mpn_submul_1 for Cray PVP. - -c Copyright (C) 1996, 2000 Free Software Foundation, Inc. - -c This file is part of the GNU MP Library. - -c The GNU MP Library is free software; you can redistribute it and/or -c modify it under the terms of the GNU Lesser General Public License as -c published by the Free Software Foundation; either version 2.1 of the -c License, or (at your option) any later version. - -c The GNU MP Library is distributed in the hope that it will be useful, -c but WITHOUT ANY WARRANTY; without even the implied warranty of -c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -c Lesser General Public License for more details. - -c You should have received a copy of the GNU Lesser General Public -c License along with the GNU MP Library; see the file COPYING.LIB. If -c not, write to the Free Software Foundation, Inc., 59 Temple Place - -c Suite 330, Boston, MA 02111-1307, USA. - -c p1[] = hi(a[]*s); the upper limbs of each product -c p0[] = low(a[]*s); the corresponding lower limbs -c n is number of limbs in the vectors - - subroutine gmpn_mulww(p1,p0,a,n,s) - integer*8 p1(0:*),p0(0:*),a(0:*),s - integer n - - integer*8 a0,a1,a2,s0,s1,s2,c - integer*8 ai,t0,t1,t2,t3,t4 - - s0 = shiftl(and(s,4194303),24) - s1 = shiftl(and(shiftr(s,22),4194303),24) - s2 = shiftl(and(shiftr(s,44),4194303),24) - - do i = 0,n-1 - ai = a(i) - a0 = shiftl(and(ai,4194303),24) - a1 = shiftl(and(shiftr(ai,22),4194303),24) - a2 = shiftl(and(shiftr(ai,44),4194303),24) - - t0 = i24mult(a0,s0) - t1 = i24mult(a0,s1)+i24mult(a1,s0) - t2 = i24mult(a0,s2)+i24mult(a1,s1)+i24mult(a2,s0) - t3 = i24mult(a1,s2)+i24mult(a2,s1) - t4 = i24mult(a2,s2) - - p0(i)=shiftl(t2,44)+shiftl(t1,22)+t0 - c=shiftr(shiftr(t0,22)+and(t1,4398046511103)+ - $ shiftl(and(t2,1048575),22),42) - p1(i)=shiftl(t4,24)+shiftl(t3,2)+shiftr(t2,20)+shiftr(t1,42)+c - end do - end diff --git a/rts/gmp/mpn/cray/mulww.s b/rts/gmp/mpn/cray/mulww.s deleted file mode 100644 index 890cdcf94d..0000000000 --- a/rts/gmp/mpn/cray/mulww.s +++ /dev/null @@ -1,245 +0,0 @@ -* Helper for mpn_mul_1, mpn_addmul_1, and mpn_submul_1 for Cray PVP. - -* Copyright (C) 1996, 2000 Free Software Foundation, Inc. -* This file is generated from mulww.f in this same directory. - -* This file is part of the GNU MP Library. - -* The GNU MP Library is free software; you can redistribute it and/or -* modify 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 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -* Lesser General Public License for more details. - -* You should have received a copy of the GNU Lesser General Public -* License along with the GNU MP Library; see the file COPYING.LIB. If -* not, write to the Free Software Foundation, Inc., 59 Temple Place - -* Suite 330, Boston, MA 02111-1307, USA. - - IDENT GMPN_MULWW -********************************************** -* Assemble with Cal Version 2.0 * -* * -* Generated by CFT77 6.0.4.19 * -* on 06/27/00 at 04:34:13 * -* * -********************************************** -* ALLOW UNDERSCORES IN IDENTIFIERS - EDIT OFF - FORMAT NEW -@DATA SECTION DATA,CM -@DATA = W.* - CON O'0000000000040000000000 - CON O'0435152404713723252514 ;GMPN_MUL 1 - CON O'0535270000000000000000 ;WW 1 - CON O'0000000000000001200012 ;trbk tbl 1 - VWD 32/0,32/P.GMPN_MULWW ;trbk tbl 1 - CON O'0014003000000000001416 ;trbk tbl 1 - CON O'0000000000000000000011 ;trbk tbl 1 - CON O'0000000000000000000215 ;trbk tbl 1 - BSSZ 1 ;trbk tbl 1 -@CODE SECTION CODE -@CODE = P.* -L3 = P.* ; 1 - A0 A6 ;arg base 1 - A5 6 ;num Darg 1 - B03,A5 0,A0 ;load DAs 1 - A0 A1+A2 ; 1 - A5 1 ;num Ts 1 - 0,A0 T00,A5 ; 1 - B02 A2 ;new base 1 - B66 A3 ;stk top 1 - B01 A6 ;arg base 1 - A7 P.L4 ;ofrn rtn 1 - B00 A7 ;return 1 - A6 @DATA ; 1 - J $STKOFEN ;$STKOFEN 1 -GMPN_MULWW = P.* ; 1 - A0 @DATA+3 ;(trbk) 1 - B77 A0 ;(trbk) 1 - A1 13 ;num Bs 1 - A0 B66 ;stk top 1 - A2 B66 ;stk tmp 1 - A4 B67 ;stk limt 1 - 0,A0 B77,A1 ; 1 - A7 782 ;stk size 1 - A3 A2+A7 ; 1 - A0 A4-A3 ; 1 - JAM L3 ;overflow 1 - A0 A6 ;arg base 1 - A5 6 ;num Darg 1 - B03,A5 0,A0 ;load DAs 1 - A0 A1+A2 ; 1 - A5 1 ;num Ts 1 - 0,A0 T00,A5 ; 1 - B02 A2 ;new base 1 - B66 A3 ;new top 1 - B01 A6 ;arg base 1 -L4 = P.* ;ofrn rtn 1 - A7 B07 ;regs 14 - S7 0,A7 ; 14 - A6 B10 ;regs 9 - S6 0,A6 ; 9 - S5 1 ; 14 - S4 <22 ; 9 - S7 S7-S5 ; 14 - S5 #S7 ; 14 - T00 S6 ;regs 10 - S6 S6>22 ; 10 - S7 T00 ;regs 11 - S7 S7>44 ; 11 - S3 T00 ;regs 9 - S3 S3&S4 ; 9 - S6 S6&S4 ; 10 - S7 S7&S4 ; 11 - S3 S3<24 ; 9 - S6 S6<24 ; 10 - S7 S7<24 ; 11 - S0 S5 ;regs 14 - S4 S5 ;regs 14 - S1 S6 ;regs 14 - S2 S3 ;regs 14 - S3 S7 ;regs 14 - JSP L5 ; 14 -L6 = P.* ; 14 - S7 -S4 ; 14 - A2 S7 ;regs 14 - VL A2 ;regs 14 - A3 B06 ;s_bt_sp 14 - A5 B05 ;s_bt_sp 14 - A4 B04 ;s_bt_sp 14 - A1 VL ; 14 - A2 S4 ;regs 14 -L7 = P.* ; 14 - A0 A3 ;regs 15 - VL A1 ;regs 15 - V7 ,A0,1 ; 15 - B11 A5 ;s_bt_sp 15 - A7 22 ; 17 - B12 A4 ;s_bt_sp 17 - V6 V7>A7 ; 17 - B13 A3 ;s_bt_sp 17 - S7 <22 ; 17 - A3 B02 ;s_bt_sp 17 - V5 S7&V6 ; 17 - A6 24 ; 17 - V4 V5<A6 ; 17 - V3 S1*FV4 ; 22 - V2 S7&V7 ; 16 - V1 V2<A6 ; 16 - V0 S3*FV1 ; 22 - V6 V0+V3 ; 22 - A5 44 ; 18 - V5 V7>A5 ; 18 - V2 S1*FV1 ; 21 - V3 S7&V5 ; 18 - A0 14 ; 34 - B77 A0 ;regs 34 - A4 B77 ;regs 34 - A0 A4+A3 ; 34 - ,A0,1 V2 ;v_ld_str 34 - V0 V3<A6 ; 18 - V7 S2*FV1 ; 20 - A4 142 ; 34 - A0 A4+A3 ; 34 - ,A0,1 V7 ;v_ld_str 34 - V5 V7>A7 ; 28 - V2 S2*FV0 ; 22 - V3 V6+V2 ; 22 - S7 <20 ; 28 - V1 S7&V3 ; 28 - A4 270 ; 34 - A0 A4+A3 ; 34 - ,A0,1 V0 ;v_ld_str 34 - A4 14 ; 34 - A0 A4+A3 ; 34 - V7 ,A0,1 ;v_ld_str 34 - V6 V1<A7 ; 28 - V2 S2*FV4 ; 21 - V0 V7+V2 ; 21 - S7 <42 ; 28 - V1 S7&V0 ; 28 - A4 398 ; 34 - A0 A4+A3 ; 34 - ,A0,1 V0 ;v_ld_str 34 - V7 S3*FV4 ; 23 - V2 V5+V1 ; 28 - V0 V3<A5 ; 26 - A5 526 ; 34 - A0 A5+A3 ; 34 - ,A0,1 V0 ;v_ld_str 34 - A5 270 ; 34 - A0 A5+A3 ; 34 - V4 ,A0,1 ;v_ld_str 34 - V5 V2+V6 ; 28 - A5 20 ; 32 - V1 V3>A5 ; 32 - V0 S1*FV4 ; 23 - A5 654 ; 34 - A0 A5+A3 ; 34 - ,A0,1 V1 ;v_ld_str 34 - V6 V7+V0 ; 23 - A5 2 ; 32 - V2 V6<A5 ; 32 - V3 S3*FV4 ; 24 - A5 142 ; 34 - A0 A5+A3 ; 34 - V1 ,A0,1 ;v_ld_str 34 - A5 526 ; 34 - A0 A5+A3 ; 34 - V7 ,A0,1 ;v_ld_str 34 - V0 V1+V7 ; 26 - V6 V3<A6 ; 32 - V4 V6+V2 ; 32 - A6 42 ; 28 - V7 V5>A6 ; 28 - A5 654 ; 34 - CPW ;cmr_vrsp 34 - A0 A5+A3 ; 34 - V1 ,A0,1 ;v_ld_str 34 - A5 398 ; 34 - A0 A5+A3 ; 34 - V3 ,A0,1 ;v_ld_str 34 - V6 V4+V1 ; 32 - V2 V3>A6 ; 32 - V5 V6+V2 ; 32 - A6 B12 ;s_bt_sp 32 - V4 V3<A7 ; 26 - A7 B13 ;regs 34 - A3 A7+A1 ; 34 - A7 B11 ;regs 34 - A5 A7+A1 ; 34 - A4 A6+A1 ; 34 - A7 A2+A1 ; 34 - A0 A2+A1 ; 34 - A2 128 ; 34 - B13 A0 ;s_bt_sp 34 - V1 V0+V4 ; 26 - A0 B11 ;regs 31 - ,A0,1 V1 ; 31 - V6 V5+V7 ; 33 - A0 A6 ;regs 33 - ,A0,1 V6 ; 33 - A0 B13 ;regs 34 - A1 A2 ;regs 34 - A2 A7 ;regs 34 - JAN L7 ; 34 -L8 = P.* ; 34 -L5 = P.* ; 34 - S1 0 ; 35 - A0 B02 ; 35 - A2 B02 ; 35 - A1 13 ;num Bs 35 - B66 A0 ; 35 - B77,A1 0,A0 ; 35 - A0 A2+A1 ; 35 - A1 1 ;num Ts 35 - T00,A1 0,A0 ; 35 - J B00 ; 35 - EXT $STKOFEN:p - ENTRY GMPN_MULWW - END diff --git a/rts/gmp/mpn/cray/sub_n.c b/rts/gmp/mpn/cray/sub_n.c deleted file mode 100644 index 902e07a727..0000000000 --- a/rts/gmp/mpn/cray/sub_n.c +++ /dev/null @@ -1,97 +0,0 @@ -/* mpn_sub_n -- Subtract two limb vectors of equal, non-zero length. - For Cray vector processors. - - Copyright (C) 1996, 2000 Free Software Foundation, Inc. - - This file is part of the GNU MP Library. - - The GNU MP Library is free software; you can redistribute it and/or modify - 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 - 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 - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with the GNU MP Library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA. */ - -#include "gmp.h" -#include "gmp-impl.h" - -mp_limb_t -mpn_sub_n (c, a, b, n) - mp_ptr c; - mp_srcptr a, b; - mp_size_t n; -{ - mp_size_t i; - mp_size_t nm1 = n - 1; - int more_carries = 0; - int carry_out; - - /* For small operands the non-vector code is faster. */ - if (n < 16) - goto sequential; - - if (a == c || b == c) - { - TMP_DECL (marker); - TMP_MARK (marker); - if (c == a) - { - /* allocate temp space for a */ - mp_ptr ax = (mp_ptr) TMP_ALLOC (n * BYTES_PER_MP_LIMB); - MPN_COPY (ax, a, n); - a = (mp_srcptr) ax; - } - if (c == b) - { - /* allocate temp space for b */ - mp_ptr bx = (mp_ptr) TMP_ALLOC (n * BYTES_PER_MP_LIMB); - MPN_COPY (bx, b, n); - b = (mp_srcptr) bx; - } - carry_out = mpn_sub_n (c, a, b, n); - TMP_FREE (marker); - return carry_out; - } - - carry_out = a[nm1] < b[nm1]; - -#pragma _CRI ivdep /* Cray PVP systems */ - for (i = nm1; i > 0; i--) - { - int cy_in; mp_limb_t t; - cy_in = a[i - 1] < b[i - 1]; - t = a[i] - b[i]; - more_carries += t < cy_in; - c[i] = t - cy_in; - } - c[0] = a[0] - b[0]; - - if (more_carries) - { - /* This won't vectorize, but we should come here rarely. */ - int cy; - sequential: - cy = 0; - for (i = 0; i < n; i++) - { - mp_limb_t ai, ci, t; - ai = a[i]; - t = b[i] + cy; - cy = t < cy; - ci = ai - t; - cy += ci > ai; - c[i] = ci; - } - carry_out = cy; - } - - return carry_out; -} diff --git a/rts/gmp/mpn/cray/submul_1.c b/rts/gmp/mpn/cray/submul_1.c deleted file mode 100644 index 4d2fb13c62..0000000000 --- a/rts/gmp/mpn/cray/submul_1.c +++ /dev/null @@ -1,46 +0,0 @@ -/* mpn_submul_1 for Cray PVP. - -Copyright (C) 1996, 2000 Free Software Foundation, Inc. - -This file is part of the GNU MP Library. - -The GNU MP Library is free software; you can redistribute it and/or modify -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 -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 -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public -License for more details. - -You should have received a copy of the GNU Lesser General Public License -along with the GNU MP Library; see the file COPYING.LIB. If not, write to -the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -MA 02111-1307, USA. */ - - -#include "gmp.h" -#include "gmp-impl.h" - -mp_limb_t -mpn_submul_1 (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_limb_t limb) -{ - mp_ptr p0, p1, tp; - mp_limb_t cy_limb; - TMP_DECL (marker); - TMP_MARK (marker); - - p1 = TMP_ALLOC (n * BYTES_PER_MP_LIMB); - p0 = TMP_ALLOC (n * BYTES_PER_MP_LIMB); - tp = TMP_ALLOC (n * BYTES_PER_MP_LIMB); - - GMPN_MULWW (p1, p0, up, &n, &limb); - cy_limb = mpn_sub_n (tp, rp, p0, n); - rp[0] = tp[0]; - cy_limb += mpn_sub_n (rp + 1, tp + 1, p1, n - 1); - cy_limb += p1[n - 1]; - - TMP_FREE (marker); - return cy_limb; -} |