Sunday, February 02, 2020

Re: Update: devel/gmp needs testing on other archs

On Sun, 2 Feb 2020 22:39:16 +0100
Christian Weisgerber wrote:

> This updates devel/gmp to 6.2.0.
> gmp has a ton of machine-specific optimizations, so success on one
> arch doesn't mean it will work elsewhere.
>
> I have successfully run the regression tests on
> * aarch64
> * amd64
> * i386
>
> I'd like to see it tested on a few more archs, say, powerpc/sparc64/
> mips64, before I commit it.

There is no failure on macppc, see

https://bin.charlenew.xyz/gmp.powerpc.test.log

>
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/devel/gmp/Makefile,v
> retrieving revision 1.40
> diff -u -p -r1.40 Makefile
> --- Makefile 12 Jul 2019 20:44:10 -0000 1.40
> +++ Makefile 2 Feb 2020 21:33:07 -0000
> @@ -3,16 +3,14 @@
> COMMENT-main= library for arbitrary precision arithmetic
> COMMENT-cxx= C++ library for arbitrary precision arithmetic
>
> -VERSION= 6.1.2
> +VERSION= 6.2.0
> DISTNAME= gmp-${VERSION}
> MULTI_PACKAGES= -main -cxx
> PKGNAME-main= gmp-${VERSION}
> PKGNAME-cxx= gmpxx-${VERSION}
> -REVISION= 3
> -REVISION-cxx= 4
>
> -SHARED_LIBS += gmp 10.0 # 13.2
> -SHARED_LIBS += gmpxx 2.0 # 9.2
> +SHARED_LIBS += gmp 11.0 # 14.0
> +SHARED_LIBS += gmpxx 3.0 # 10.0
> CATEGORIES= devel math
>
> HOMEPAGE= https://gmplib.org/
> @@ -35,8 +33,7 @@ LIB_DEPENDS-cxx=${BASE_PKGPATH},-main \
> PSEUDO_FLAVORS= no_cxx bootstrap
> FLAVOR?=
>
> -CONFIGURE_STYLE=autoconf
> -AUTOCONF_VERSION=2.69
> +CONFIGURE_STYLE=gnu
> # Don't try to optimize for the local CPU submodel
> CONFIGURE_ARGS+=--build=${MACHINE_ARCH}-unknown-openbsd${OSrev}
>
> @@ -45,11 +42,5 @@ CONFIGURE_ARGS+=--build=${MACHINE_ARCH}-
> COMPILER= base-clang ports-gcc base-gcc
> CONFIGURE_ARGS+=--enable-cxx
> .endif
> -
> -post-patch:
> - @cp ${FILESDIR}/mpn_m88k_add_n.asm $
> {WRKSRC}/mpn/m88k/add_n.asm
> - @cp ${FILESDIR}/mpn_m88k_sub_n.asm $
> {WRKSRC}/mpn/m88k/sub_n.asm
> - @rm ${WRKSRC}/mpn/m88k/add_n.s ${WRKSRC}/mpn/m88k/sub_n.s \
> - ${WRKSRC}/mpn/m88k/mul_1.s
>
> .include <bsd.port.mk>
> Index: distinfo
> ===================================================================
> RCS file: /cvs/ports/devel/gmp/distinfo,v
> retrieving revision 1.17
> diff -u -p -r1.17 distinfo
> --- distinfo 19 Dec 2016 21:48:12 -0000 1.17
> +++ distinfo 2 Feb 2020 21:33:07 -0000
> @@ -1,2 +1,2 @@
> -SHA256 (gmp-6.1.2.tar.xz) =
> h7Vl6JqaaE/k6+7duDmdziWZ+ckEmFTKjA373qDiGRI= -SIZE (gmp-6.1.2.tar.xz)
> = 1946336 +SHA256 (gmp-6.2.0.tar.xz) =
> JY5s1Rs/vfwYXHFtVfgsCK/1ffDG+9FDz27VYSZ6FSY= +SIZE (gmp-6.2.0.tar.xz)
> = 2012444 Index: files/mpn_m88k_add_n.asm
> ===================================================================
> RCS file: files/mpn_m88k_add_n.asm
> diff -N files/mpn_m88k_add_n.asm
> --- files/mpn_m88k_add_n.asm 13 Apr 2013 20:19:50 -0000
> 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000
> @@ -1,117 +0,0 @@
> -dnl mc88100 mpn_add_n -- Add two limb vectors of the same length > 0
> and store -dnl sum in a third limb vector.
> -
> -dnl Copyright 1992, 1994, 1995, 2000 Free Software Foundation, Inc.
> -
> -dnl This file is part of the GNU MP Library.
> -
> -dnl The GNU MP Library is free software; you can redistribute it
> and/or modify -dnl it under the terms of the GNU Lesser General
> Public License as published by -dnl the Free Software Foundation;
> either version 3 of the License, or (at your -dnl option) any later
> version. -
> -dnl The GNU MP Library is distributed in the hope that it will be
> useful, but -dnl WITHOUT ANY WARRANTY; without even the implied
> warranty of MERCHANTABILITY -dnl or FITNESS FOR A PARTICULAR
> PURPOSE. See the GNU Lesser General Public -dnl License for more
> details. -
> -dnl You should have received a copy of the GNU Lesser General Public
> License -dnl along with the GNU MP Library. If not, see
> http://www.gnu.org/licenses/. -
> -include(`../config.m4')
> -
> -
> -C INPUT PARAMETERS
> -C res_ptr %r2
> -C s1_ptr %r3
> -C s2_ptr %r4
> -C size %r5
> -
> -C This code has been optimized to run one instruction per clock,
> avoiding -C load stalls and writeback contention. As a result, the
> instruction -C order is not always natural.
> -
> -C The speed is about 4.6 clocks/limb + 18 clocks/limb-vector on an
> 88100, -C but on the 88110, it seems to run much slower, 6.6
> clocks/limb. -
> -ASM_START()
> -PROLOGUE(mpn_add_n)
> - ld %r6,%r3,0 C read first limb from
> s1_ptr
> - extu %r10,%r5,3
> - ld %r7,%r4,0 C read first limb from
> s2_ptr -
> - subu.co %r5,%r0,%r5 C (clear carry as
> side effect)
> - mak %r5,%r5,3<4>
> - bcnd eq0,%r5,Lzero
> -
> -ifdef(`PIC',`
> - or %r9,%r0,%r25
> - or %r11,%r0,%r1
> - or.u %r25,%r0,%hi16(.Lpic#abdiff)
> - bsr.n .Lpic
> - or %r25,%r25,%lo16(.Lpic#abdiff)
> -.Lpic: add %r25,%r25,%r1
> - or %r1,%r0,%r11
> - or.u %r11,%r0,%hi16(Lbase#got_rel)
> - or %r11,%r11,%lo16(Lbase#got_rel)
> - ld %r12,%r25,%r11
> - or %r25,%r0,%r9
> -',`
> - or %r12,%r0,%lo16(Lbase)
> - or.u %r12,%r12,%hi16(Lbase)
> -')
> - addu %r12,%r12,%r5 C %r12 is address
> for entering in loop -
> - extu %r5,%r5,2 C divide by 4
> - subu %r2,%r2,%r5 C adjust res_ptr
> - subu %r3,%r3,%r5 C adjust s1_ptr
> - subu %r4,%r4,%r5 C adjust s2_ptr
> -
> - or %r8,%r6,%r0
> -
> - jmp.n %r12
> - or %r9,%r7,%r0
> -
> -Loop: addu %r3,%r3,32
> - st %r8,%r2,28
> - addu %r4,%r4,32
> - ld %r6,%r3,0
> - addu %r2,%r2,32
> - ld %r7,%r4,0
> -Lzero: subu %r10,%r10,1 C add 0 + 8r
> limbs (adj loop cnt) -Lbase: ld %r8,%r3,4
> - addu.cio %r6,%r6,%r7
> - ld %r9,%r4,4
> - st %r6,%r2,0
> - ld %r6,%r3,8 C add 7 + 8r limbs
> - addu.cio %r8,%r8,%r9
> - ld %r7,%r4,8
> - st %r8,%r2,4
> - ld %r8,%r3,12 C add 6 + 8r limbs
> - addu.cio %r6,%r6,%r7
> - ld %r9,%r4,12
> - st %r6,%r2,8
> - ld %r6,%r3,16 C add 5 + 8r limbs
> - addu.cio %r8,%r8,%r9
> - ld %r7,%r4,16
> - st %r8,%r2,12
> - ld %r8,%r3,20 C add 4 + 8r limbs
> - addu.cio %r6,%r6,%r7
> - ld %r9,%r4,20
> - st %r6,%r2,16
> - ld %r6,%r3,24 C add 3 + 8r limbs
> - addu.cio %r8,%r8,%r9
> - ld %r7,%r4,24
> - st %r8,%r2,20
> - ld %r8,%r3,28 C add 2 + 8r limbs
> - addu.cio %r6,%r6,%r7
> - ld %r9,%r4,28
> - st %r6,%r2,24
> - bcnd.n ne0,%r10,Loop C add 1 + 8r limbs
> - addu.cio %r8,%r8,%r9
> -
> - st %r8,%r2,28 C store most significant
> limb -
> - jmp.n %r1
> - addu.ci %r2,%r0,%r0 C return carry-out from
> most sign. limb -EPILOGUE(mpn_add_n)
> Index: files/mpn_m88k_sub_n.asm
> ===================================================================
> RCS file: files/mpn_m88k_sub_n.asm
> diff -N files/mpn_m88k_sub_n.asm
> --- files/mpn_m88k_sub_n.asm 13 Apr 2013 20:19:50 -0000
> 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000
> @@ -1,118 +0,0 @@
> -dnl mc88100 mpn_sub_n -- Subtract two limb vectors of the same
> length > 0 and -dnl store difference in a third limb vector.
> -
> -dnl Copyright 1992, 1994, 1996, 2000 Free Software Foundation, Inc.
> -
> -dnl This file is part of the GNU MP Library.
> -
> -dnl The GNU MP Library is free software; you can redistribute it
> and/or modify -dnl it under the terms of the GNU Lesser General
> Public License as published by -dnl the Free Software Foundation;
> either version 3 of the License, or (at your -dnl option) any later
> version. -
> -dnl The GNU MP Library is distributed in the hope that it will be
> useful, but -dnl WITHOUT ANY WARRANTY; without even the implied
> warranty of MERCHANTABILITY -dnl or FITNESS FOR A PARTICULAR
> PURPOSE. See the GNU Lesser General Public -dnl License for more
> details. -
> -dnl You should have received a copy of the GNU Lesser General Public
> License -dnl along with the GNU MP Library. If not, see
> http://www.gnu.org/licenses/. -
> -include(`../config.m4')
> -
> -C INPUT PARAMETERS
> -C res_ptr %r2
> -C s1_ptr %r3
> -C s2_ptr %r4
> -C size %r5
> -
> -C This code has been optimized to run one instruction per clock,
> avoiding -C load stalls and writeback contention. As a result, the
> instruction -C order is not always natural.
> -
> -C The speed is about 4.6 clocks/limb + 18 clocks/limb-vector on an
> 88100, -C but on the 88110, it seems to run much slower, 6.6
> clocks/limb. -
> -ASM_START()
> -PROLOGUE(mpn_sub_n)
> - ld %r6,%r3,0 C read first limb from
> s1_ptr
> - extu %r10,%r5,3
> - ld %r7,%r4,0 C read first limb from
> s2_ptr -
> - subu %r5,%r0,%r5
> - mak %r5,%r5,3<4>
> - bcnd.n eq0,%r5,Lzero
> - subu.co %r0,%r0,%r0 C initialize carry
> -
> -ifdef(`PIC',`
> - or %r9,%r0,%r25
> - or %r11,%r0,%r1
> - or.u %r25,%r0,%hi16(.Lpic#abdiff)
> - bsr.n .Lpic
> - or %r25,%r25,%lo16(.Lpic#abdiff)
> -.Lpic: add %r25,%r25,%r1
> - or %r1,%r0,%r11
> - or.u %r11,%r0,%hi16(Lbase#got_rel)
> - or %r11,%r11,%lo16(Lbase#got_rel)
> - ld %r12,%r25,%r11
> - or %r25,%r0,%r9
> -',`
> - or %r12,%r0,%lo16(Lbase)
> - or.u %r12,%r12,%hi16(Lbase)
> -')
> - addu %r12,%r12,%r5 C %r12 is address
> for entering in loop -
> - extu %r5,%r5,2 C divide by 4
> - subu %r2,%r2,%r5 C adjust res_ptr
> - subu %r3,%r3,%r5 C adjust s1_ptr
> - subu %r4,%r4,%r5 C adjust s2_ptr
> -
> - or %r8,%r6,%r0
> -
> - jmp.n %r12
> - or %r9,%r7,%r0
> -
> -Loop: addu %r3,%r3,32
> - st %r8,%r2,28
> - addu %r4,%r4,32
> - ld %r6,%r3,0
> - addu %r2,%r2,32
> - ld %r7,%r4,0
> -Lzero: subu %r10,%r10,1 C subtract 0 +
> 8r limbs (adj loop cnt) -Lbase: ld %r8,%r3,4
> - subu.cio %r6,%r6,%r7
> - ld %r9,%r4,4
> - st %r6,%r2,0
> - ld %r6,%r3,8 C subtract 7 + 8r limbs
> - subu.cio %r8,%r8,%r9
> - ld %r7,%r4,8
> - st %r8,%r2,4
> - ld %r8,%r3,12 C subtract 6 + 8r limbs
> - subu.cio %r6,%r6,%r7
> - ld %r9,%r4,12
> - st %r6,%r2,8
> - ld %r6,%r3,16 C subtract 5 + 8r limbs
> - subu.cio %r8,%r8,%r9
> - ld %r7,%r4,16
> - st %r8,%r2,12
> - ld %r8,%r3,20 C subtract 4 + 8r limbs
> - subu.cio %r6,%r6,%r7
> - ld %r9,%r4,20
> - st %r6,%r2,16
> - ld %r6,%r3,24 C subtract 3 + 8r limbs
> - subu.cio %r8,%r8,%r9
> - ld %r7,%r4,24
> - st %r8,%r2,20
> - ld %r8,%r3,28 C subtract 2 + 8r limbs
> - subu.cio %r6,%r6,%r7
> - ld %r9,%r4,28
> - st %r6,%r2,24
> - bcnd.n ne0,%r10,Loop C subtract 1 + 8r
> limbs
> - subu.cio %r8,%r8,%r9
> -
> - st %r8,%r2,28 C store most significant
> limb -
> - addu.ci %r2,%r0,%r0 C return carry-out from
> most sign. limb
> - jmp.n %r1
> - xor %r2,%r2,1
> -EPILOGUE(mpn_sub_n)
> Index: patches/patch-acinclude_m4
> ===================================================================
> RCS file: patches/patch-acinclude_m4
> diff -N patches/patch-acinclude_m4
> --- patches/patch-acinclude_m4 5 Nov 2017 15:12:56
> -0000 1.2 +++ /dev/null 1 Jan 1970 00:00:00 -0000
> @@ -1,20 +0,0 @@
> -$OpenBSD: patch-acinclude_m4,v 1.2 2017/11/05 15:12:56 jca Exp $
> -
> -Zero out the memory before testing for overwrite bug.
> -
> -Fixed in unstable, not in the gmp-6.1 branch:
> -
> - https://gmplib.org/repo/gmp/rev/2ce5c60f5372
> -
> -Index: acinclude.m4
> ---- acinclude.m4.orig
> -+++ acinclude.m4
> -@@ -741,7 +741,7 @@ main ()
> - long i;
> - for (i = 0; i < 88 + 1; i++)
> - a[i] = ~0L;
> -- r = malloc (10000 * sizeof (unsigned long));
> -+ r = calloc (10000, sizeof (unsigned long));
> - r2 = r;
> - for (i = 0; i < 528; i += 23)
> - {
> Index: pkg/PLIST-cxx
> ===================================================================
> RCS file: /cvs/ports/devel/gmp/pkg/PLIST-cxx,v
> retrieving revision 1.1
> diff -u -p -r1.1 PLIST-cxx
> --- pkg/PLIST-cxx 2 Nov 2018 18:43:56 -0000 1.1
> +++ pkg/PLIST-cxx 2 Feb 2020 21:33:07 -0000
> @@ -1,6 +1,7 @@
> @comment $OpenBSD: PLIST-cxx,v 1.1 2018/11/02 18:43:56 naddy Exp $
> @conflict gmp-<6.1.2p2
> include/gmpxx.h
> -lib/libgmpxx.a
> +@static-lib lib/libgmpxx.a
> lib/libgmpxx.la
> @lib lib/libgmpxx.so.${LIBgmpxx_VERSION}
> +lib/pkgconfig/gmpxx.pc
> Index: pkg/PLIST-main
> ===================================================================
> RCS file: /cvs/ports/devel/gmp/pkg/PLIST-main,v
> retrieving revision 1.1
> diff -u -p -r1.1 PLIST-main
> --- pkg/PLIST-main 2 Nov 2018 18:43:56 -0000 1.1
> +++ pkg/PLIST-main 2 Feb 2020 21:33:07 -0000
> @@ -2,6 +2,7 @@
> @pkgpath devel/gmp
> include/gmp.h
> @info info/gmp.info
> -lib/libgmp.a
> +@static-lib lib/libgmp.a
> lib/libgmp.la
> @lib lib/libgmp.so.${LIBgmp_VERSION}
> +lib/pkgconfig/gmp.pc
> --
> Christian "naddy" Weisgerber
> naddy@mips.inka.de
>

No comments:

Post a Comment