From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mengyan1223.wang (mengyan1223.wang [89.208.246.23]) by sourceware.org (Postfix) with ESMTPS id 011F93858401 for ; Fri, 17 Sep 2021 08:29:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 011F93858401 Received: from [192.168.124.4] (unknown [61.150.43.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) (Authenticated sender: xry111@mengyan1223.wang) by mengyan1223.wang (Postfix) with ESMTPSA id A046166240; Fri, 17 Sep 2021 04:29:19 -0400 (EDT) Message-ID: <5b4a11b1a9a3945256d298cd355991dcffa1d806.camel@mengyan1223.wang> Subject: Re: how to get -march=native's value? From: Xi Ruoyao To: NightStrike , Jonathan Wakely Cc: gcc-help , unlvsur unlvsur Date: Fri, 17 Sep 2021 16:29:17 +0800 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.40.4 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3030.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, JMQ_SPF_NEUTRAL, RCVD_IN_BARRACUDACENTRAL, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-help@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-help mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Sep 2021 08:29:24 -0000 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 > 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 School of Aerospace Science and Technology, Xidian University