From a89a14ef5da44684a16b204e7a70460cc8c4922a Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Fri, 21 Jun 2024 23:36:36 +0200 Subject: Basic constant folding implementation --- vendor/gmp-6.3.0/mpn/cray/cfp/addmul_1.c | 48 ++++++ vendor/gmp-6.3.0/mpn/cray/cfp/mul_1.c | 47 ++++++ vendor/gmp-6.3.0/mpn/cray/cfp/mulwwc90.s | 254 +++++++++++++++++++++++++++++++ vendor/gmp-6.3.0/mpn/cray/cfp/mulwwj90.s | 253 ++++++++++++++++++++++++++++++ vendor/gmp-6.3.0/mpn/cray/cfp/submul_1.c | 48 ++++++ 5 files changed, 650 insertions(+) create mode 100644 vendor/gmp-6.3.0/mpn/cray/cfp/addmul_1.c create mode 100644 vendor/gmp-6.3.0/mpn/cray/cfp/mul_1.c create mode 100644 vendor/gmp-6.3.0/mpn/cray/cfp/mulwwc90.s create mode 100644 vendor/gmp-6.3.0/mpn/cray/cfp/mulwwj90.s create mode 100644 vendor/gmp-6.3.0/mpn/cray/cfp/submul_1.c (limited to 'vendor/gmp-6.3.0/mpn/cray/cfp') diff --git a/vendor/gmp-6.3.0/mpn/cray/cfp/addmul_1.c b/vendor/gmp-6.3.0/mpn/cray/cfp/addmul_1.c new file mode 100644 index 0000000..9c7f383 --- /dev/null +++ b/vendor/gmp-6.3.0/mpn/cray/cfp/addmul_1.c @@ -0,0 +1,48 @@ +/* mpn_addmul_1 for Cray PVP. + +Copyright 1996, 2000, 2001 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 either: + + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at your + option) any later version. + +or + + * the GNU General Public License as published by the Free Software + Foundation; either version 2 of the License, or (at your option) any + later version. + +or both in parallel, as here. + +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 General Public License +for more details. + +You should have received copies of the GNU General Public License and the +GNU Lesser General Public License along with the GNU MP Library. If not, +see https://www.gnu.org/licenses/. */ + + +#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_limb_t p0[n], p1[n], tp[n]; + mp_limb_t cy_limb; + + GMPN_MULWW (p1, p0, up, &n, &limb); + cy_limb = mpn_add_n (tp, rp, p0, n); + rp[0] = tp[0]; + if (n != 1) + cy_limb += mpn_add_n (rp + 1, tp + 1, p1, n - 1); + cy_limb += p1[n - 1]; + + return cy_limb; +} diff --git a/vendor/gmp-6.3.0/mpn/cray/cfp/mul_1.c b/vendor/gmp-6.3.0/mpn/cray/cfp/mul_1.c new file mode 100644 index 0000000..33a6a05 --- /dev/null +++ b/vendor/gmp-6.3.0/mpn/cray/cfp/mul_1.c @@ -0,0 +1,47 @@ +/* mpn_mul_1 for Cray PVP. + +Copyright 1996, 2000, 2001 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 either: + + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at your + option) any later version. + +or + + * the GNU General Public License as published by the Free Software + Foundation; either version 2 of the License, or (at your option) any + later version. + +or both in parallel, as here. + +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 General Public License +for more details. + +You should have received copies of the GNU General Public License and the +GNU Lesser General Public License along with the GNU MP Library. If not, +see https://www.gnu.org/licenses/. */ + + +#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_limb_t p0[n], p1[n]; + mp_limb_t cy_limb; + + GMPN_MULWW (p1, p0, up, &n, &limb); + rp[0] = p0[0]; + cy_limb = p1[n - 1]; + if (n != 1) + cy_limb += mpn_add_n (rp + 1, p0 + 1, p1, n - 1); + + return cy_limb; +} diff --git a/vendor/gmp-6.3.0/mpn/cray/cfp/mulwwc90.s b/vendor/gmp-6.3.0/mpn/cray/cfp/mulwwc90.s new file mode 100644 index 0000000..71d2285 --- /dev/null +++ b/vendor/gmp-6.3.0/mpn/cray/cfp/mulwwc90.s @@ -0,0 +1,254 @@ +* Helper for mpn_mul_1, mpn_addmul_1, and mpn_submul_1 for Cray PVP. + +* Copyright 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 either: +* +* * the GNU Lesser General Public License as published by the Free +* Software Foundation; either version 3 of the License, or (at your +* option) any later version. +* +* or +* +* * the GNU General Public License as published by the Free Software +* Foundation; either version 2 of the License, or (at your option) any +* later version. +* +* or both in parallel, as here. +* +* 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 General Public License +* for more details. +* +* You should have received copies of the GNU General Public License and the +* GNU Lesser General Public License along with the GNU MP Library. If not, +* see https://www.gnu.org/licenses/. + + 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 + CON O'0535270000000000000000 + CON O'0000000000000001200012 + VWD 32/0,32/P.GMPN_MULWW + CON O'0014003000000000001416 + CON O'0000000000000000000011 + CON O'0000000000000000000215 + BSSZ 1 +@CODE SECTION CODE +@CODE = P.* +L3 = P.* + A0 A6 + A5 6 + B03,A5 0,A0 + A0 A1+A2 + A5 1 + 0,A0 T00,A5 + B02 A2 + B66 A3 + B01 A6 + A7 P.L4 + B00 A7 + A6 @DATA + J $STKOFEN +GMPN_MULWW = P.* + A0 @DATA+3 + B77 A0 + A1 13 + A0 B66 + A2 B66 + A4 B67 + 0,A0 B77,A1 + A7 782 + A3 A2+A7 + A0 A4-A3 + JAM L3 + A0 A6 + A5 6 + B03,A5 0,A0 + A0 A1+A2 + A5 1 + 0,A0 T00,A5 + B02 A2 + B66 A3 + B01 A6 +L4 = P.* + A7 B07 + S7 0,A7 + A6 B10 + S6 0,A6 + S5 1 + S4 <22 + S7 S7-S5 + S5 #S7 + T00 S6 + S6 S6>22 + S7 T00 + S7 S7>44 + S3 T00 + S3 S3&S4 + S6 S6&S4 + S7 S7&S4 + S3 S3<24 + S6 S6<24 + S7 S7<24 + S0 S5 + S4 S5 + S1 S6 + S2 S3 + S3 S7 + JSP L5 +L6 = P.* + S7 -S4 + A2 S7 + VL A2 + A3 B06 + A5 B05 + A4 B04 + A1 VL + A2 S4 +L7 = P.* + A0 A3 + VL A1 + V7 ,A0,1 + B11 A5 + A7 22 + B12 A4 + V6 V7>A7 + B13 A3 + S7 <22 + A3 B02 + V5 S7&V6 + A6 24 + V4 V5A5 + V2 S1*FV1 + V3 S7&V5 + A0 14 + B77 A0 + A4 B77 + A0 A4+A3 + ,A0,1 V2 + V0 V3A7 + V2 S2*FV0 + V3 V6+V2 + S7 <20 + V1 S7&V3 + A4 270 + A0 A4+A3 + ,A0,1 V0 + A4 14 + A0 A4+A3 + V7 ,A0,1 + V6 V1A5 + V0 S1*FV4 + A5 654 + A0 A5+A3 + ,A0,1 V1 + V6 V7+V0 + A5 2 + V2 V6A6 + A5 654 + CPW + A0 A5+A3 + V1 ,A0,1 + A5 398 + A0 A5+A3 + V3 ,A0,1 + V6 V4+V1 + V2 V3>A6 + V5 V6+V2 + A6 B12 + V4 V322 + S7 T00 + S7 S7>44 + S3 T00 + S3 S3&S4 + S6 S6&S4 + S7 S7&S4 + S3 S3<24 + S6 S6<24 + S7 S7<24 + S0 S5 + S4 S5 + S1 S6 + S2 S3 + S3 S7 + JSP L5 +L6 = P.* + S7 -S4 + A2 S7 + VL A2 + A3 B06 + A5 B05 + A4 B04 + A1 VL + A2 S4 +L7 = P.* + A0 A3 + VL A1 + V7 ,A0,1 + B11 A5 + A7 22 + B12 A4 + V6 V7>A7 + B13 A3 + S7 <22 + A3 B02 + V5 S7&V6 + A6 24 + V4 V5A5 + V2 S1*FV1 + V3 S7&V5 + A0 14 + B77 A0 + A4 B77 + A0 A4+A3 + ,A0,1 V2 + V0 V3A7 + V2 S2*FV0 + V3 V6+V2 + S7 <20 + V1 S7&V3 + A4 270 + A0 A4+A3 + ,A0,1 V0 + A4 14 + A0 A4+A3 + V7 ,A0,1 + V6 V1A5 + V0 S1*FV4 + A5 654 + A0 A5+A3 + ,A0,1 V1 + V6 V7+V0 + A5 2 + V2 V6A6 + A5 654 + A0 A5+A3 + V1 ,A0,1 + A5 398 + A0 A5+A3 + V3 ,A0,1 + V6 V4+V1 + V2 V3>A6 + V5 V6+V2 + A6 B12 + V4 V3