This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: March=native with a main 64bit system and 32bit chroot
- From: Ian Lance Taylor <iant at google dot com>
- To: Luca Zorzo <lucazorzo at gmail dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Tue, 26 May 2009 16:50:56 -0700
- Subject: Re: March=native with a main 64bit system and 32bit chroot
- References: <2fa074bc0905260600g17274999w58891fdf9b57aa28@mail.gmail.com> <m3prdwvuk4.fsf@google.com> <2fa074bc0905261331n3f5fbfnf348e26d92f444ab@mail.gmail.com>
Luca Zorzo <lucazorzo@gmail.com> writes:
> 2009/5/26 Ian Lance Taylor <iant@google.com>:
>> Luca Zorzo <lucazorzo@gmail.com> writes:
>>
>>> I've a main Gentoo 64bit system with CHOST="x86_64-pc-linux-gnu" and
>>> CFLAGS="-march=native -mtune=native -O2 -pipe -fomit-frame-pointer".
>>> My cpu is a Pentium 4 Prescott and i'm using gcc-4.3.2.
>>>
>>> With this little script:
>>> "echo 'float x(float x){return x < 0 ? -x : x;}' > x.c && gcc
>>> -fverbose-asm -mtune=native -march=native -S x.c && grep
>>> '\(-march\|-mtune\)' x.s && rm -fr x.c && rm -fr x.s "
>>> i've found that gcc uses march=nocona and mtune=nocona, and this is ok.
>>>
>>> In this main system i've some 32bit chroots with
>>> CHOST="i686-pc-linux-gnu" and CFLAGS="-march=native -mtune=native -O2
>>> -pipe -fomit-frame-pointer".
>>> But this time gcc is using march=nocona and mtune=nocona again, that
>>> is wrong i think.
>>>
>>> Should i use march=native or march=prescott (that is what i was using
>>> with old gcc versions) for my chroots?
>>>
>>> If march=prescott is the right choice i think that the gcc "native"
>>> detection should consider also $CHOST.
>>
>> This question is appropriate for the mailing list gcc-help@gcc.gnu.org,
>> not the mailing list gcc@gcc.gnu.org. ÂPlease take any followups to
>> gcc-help. ÂThanks.
>>
>> Your CPU is the same whether you have a chroot or not, and whether you
>> are running in 32-bit mode or in 64-bit mode, so it is correct for gcc
>> to handle -mtune=native -march=native the same way in both cases.
>> Naturally the -march option will be affected by whether you are in
>> 32-bit mode or not. ÂAs far as I know the -mtune option doesn't make any
>> difference.
>>
>> It's reasonable to ask whether -mtune=nocona gives the best results when
>> using a Prescott. ÂRight now -mtune=prescott and -mtune=nocona are
>> handled identically in any case. ÂI don't know if there is room for
>> improvement there or not.
>
> Sorry for the wrong mailing list, i mailed to gcc@gcc.gnu.org because
> i thought it was half a bug, but as i can understand it isn't.
Actually even bug reports (at least, bug reports without solutions)
should normally go to gcc-help, or be reported as bugs following the
guidelines at http://gcc.gnu.org/bugs.html . The gcc@gcc.gnu.org
mailing list is for discussions about the development of gcc. It would
be appropriate to send an extremely serious bug report there, but
ordinary bugs are not discussed on that mailing list.
> So why gentoo team suggest nocona for 64 bit and prescott for 32 bit?
> (http://en.gentoo-wiki.com/wiki/Safe_Cflags/Intel#Pentium_4_.28Prescott.29_.2F_Celeron_D)
There is nothing wrong with that advice. It just doesn't happen to make
any difference.
> Is there a way to test if it is better prescott or nocona?
I will interpret that question as asking which -march option is better
with current gcc. I think the first step there would be to compile a
bunch of programs with both options and see if there is any difference
in the generated code. I don't think there will be. But if you do find
a difference, you can then use that to produce a benchmark to see which
options gives you a better result.
Ian