x86 SIMD superoptimizer in ~100 lines of Python
github.com
github.com
The next logical step was obviously writing a superoptimizer. You provide it with a whitelist of intrinsics to search over, a set of inputs, a set of free variables (for things like creating constants/lookup tables), and an output, and it will recursively search over all applications of the intrinsics to find the shortest instruction sequence. This is still a toy at this point, so don't expect any miracles.