Tech News
← Home  ·  All topics

Superoptimization

1 GoKawiil brief on this topic

Developer uses brute-force superoptimization to simplify FPU bit-twiddling function

A developer building a floating-point library needed a function returning the lowest set bit of a float's mantissa, but the straightforward bitwise algorithm failed on powers of two, requiring a slow conditional branch. Unable to find a branch-free formula by hand, they built a brute-force search that tests short sequences of integer operations against representative test cases, adding counterexamples when a candidate formula fails.