Suboptimal code generated for _Bool

Andi Kleen ak@muc.de
Sun Jun 20 18:26:00 GMT 2004


Marcin 'Qrczak' Kowalczyk <qrczak@knm.org.pl> writes:


> .L4:
>         testb   %dl, %dl
>         jne     .L3
>         xorl    %eax, %eax
> .L3:
>         rep ; ret
>
> BTW, what is the "rep ; ret" in the last line?

That works around a limitation in the Athlon branch predictor.
In some cases it cannot predict a branch to ret, and adding the prefix
avoids that.

-Andi



More information about the Gcc mailing list