"rep ret" even for Intel CPUs?
Ian Lance Taylor
iant@google.com
Tue Mar 22 06:25:00 GMT 2011
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
More information about the Gcc-help
mailing list