|
|
|
|
|
by kstenerud
4077 days ago
|
|
I know that gcc and clang both have __builtin_expect(). If you tell the compiler the more likely path, wouldn't that make the branching version faster? Actually, I've always wondered how __builtin_expect translates to something the CPU's branch prediction engine can use... |
|
There are ways of doing it in hardware, I remember a supervisor discussing it with respect to MIPS. I also remember them saying they went through the entire code generation stage of GCC and found that every single point at which GCC would try to use it was somewhere where it would be actively unhelpful.