Hello everyone,

I have recently randomly discovered the fact, that building with `-march=ivybridge` does not necessarily produce the same output as `-march=native` on an Intel Core i7 3770K (Ivy Bridge).

In particular, `-march=native` sets `-maes` whilst `-march=ivybridge` does not.

After carefully considering the option that I'm in fact turning crazy (e.g. I triple-checked that `-march=native` really does set `-march=ivybridge` and `-mtune=ivybridge`), it seems like while this is the case on the GCC version that I'm actively using (9.1.0), it is not on a different machine (6.3.0 20170516 (Debian 6.3.0-18+deb9u1)).

Consider this method that yields a `test.s` file result:

$ touch test.cc
$ gcc -fverbose-asm -march=ivybridge test.cc -S
$ sed -i 1,/options\ enabled/d test.s

Given the 6.3.0 compiler, test.s contains `-maes`.
The 9.1.0 compiler's test.s does not contain `-maes`.

In fact, when you use the 9.1.0 compiler on the CPU mentioned before to create `test1.s` with `-march=native` and `test2.s` with `-march=ivybridge` as before, this is the only difference:

$ diff test1.s test.s
21c21
< # -m128bit-long-double -m64 -m80387 -maes -malign-stringops -mavx
---
> # -m128bit-long-double -m64 -m80387 -malign-stringops -mavx


I have run a git bisect starting with
4b5e15daff8b54440e3fda451c318ad31e532fab as the last known good commit and
12b43fabe5fc5aa7d6217a6736409e180d13db6e as the first known bad commit [1].

If I'm understanding the commit correctly, the change that causes this is the removal of `PTA_AES` in

const wide_int_bitmask PTA_WESTMERE = PTA_NEHALEM | PTA_AES | PTA_PCLMUL;

as PTA_IVYBRIDGE contains PTA_SANDYBRIDGE which in turn contains PTA_WESTMERE.


Is this an oversight or mistake?


Best regards,

Kevin Weidemann


References:

[1] git bisect result:

71c8e4e2f720bc7155ba2da7c0ee9136a9ab3283 is the first bad commit
commit 71c8e4e2f720bc7155ba2da7c0ee9136a9ab3283
Author: hjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Fri Feb 22 12:49:21 2019 +0000

    x86: (Reapply) Move AESNI generation to Skylake and Goldmont

    This is a repeat of commit r263989, which commit r264052 accidentally
    reverted.

    2019-02-22  Thiago Macieira  <thiago.macie...@intel.com>

            PR target/89444
            * config/i386/i386.h (PTA_WESTMERE): Remove PTA_AES.
            (PTA_SKYLAKE): Add PTA_AES.
            (PTA_GOLDMONT): Likewise.


    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@269114 138bc75d-0d04-0410-961f-82ee72b054a4

:040000 040000 2c24ae2c6c6074acd52215a3340240989b3c1f6a 479b008acd81e383293abb23a69c9fa5da4afdc6 M      gcc
bisect run success



Reply via email to