6.2.0 always uses BMI1/2 instructions

Andy Fiddaman andy at omniosce.org
Thu Mar 5 18:45:56 UTC 2020


On Wed, 4 Mar 2020, Torbj?rn Granlund wrote:

; GMP will include instructions for the host for which GMP is configured,
; These instructions come from asm file which GMP's configure selects, and
; from compiler generated code which results from compiler command line
; options which GMP passes.
;
; If you want GMP to run on older machines, configuring it for some very
; ld machine might work, or more robustly configuring it for a generic
; architecture such as x86_64.
;
; But GMP supports fat binaried from x86 and x86_64, and that is probably
; the best choice.  Please see the GMP manual for details.

Hi,

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


This is the Ivy Bridge machine:

    x86 (GenuineIntel 306A9 family 6 model 58 step 9 clock 3392 MHz)
      Intel(r) Xeon(r) CPU E3-1240 V2 @ 3.40GHz

% isainfo -x
amd64: fsgsbase rdrand f16c vmx avx xsave pclmulqdq aes sse4.2 sse4.1 ssse3 popcnt tscp cx16 sse3 sse2 sse fxsr mmx cmov amd_sysc cx8 tsc fpu
i386: rdrand f16c vmx avx xsave pclmulqdq aes sse4.2 sse4.1 ssse3 popcnt tscp ahf cx16 sse3 sse2 sse fxsr mmx cmov sep cx8 tsc fpu

Andy



More information about the gmp-bugs mailing list