Fat Binary - Haswell Detection Bug (and fix)

Torbjorn Granlund tg at gmplib.org
Thu Feb 27 16:06:00 UTC 2014


John Sully <john at csquare.ca> writes:

  The proposed patch is:
  --- a/mpn/x86_64/fat/fat.c      Sun Feb 16 07:08:24 2014 +0100
  +++ b/mpn/x86_64/fat/fat.c      Wed Feb 19 23:47:40 2014 -0500
  @@ -292,7 +292,9 @@
                CPUVEC_SETUP_core2;
                CPUVEC_SETUP_coreinhm;
                CPUVEC_SETUP_coreisbr;
  -             CPUVEC_SETUP_coreihwl;
  +             long featihwm = __gmpn_cpuid (dummy_string, 7);
  +             if ( featihwm & (1 << 8) )        //check BMI2
  +                     CPUVEC_SETUP_coreihwl;
                break;
              }
            break;
  

I am at loss about the logics of your change.  I don't think `featihwm'
will contain anything useful since (1) ecx is not set to zero by
__gmpn_cpuid as it should for this inquiry and (2) rax has a useless
value unrelated to BMI2 regardless of ecx input.  The bit to check is in
ebx (stored at dummy_string[0...3]).

Do you agree?

I made what I think are the correct changes.  Please remove your patch
and try the attached one instead:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch
Type: application/octet-stream
Size: 2576 bytes
Desc: not available
URL: <https://gmplib.org/list-archives/gmp-devel/attachments/20140227/db077071/attachment.obj>
-------------- next part --------------

Please try both a plain build (without --enable-fat) and a fat build
(with --enable-fat) and run "make && make check".

What does config.guess output with this change (and before the change)
for your system?


Torbj?rn


More information about the gmp-devel mailing list