Fat Binary - Haswell Detection Bug (and fix)

Tim Valenzuela tim at deadlyninja.com
Thu Feb 27 19:44:38 UTC 2014


Hi guys, I've got the machine in question.

This patch you attached won't apply to the latest hg. It appears to have
been already applied, so I'm comparing the hg tip (16317:07a2dde2c971) vs
the last log entry before BMI2 is mentioned (16313:8b074a2e0134).

Mercurial tip:
===============
config.guess: coreisbr-unknown-linux-gnu
Check without fat: All Pass
Check with fat:  All Pass

Mercurial Pre-BMI2 changes:
===============
config.guess: coreihwl-unknown-linux-gnu
Check without fat: Illegal instruction
Check with fat: Illegal instruction

The changes seems to work as intended.

- Tim


On Thu, Feb 27, 2014 at 9:06 AM, Torbjorn Granlund <tg at gmplib.org> wrote:

> 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:
>
>
>
> 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