Brute force beats LLMs: a compiler search finds a 4-op float trick no human spotted

Superoptimizing an FPU Emulator

Frustrated by a branch in a floating-point routine that extracts the lowest set bit, the author brute-forced every formula up to five operations instead of asking an LLM. Deduplicating equivalent expressions let the search finish in four minutes. It found a five-op solution, and manual inspection revealed one could be rewritten to reuse a subexpression, yielding a branchless four-op formula that flips the sign bit only for powers of two.

I was flabbergasted when I realized it found such a clever rewrite. You don't need an LLM to be amazed by what computers can invent!

More from this day

2026-10-18