public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Xi Ruoyao <xry111@mengyan1223.wang>
To: NightStrike <nightstrike@gmail.com>,
	Jonathan Wakely <jwakely.gcc@gmail.com>
Cc: 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 16:29:17 +0800	[thread overview]
Message-ID: <5b4a11b1a9a3945256d298cd355991dcffa1d806.camel@mengyan1223.wang> (raw)
In-Reply-To: <CAF1jjLvPXz-Wfc5F2e0-5VhefpPPD1oY1H+2YvTy6sc5e8oxkg@mail.gmail.com>

On Thu, 2021-09-16 at 22:46 -0400, NightStrike via Gcc-help wrote:
> On Tue, Sep 7, 2021 at 3:57 AM Jonathan Wakely via Gcc-help
> <gcc-help@gcc.gnu.org> wrote:
> > 
> > On Tue, 7 Sep 2021, 08:03 unlvsur unlvsur via Gcc-help, <
> > gcc-help@gcc.gnu.org> wrote:
> > 
> > > I try to cross compile to another slower machine. -march=native
> > > works on
> > > that architectures, but I would like to know what is the value of
> > > -march=??? For -march=native. Is there a way to print march value
> > > out??
> > > 
> > 
> > It doesn't choose a single value. It enables all the individual
> > options
> > like -msse and that combination of options might not correspond to any
> > particular -march value.
> 
> Is that true?  I mean, in principle, I know I've reported a bug where
> -march=native scanned /proc/cpuinfo (or however it got the info) and
> came up with a different result than -march=k8 (or whatever I was
> reporting at the time), but that was a bug that some helpful people
> fixed.  If gcc doesn't have an -march for a particular esoteric arch,
> then fine, but if it does, I'd think that this would be a bug similar
> to what I experienced previously.

It's documented clearly:

           native
               This selects the CPU to generate code for at compilation time
               by determining the processor type of the compiling machine.
               Using -march=native enables all instruction subsets supported
               by the local machine (hence the result might not run on
               different machines).  Using -mtune=native produces code
               optimized for the local machine under the constraints of the
               selected instruction set.

However if it produce something can't run on your machine,
this is a bug.
-- 
Xi Ruoyao <xry111@mengyan1223.wang>
School of Aerospace Science and Technology, Xidian University


  reply	other threads:[~2021-09-17  8:29 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 [this message]
2021-09-17 10:26       ` Jonathan Wakely
2021-09-17 10:38         ` Jonathan Wakely
2021-09-17 17:53         ` Segher Boessenkool
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=5b4a11b1a9a3945256d298cd355991dcffa1d806.camel@mengyan1223.wang \
    --to=xry111@mengyan1223.wang \
    --cc=gcc-help@gcc.gnu.org \
    --cc=jwakely.gcc@gmail.com \
    --cc=nightstrike@gmail.com \
    --cc=unlvsur@live.com \
    /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).