This is the mail archive of the gcc@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: Better Optimization


Thomas Schoebel-Theuer <schoebel@informatik.uni-stuttgart.de> writes:
>
> I often found code sequences like the following (gcc 3.3.3 for
> AMD64):
>
> 	call	XXX
> 	jmp	.L106
>
> IMHO, this could/should be replaced by something like:
>
> 	pushq	.L106
> 	jmp	XXX
>
> Although it does not produce shorter code, the runtime behaviour
> should be better, because the ret of the called subroutine will
> immediately jump to the new location and thus eliminate a jump chain.
> Branch target cache etc should be less polluted.

No definitely not. This would disturb the call/return prediction
stack in the CPU and generate branch misprediction stalls on RET.
Benchmark it, and you'll see how bad it is.

-Andi


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