
Branchless Equivalents of Simple Functions (2008) - sytelus
https://hbfs.wordpress.com/2008/08/05/branchless-equivalents-of-simple-functions/
======
mappu
glibc's abs() implementation is here:
[https://github.com/bminor/glibc/blob/master/stdlib/abs.c](https://github.com/bminor/glibc/blob/master/stdlib/abs.c)

It's the naive branching version (probably for platform independence?), but my
installed GCC 4.9.3 does convert it to branchless cdq/xor trick on both -O3
and -O0.

------
rdc12
Last time I looked the "naive"[1] version of fizzbuzz, when compiled with GCC
or Clang, was converted to a branchless version (for x86 at least). I don't
remember what -O level was needed thou.

[1] as is the if and modulo based way

