__builtin_expect(x,0)

As opposed to the C++ code, above we can see bar case precedes foo case. Since foo case is 
unlikely, and instructions of bar are pushed to the pipeline, thrashing the pipeline is unlikely. 
This is a good exploitation of a modern CPU

__builtin_expect(x,0)_第1张图片

你可能感兴趣的:(cpu,pipeline)