6.2.0 always uses BMI1/2 instructions

Torbjörn Granlund tg at gmplib.org
Thu Mar 5 21:29:29 UTC 2020

Andy Fiddaman <andy at omniosce.org> writes:

  Unfortunately fat binaries don't help here, the target binary still
  executes mulx and lzcnt instructions even when on older CPUs. This is from
  running GNU expr with a fat libgmp on an Ivy Bridge machine. The fat binary
  version of the library was built on a more modern machine:

  	$ /usr/gnu/bin/expr 8 \* 7
  	Illegal Instruction (core dumped)

  	fffffc7fffdf11f0 libgmp.so.10.4.0`__gmpz_set_str+0x18e()

  	libgmp.so.10.4.0`__gmpz_set_str+0x18e:  mulx   %r13,%rax,%rsi

Er, something is wrong with your environment or your build.

My guess is that you're not linking to the libgmp.so file yuo just
compiled, but some variant installed which is chosen by means of dynamic
libary search paths.

Or else you force the GMP build to use flags by means of passing
non-standard parameters to its configure (via explicit parameters or via
environment variables).

Trust me, GMP fat binaries are not completely broken.  We test it
(automatically) on a very wide range of very old, old, not so old, and
new machines!

(When you find out what is wrong, please follow up here as it might help
other people.)

Please encrypt, key id 0xC8601622

More information about the gmp-bugs mailing list