Re: GMP 6.1.2 t-count_zeros failure on ARM with assertions

2018-02-01 Thread Marc Glisse
On Wed, 17 Jan 2018, Marc Glisse wrote: I am currently in favor of removing ASSERT. Done. -- Marc Glisse ___ gmp-bugs mailing list gmp-bugs@gmplib.org https://gmplib.org/mailman/listinfo/gmp-bugs

Re: GMP 6.1.2 t-count_zeros failure on ARM with assertions

2018-01-17 Thread Marc Glisse
On Wed, 17 Jan 2018, Vincent Lefevre wrote: On 2018-01-17 18:06:49 +0100, Marc Glisse wrote: On Wed, 17 Jan 2018, Vincent Lefevre wrote: On 2018-01-17 17:23:02 +0100, Marc Glisse wrote: Indeed, it doesn't make sense to have both the assertion and COUNT_LEADING_ZEROS_0. Would it work to

Re: GMP 6.1.2 t-count_zeros failure on ARM with assertions

2018-01-17 Thread Vincent Lefevre
On 2018-01-17 17:23:02 +0100, Marc Glisse wrote: > Indeed, it doesn't make sense to have both the assertion and > COUNT_LEADING_ZEROS_0. Would it work to remove the assertion instead? Yes, this works too (assuming that 0 will always be converted to +0). -- Vincent Lefèvre -

Re: GMP 6.1.2 t-count_zeros failure on ARM with assertions

2018-01-17 Thread Marc Glisse
On Wed, 17 Jan 2018, Vincent Lefevre wrote: On 2017-12-27 17:15:43 +0100, Niels Möller wrote: Vincent Lefevre writes: diff -r 20cf1131dc94 longlong.h --- a/longlong.hThu Aug 31 01:00:02 2017 +0200 +++ b/longlong.hTue Dec 26 10:59:24 2017 +0100 @@ -535,7

Re: GMP 6.1.2 t-count_zeros failure on ARM with assertions

2018-01-17 Thread Vincent Lefevre
On 2017-12-27 17:15:43 +0100, Niels Möller wrote: > Vincent Lefevre writes: > > >> diff -r 20cf1131dc94 longlong.h > >> --- a/longlong.h Thu Aug 31 01:00:02 2017 +0200 > >> +++ b/longlong.h Tue Dec 26 10:59:24 2017 +0100 > >> @@ -535,7 +535,6 @@ extern UWtype

Re: GMP 6.1.2 t-count_zeros failure on ARM with assertions

2018-01-02 Thread Torbjörn Granlund
(Related, I wonder what the effect would be of redefining umul_ppmm as C expressions involving __uint128_t on compilers that support that). We do that already for some CPUs, but this has proven to be somewhat fragile, and in unexpected cases lead to libgcc calls. We brave to do

Re: GMP 6.1.2 t-count_zeros failure on ARM with assertions

2018-01-02 Thread Torbjörn Granlund
ni...@lysator.liu.se (Niels Möller) writes: Using inline asm instead has the drawback that it leaves a little less opportunity for the compiler to schedule this instructions optimally. No idea if that matters in practice. Since it seems we don't really need count_*_zeros to support zero

Re: GMP 6.1.2 t-count_zeros failure on ARM with assertions

2018-01-02 Thread Niels Möller
t...@gmplib.org (Torbjörn Granlund) writes: > We might define these directly, at least for arm64, to CLZ and RBIT+CLZ, > respectively, instead of using gcc's builtin semi-defined variants? Using inline asm instead has the drawback that it leaves a little less opportunity for the compiler to

Re: GMP 6.1.2 t-count_zeros failure on ARM with assertions

2018-01-01 Thread Torbjörn Granlund
ni...@lysator.liu.se (Niels Möller) writes: t...@gmplib.org (Torbjörn Granlund) writes: > The idea with that was to allow some usages that want to pass 0 to avoid > a condition. Isn't that used? The idea makes sense, but I couldn't find any such use. I was thinking that any use

Re: GMP 6.1.2 t-count_zeros failure on ARM with assertions

2017-12-27 Thread Niels Möller
t...@gmplib.org (Torbjörn Granlund) writes: > The idea with that was to allow some usages that want to pass 0 to avoid > a condition. Isn't that used? The idea makes sense, but I couldn't find any such use. I was thinking that any use like that would be accompanied by an #ifdef

Re: GMP 6.1.2 t-count_zeros failure on ARM with assertions

2017-12-27 Thread Marco Bodrato
Ciao, Il Mer, 27 Dicembre 2017 6:10 pm, Marc Glisse ha scritto: > On Wed, 27 Dec 2017, Niels Möller wrote: >> And below, a patch to delete all mention of COUNT_LEADING_ZEROS_0, >> except for tune/many.pl, which I'm not familiar with. What do you think? > It seems a bit sad to drop this

Re: GMP 6.1.2 t-count_zeros failure on ARM with assertions

2017-12-27 Thread Marc Glisse
On Wed, 27 Dec 2017, Niels Möller wrote: ni...@lysator.liu.se (Niels Möller) writes: Pushed now. And below, a patch to delete all mention of COUNT_LEADING_ZEROS_0, except for tune/many.pl, which I'm not familiar with. What do you think? It seems a bit sad to drop this information, in case

Re: GMP 6.1.2 t-count_zeros failure on ARM with assertions

2017-12-27 Thread Torbjörn Granlund
ni...@lysator.liu.se (Niels Möller) writes: And below, a patch to delete all mention of COUNT_LEADING_ZEROS_0, except for tune/many.pl, which I'm not familiar with. What do you think? The idea with that was to allow some usages that want to pass 0 to avoid a condition. Isn't that used?

Re: GMP 6.1.2 t-count_zeros failure on ARM with assertions

2017-12-27 Thread Niels Möller
ni...@lysator.liu.se (Niels Möller) writes: > Pushed now. And below, a patch to delete all mention of COUNT_LEADING_ZEROS_0, except for tune/many.pl, which I'm not familiar with. What do you think? Regards, /Niels diff -Nprc2 gmp.0e10f8f34eb4/longlong.h gmp/longlong.h ***

Re: GMP 6.1.2 t-count_zeros failure on ARM with assertions

2017-12-27 Thread Niels Möller
Vincent Lefevre writes: >> diff -r 20cf1131dc94 longlong.h >> --- a/longlong.h Thu Aug 31 01:00:02 2017 +0200 >> +++ b/longlong.h Tue Dec 26 10:59:24 2017 +0100 >> @@ -535,7 +535,6 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype >> #endif /* defined(__ARM_ARCH_2__) ...

Re: GMP 6.1.2 t-count_zeros failure on ARM with assertions

2017-12-26 Thread Vincent Lefevre
On 2017-12-26 11:51:28 +0100, Niels Möller wrote: > Hmm, I guess the problem is > > #define count_leading_zeros_gcc_clz(count,x)\ > do { \ > ASSERT ((x) != 0); \ > (count) = __builtin_clzll (x);

Re: GMP 6.1.2 t-count_zeros failure on ARM with assertions

2017-12-26 Thread Niels Möller
Vincent Lefevre writes: > #ifdef COUNT_LEADING_ZEROS_0 > check_clz (COUNT_LEADING_ZEROS_0, CNST_LIMB(0)); > #endif > > If GMP does a test with CNST_LIMB(0), I wonder why it has an > assertion (n) != 0. This is not consistent! The docs say: 5) count_leading_zeros(count,

GMP 6.1.2 t-count_zeros failure on ARM with assertions

2017-12-25 Thread Vincent Lefevre
I've built GMP 6.1.2 with assertions: ./configure --enable-assert --prefix=$HOME/opt/gmp-6.1.2 on an old ARM VM (Debian squeeze). But I get the failure: FAIL: t-count_zeros === t-count_zeros.c:31: GNU MP assertion failed: (n) != 0 FAIL t-count_zeros (exit status: 134) I've