This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Choosing the right -march target architecture
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: Mason <slash dot tmp at free dot fr>
- Cc: GCC help <gcc-help at gcc dot gnu dot org>
- Date: Thu, 3 Sep 2015 11:01:18 +0100
- Subject: Re: Choosing the right -march target architecture
- Authentication-results: sourceware.org; auth=none
- References: <55E43AB2 dot 3070104 at free dot fr> <55E451F5 dot 9040700 at aol dot com> <55E6A89E dot 7010801 at free dot fr> <CAH6eHdS2gcprHpqCpzRzZTGqzaoubb9M=AJbhQro_iQbfs_LTw at mail dot gmail dot com> <55E6D91D dot 1010606 at free dot fr> <CAH6eHdRrSgU18WvB0VCxAurnE0nzdp5BqEJdX34JNXHwmfTViw at mail dot gmail dot com> <CAH6eHdSo5O1dR8f4nGKCxdxTNhkZLOJDqsfOgVV2+V5_kSv4+A at mail dot gmail dot com> <55E808A5 dot 7040102 at free dot fr>
On 3 September 2015 at 09:45, Mason wrote:
> I noticed something strange in gcc -v output:
>
> $ gcc -v -c foo.c
> ...
> gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1)
> COLLECT_GCC_OPTIONS='-v' '-c' '-mtune=generic' '-march=x86-64'
> /usr/lib/gcc/x86_64-linux-gnu/4.8/cc1 -quiet -v -imultiarch x86_64-linux-gnu foo.c -quiet -dumpbase foo.c -mtune=generic -march=x86-64 -auxbase foo -version -fstack-protector -Wformat -Wformat-security -o /tmp/ccFwNaX5.s
>
>
> -mtune=generic -march=x86-64
> Won't the -march option override the -mtune option?
No, I don't think so.
I assume the explicit -mtune overrides the implicit one.
> Another thing. I was under the impression that when the target
> platform is x86_64 (so not the same x86-64 as above) then some
x86-64 is the argument to -march and -mtune that means "the generic
x86_64 instruction set" so when the target platform is x86_64 and
there is no (implicit or explicit) -march then the instruction set
used is as if -march=x86-64 was specified.
> options are enabled by default, such as -msse and -msse2.
> Is that correct?
Yes. You can easily check by using -S -fverbose-asm and looking at the
assembly output, which will list the active options.
> Or is just the use of SSE for FP? i.e. -mfpmath=sse
> "For the i386 compiler, you must use -march=cpu-type, -msse or -msse2
> switches to enable SSE extensions and make this option effective.
> For the x86-64 compiler, these extensions are enabled by default."
>
>
> gcc -v does not print what instruction-set extensions it will
> be using? Is there a way to know that gcc used e.g. SSE3
> instructions in the code generation?
-fverbose-asm