6.2.0 always uses BMI1/2 instructions

Andy Fiddaman andy at omniosce.org
Wed Mar 4 20:20:08 UTC 2020


I am part of a team that packages up libgmp as part of the OmniOS
operating system (an illumos distribution). The packages are built on a
variety of hardware but can be used on older systems. We build gmp
targetting older CPU features only but since version 6.2.0 we have seen
that the produced binaries do not run properly on pre-haswell systems.

This turns out to be due to the use of the `mulx` and `lzcnt` instructions
when the library is built on a haswell system. We've now explicitly disabled
the use of mulx via the 'gmp_cv_asm_x86_mulx=no' configure option but there is
currently no way to suppress the lzcnt instructions without patching the

Here's our configure line:

./configure --prefix=/usr --sysconfdir=/etc --includedir=/usr/include
	--bindir=/usr/bin/amd64 --sbindir=/usr/sbin/amd64
	--libdir=/usr/lib/amd64 --libexecdir=/usr/libexec/amd64
	--includedir=/usr/include/gmp --localstatedir=/var
	--enable-shared --disable-static --disable-libtool-lock
	--disable-alloca --enable-cxx --enable-fft
	--disable-fat --with-pic gmp_cv_asm_x86_mulx=no ABI=64
	MPN_PATH="x86_64/pentium4 x86_64 generic"

Would you consider adding a configure check for lzcnt support so that
we could override it, or is there a different way that we should look at
specifying the target host?

Thanks in advance,


More information about the gmp-bugs mailing list