Zuxy Meng <zuxy.meng@xxxxxxxxx> writes: > 2011/3/22 Ian Lance Taylor <iant@xxxxxxxxxx>: >> "Zuxy Meng" <zuxy.meng@xxxxxxxxx> 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