> -----Original Message-----
> From: Richard Biener <richard.guent...@gmail.com>
> Sent: Wednesday, April 23, 2025 9:19 AM
> To: Andi Kleen <a...@firstfloor.org>; GCC Patches <gcc-patches@gcc.gnu.org>
> Subject: Re: [PATCH] Add a bootstrap-native build config
> 
> On Tue, Apr 22, 2025 at 5:43 PM Andi Kleen <a...@firstfloor.org> wrote:
> >
> > On 2025-04-22 13:22, Richard Biener wrote:
> > > On Sat, Apr 12, 2025 at 5:09 PM Andi Kleen <a...@firstfloor.org> wrote:
> > >>
> > >> From: Andi Kleen <a...@gcc.gnu.org>
> > >>
> > >> ... that uses -march=native -mtune=native to build a compiler
> > >> optimized
> > >> for the host.
> > >
> > > -march=native implies -mtune=native so I think the latter is redundant.
> >
> > Ok with that change?
> 
> Put the list back in the loop.
> 
> >
> > >
> > >> config/ChangeLog:
> > >>
> > >>         * bootstrap-native.mk: New file.
> > >>
> > >> gcc/ChangeLog:
> > >>
> > >>         * doc/install.texi: Document bootstrap-native.
> > >> ---
> > >>  config/bootstrap-native.mk | 1 +
> > >>  gcc/doc/install.texi       | 7 +++++++
> > >>  2 files changed, 8 insertions(+)
> > >>  create mode 100644 config/bootstrap-native.mk
> > >>
> > >> diff --git a/config/bootstrap-native.mk b/config/bootstrap-native.mk
> > >> new file mode 100644
> > >> index 00000000000..a4a3d859408
> > >> --- /dev/null
> > >> +++ b/config/bootstrap-native.mk
> > >> @@ -0,0 +1 @@
> > >> +BOOT_CFLAGS := -march=native -mtune=native $(BOOT_CFLAGS)
> > >
> > > bootstrap-O3 uses
> > >
> > > BOOT_CFLAGS := -O3 $(filter-out -O%, $(BOOT_CFLAGS))
> > >
> > > so do you want to filer-out other -march/-mtune/-mcpu options?
> >
> > I don't think that is needed because these are usually not used (unlike
> > -O)
> >
> > >
> > > Some targets know -mcpu= instead of -march=, did you check whether
> > > any of those have =native?
> >
> > There are some like Alpha and others dont jave it at all. That is the
> > why the documentation says "if supported".
> 

FWIW, Both AArch64 and Arm support native.
There's a slight difference though that unlike x86 -march=native does not
imply -mtune=native on Arm.  On AArch64 it does but only if no other
tuning options are specified.

So perhaps the original change is better?

Thanks,
Tamar

> I see.
> 
> So yes, OK with the above change.
> 
> Richard.
> 
> > >
> > >> diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
> > >> index 4973f195daf..04a2256b97a 100644
> > >> --- a/gcc/doc/install.texi
> > >> +++ b/gcc/doc/install.texi
> > >> @@ -3052,6 +3052,13 @@ Removes any @option{-O}-started option from
> > >> @code{BOOT_CFLAGS}, and adds
> > >>  @itemx @samp{bootstrap-Og}
> > >>  Analogous to @code{bootstrap-O1}.
> > >>
> > >> +@item @samp{bootstrap-native}
> > >> +@itemx @samp{bootstrap-native}
> > >> +Optimize the compiler code for the build host, if supported by the
> > >> +architecture. Note this only affects the compiler, not the targeted
> > >> +code. If you want the later, choose options suitable to the target
> > >> you
> > >> +are looking for. For example @samp{--with-cpu} would be a good
> > >> starting point.
> > >> +
> > >>  @item @samp{bootstrap-lto}
> > >>  Enables Link-Time Optimization for host tools during bootstrapping.
> > >>  @samp{BUILD_CONFIG=bootstrap-lto} is equivalent to adding
> > >> --
> > >> 2.47.1
> > >>

Reply via email to