Re: help : likely

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Mulyadi Santosa wrote:

> Pardon me, just trying to clear my own confusion. So, the key here, the 
> code path, which is taken when the "likely()" test return TRUE, is 
> placed right below the "jump" test so the CPU doesn't get punished by 
> wrong branch prediction and therefore save a couple of CPU cycle eaten 
> by code prefetch...CMIIW

I'm not sure I clearly understand your question.

When you do :

 if (likely(something)) {
    ...
 }

Then GCC arranges the code, so that the code is optimized for the case
where "something" is TRUE.

Does it makes the thing clearer ?

Thomas
-- 
Thomas Petazzoni
thomas.petazzoni@xxxxxxxx

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux