This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: gcc -S vs clang -S
- From: Andrew Pinski <pinskia at gmail dot com>
- To: Fei Ding <fdingiit at gmail dot com>
- Cc: Eric Botcazou <ebotcazou at libertysurf dot fr>, Olivier Galibert <galibert at pobox dot com>, GCC Mailing List <gcc at gcc dot gnu dot org>, Thiago Farina <tfransosi at gmail dot com>
- Date: Tue, 12 May 2015 18:40:25 -0700
- 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>
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.
Thanks,
Andrew Pinski
>
> 2015-05-12 23:29 GMT+08:00 Eric Botcazou <ebotcazou@libertysurf.fr>:
>>> Note that at -O3 there is a difference still:
>>> clang (3.6.0):
>>> addl %esi, %edi
>>> movl %edi, %eax
>>> retq
>>>
>>> gcc (4.9.2)
>>> leal (%rdi,%rsi), %eax
>>> ret
>>>
>>> Can't tell which is best, if any.
>>
>> But what's your point exactly here? You cannot expect different compilers to
>> generate exactly the same code on a given testcase for non-toy architectures.
>>
>> Note that this kind of discussion is more appropriate for gcc-help@gcc.gnu.org
>>
>> --
>> Eric Botcazou