[Cake] de-natting & host fairness

Jonathan Morton chromatix99 at gmail.com
Tue Sep 27 23:49:50 EDT 2016

> On 28 Sep, 2016, at 06:33, Kevin Darbyshire-Bryant <kevin at darbyshire-bryant.me.uk> wrote:
> those ternaries are if/else in disguise...

Many CPUs can handle those as conditional moves without branching - including ARM in particular; near-universal conditional execution was one of its original headline features.  Most x86 CPUs (except very old ones) and some of the embedded-class PowerPCs (which are often found in “big” network appliances) also qualify.  Unswitching those would potentially be a retrograde step on those CPUs.

However the presence of a conditional function call suggests that unswitching would not in fact be harmful, except for some duplication of source code - since the branch has to be made anyway.  I think many compilers would be able to perform the loads before the branch and the stores after it, which would execute very slickly, while some CPUs do not execute large numbers of conditional moves very efficiently.

 - Jonathan Morton

More information about the Cake mailing list