public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Segher Boessenkool <segher@kernel.crashing.org>
To: Jonathan Wakely <jwakely.gcc@gmail.com>
Cc: Xi Ruoyao <xry111@mengyan1223.wang>,
	gcc-help <gcc-help@gcc.gnu.org>,
	unlvsur unlvsur <unlvsur@live.com>
Subject: Re: how to get -march=native's value?
Date: Fri, 17 Sep 2021 12:53:25 -0500	[thread overview]
Message-ID: <20210917175325.GS1583@gate.crashing.org> (raw)
In-Reply-To: <CAH6eHdQ0MPUNaJy=WQM5v1CRebdfDAYYH+4mppmF5XFVkWAdoQ@mail.gmail.com>

On Fri, Sep 17, 2021 at 11:26:16AM +0100, Jonathan Wakely via Gcc-help wrote:
> The question is whether -march=native always corresponds to one of the
> other -march=xxx options or not.

[ snip ]

> So the question is whether that is any different to what is enabled by
> just -march=skylake alone.The answer is yes, it's different. On my
> machine -march=native adds -mabm and -mrtm which are not enabled by
> -march=skylake, and it also uses different L1 and L2 cache sizes.

The cache sizes are -mtune=native, not -march=native.

> Is that a bug in the -march=skylake settings? Maybe, I don't know. But
> it shows that -march=native is not the same as just the named -march
> option for my machines.

For x86 -march=something is the same as -march=native, _if_ the compiler
knows about your CPU.  It will guess something reasonable otherwise.

This is all completely arch-specific (and OS-specific).  There are no
guarantees that you will get the same as any named CPU.  Your arch could
check for each feature if it can use it, as one extreme,

In the case of -mabm and -mrtm, it looks like the documentation could
use an update, perhaps.  The way this is structured the code and doc can
diverge easily.


Segher

  parent reply	other threads:[~2021-09-17 17:54 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-07  7:02 unlvsur unlvsur
2021-09-07  7:56 ` Jonathan Wakely
2021-09-17  2:46   ` NightStrike
2021-09-17  8:29     ` Xi Ruoyao
2021-09-17 10:26       ` Jonathan Wakely
2021-09-17 10:38         ` Jonathan Wakely
2021-09-17 17:53         ` Segher Boessenkool [this message]
2021-09-27 12:55           ` Vincent Lefevre
2021-09-27 17:13             ` Segher Boessenkool
2021-09-27 18:14               ` L A Walsh
2021-09-27 18:25                 ` Jonathan Wakely
2021-09-27 20:26                   ` Segher Boessenkool
2021-09-27 20:30                     ` NightStrike
2021-09-27 18:26                 ` Florian Weimer
2021-09-07  7:59 ` Hongtao Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210917175325.GS1583@gate.crashing.org \
    --to=segher@kernel.crashing.org \
    --cc=gcc-help@gcc.gnu.org \
    --cc=jwakely.gcc@gmail.com \
    --cc=unlvsur@live.com \
    --cc=xry111@mengyan1223.wang \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).