This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: gcc -S vs clang -S
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Martin Sebor <msebor at redhat dot com>
- Cc: Fei Ding <fdingiit at gmail dot com>, Thiago Farina <tfransosi at gmail dot com>, Andrew Pinski <pinskia at gmail dot com>, Eric Botcazou <ebotcazou at libertysurf dot fr>, Olivier Galibert <galibert at pobox dot com>, GCC Mailing List <gcc at gcc dot gnu dot org>
- Date: Wed, 13 May 2015 16:50:40 +0200
- Subject: Re: gcc -S vs clang -S
- Authentication-results: sourceware.org; auth=none
- References: <CACnwZYe=psc2jqUeva3ZxFHvADz3D7SHqRAVyGcHyVOuRca+NA at mail dot gmail dot com> <8AF3EC7F-E86D-462D-8E07-B51162E9271E at gmail dot com> <CAMFK0gscitxWu70QHneBgF7dtYXcysWF7nngooOcztyvn8BBjA at mail dot gmail dot com> <1462026 dot YT44ftsO3U at polaris> <CAGmPkfJMjdg_U40oWKnbZRNqQS+j1ksqZ6U_+wRrHuPO=uneWQ at mail dot gmail dot com> <CA+=Sn1k9+82hUqe9OC32ZbEfDYmK6_fqVERQjL7U1hwucSMudA at mail dot gmail dot com> <555362A3 dot 1090004 at redhat dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Wed, May 13, 2015 at 08:41:39AM -0600, Martin Sebor wrote:
> On 05/12/2015 07:40 PM, Andrew Pinski wrote:
> >On Tue, May 12, 2015 at 6:36 PM, Fei Ding <fdingiit@gmail.com> wrote:
> >>I think Thiago and Eric just want to know which code-gen is better and why...
> >
> >
> >You need to understand for a complex process (CISC ISAs) like x86,
> >there is no one right answer sometimes. You need to look at each
> >micro-arch and understand the pipeline. Sometimes different code
> >stream will performance the same but it also depends on the code size
> >too.
>
> A good place to start is the Intel 64 and IA-32 Architectures
> Optimization Reference Manual. It lists the throughput and
> latencies of x86 instructions and gives guidance for which
> ones might be more efficient on which processors. For example,
> in the section titled Using LEA it discusses why the three
> operand form of the instruction is slower on the Sandy Bridge
> microarchitecture than on others:
>
> http://www.intel.com/content/dam/doc/manual/64-ia-32-architectures-optimization-manual.pdf
But leal (%rdi,%rsi), %eax is not the slower case it talks about.
Furthermore, supposedly the generic tuning is used, in which case it really
doesn't matter that much if it is slower or faster on a particular CPU,
but if it is in general slower or faster on the whole basket of CPUs that
the generic tuning is based on.
Jakub