This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: "rep ret" even for Intel CPUs?


Zuxy Meng <zuxy.meng@gmail.com> writes:

> 2011/3/22 Ian Lance Taylor <iant@google.com>:
>> "Zuxy Meng" <zuxy.meng@gmail.com> writes:
>>
>>> I found that gcc 4.5 generates "rep ret" even under -march=core2. Does
>>> an Intel CPU benefit from this optimization too?
>>
>> As far as I know no Intel CPU benefits. ÂNote that -march selects the
>> architecture but not the tuning. ÂThe default tuning uses "rep; ret"
>> when appropriate. ÂIf you want to avoid it, use a -mtune option.
>
> 'info gcc' tells me that '-march=CPU-TYPE' implies '-mtune=CPU-TYPE',
> at least for x86...

You're quite right, sorry about that.

gcc 4.5 will use "rep; ret" for K8, Athlon, AMDFam10, Core2, and
generic.  Looking into the change history, I see that gcc has padded
returns for Core2 ever since Core2 support was added here:
http://gcc.gnu.org/ml/gcc-patches/2006-11/msg00860.html .  I suspect
that Vlad just copied the generic tunings for Core2, and didn't notice
that there was no particular reason to pad returns for Core2.

Please consider opening a bug report per http://gcc.gnu.org/bugs/ with
this information.  Thanks.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]