This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ 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] | |
Gabriel Dos Reis writes:
> Phil Edwards <phil@codesourcery.com> writes:
> > | Here's my opinion before I vanish into non-networked-land for a few days:
> | for years, the GCC team has been warning of the dangers of slowing down the
> | compiler and runtime by a few percent at a time, because it accumulates
> | so quickly.
> > I'm just asking for an actual data. Can we have one?
> > -- Gaby
I didn't actually see any difference on an AMD XP2100, but the only other platform I can really test is a mobile P4.
I wouldn't expect to see much difference on platforms like IA32 that, AFAIK, do not support branch prediction hints. I would expect to see differences on platforms like PA or IA64 that can take advantage of them. (Of course, the reality depends on the implementation of the feature. Even on platforms that do not support branch prediction hints the optimizer can take advantage of the hint and rearrange code for better performance.)
Surprisingly, with gcc I didn't see any significant difference not only on IA32 but also on IA64. When I repeated the same exercise with HP aCC on IA64 (using #pragma ESTIMATED_FREQUENCY) the output was considerably different and, as expected, the code performed slightly better than without the hint.
The .s files are attached for those who don't have access to an IA64 machine.
if (__builtin_expect (n < 2, false))
return 1; if (__builtin_expect (n > 1, true))
return n * foo (n - 1);$ aCC -S +O3 t.cpp -DHINT -DNEG && mv t.s acc.hint.neg.s \ && aCC -S +O3 t.cpp -DHINT && mv t.s acc.hint.s \ && aCC -S +O3 t.cpp -DNEG && mv t.s acc.neg.s \ && aCC -S +O3 t.cpp && mv t.s acc.s
$ gcc -S -O3 t.cpp -DHINT -DNEG -o gcc.hint.neg.s \ && gcc -S -O3 t.cpp -DHINT -o gcc.hint.s \ && gcc -S -O3 t.cpp -DNEG -o gcc.neg.s \ && gcc -S -O3 t.cpp -o gcc.s
Attachment:
asm.tar.gz
Description: GNU Zip compressed data
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |