GMP 6.1.2 t-count_zeros failure on ARM with assertions

Vincent Lefevre vincent at vinc17.net
Wed Dec 27 02:50:39 UTC 2017


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);		\
>     } while (0)
> 
> in combination with 
> 
>   #define count_leading_zeros(count, x) count_leading_zeros_gcc_clz(count, x)
>   #define count_trailing_zeros(count, x) count_trailing_zeros_gcc_ctz(count, x)
>   #define COUNT_LEADING_ZEROS_0 32
> 
> in the arm32 and arm64 parts of longlong.h.

Yes.

> 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__) ... */
>  #define count_leading_zeros(count, x)  count_leading_zeros_gcc_clz(count, x)
>  #define count_trailing_zeros(count, x)  count_trailing_zeros_gcc_ctz(count, x)
> -#define COUNT_LEADING_ZEROS_0 32
>  #endif /* __arm__ */
>  
>  #if defined (__aarch64__) && W_TYPE_SIZE == 64
> @@ -586,7 +585,6 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype 
>  #endif
>  #define count_leading_zeros(count, x)  count_leading_zeros_gcc_clz(count, x)
>  #define count_trailing_zeros(count, x)  count_trailing_zeros_gcc_ctz(count, x)
> -#define COUNT_LEADING_ZEROS_0 64
>  #endif /* __aarch64__ */
>  
>  #if defined (__clipper__) && W_TYPE_SIZE == 32

I confirm that this fixes the problem.

-- 
Vincent Lefèvre <vincent at vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


More information about the gmp-bugs mailing list