On Mon, 10 Feb 2025, Niels Möller wrote:

Marc Glisse <marc.gli...@inria.fr> writes:

Let's see. If I configure GMP with just --enable-fat, I still see in
config.h

#define HAVE_HOST_CPU_nehalem 1

and longlong.h enables mulx based on

#if X86_ASM_MULX \
   && (HAVE_HOST_CPU_haswell || HAVE_HOST_CPU_broadwell \
       || HAVE_HOST_CPU_skylake || HAVE_HOST_CPU_bd4 || HAVE_HOST_CPU_zen)

Torbjörn Granlund <t...@gmplib.org> writes:

Emmanuel Lonca <emmanuel.lo...@univ-artois.fr> writes:

  To what I understand from the GMP documentation, compiling with the
  --enable-fat flag should produce a library that can be used on any x86
  architecture.

Yes, that's the idea IIRC.

It seems the above use in longlong.h is the only use of X86_ASM_MULX?
Then it seems right to completely disable that in fat builds, like

diff -r 1a2ad0e32507 configure.ac
--- a/configure.ac      Mon Feb 03 17:52:54 2025 +0100
+++ b/configure.ac      Mon Feb 10 16:21:35 2025 +0100
@@ -3843,7 +3843,9 @@ yes
    X86_PATTERN | X86_64_PATTERN)
      GMP_ASM_ALIGN_FILL_0x90
      if test "$x86_have_mulx" = yes; then
-        GMP_ASM_X86_MULX
+        if test "$enable_fat" = no; then
+         GMP_ASM_X86_MULX
+       fi
      fi
      GMP_ASM_COFF_TYPE
      case $ABI in

I don't like it, GMP_ASM_X86_MULX is about the assembler supporting the mulx instruction, not about the host processor being able to execute it.

Something simple might be in configure.ac to hide

tmp_host=`echo $host_cpu | sed 's/\./_/'`
AC_DEFINE_UNQUOTED(HAVE_HOST_CPU_$tmp_host)
GMP_DEFINE_RAW("define_not_for_expansion(\`HAVE_HOST_CPU_$tmp_host')", POST)

behind a test $enable_fat = no

since any use of HAVE_HOST_CPU_* (as opposed to HAVE_HOST_CPU_FAMILY_*) is suspect in a fat build, but that prevents from having a fat build with a non-basic baseline (say only support skylake or later).

I feel that somehow, with --enable-fat, we should avoid GMP's config.guess and stick to the FSF version, but that doesn't look convenient.

--
Marc Glisse
_______________________________________________
gmp-bugs mailing list
gmp-bugs@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-bugs

Reply via email to