3 ms·
Most of the top questions I've asked on Stack Overflow are related to missed optimizations in C (or C++, but I'll skip those here): - https://stackoverflow.com
by jzwinck 9y ago
Most of the top questions I've asked on Stack Overflow are related to missed optimizations in C (or C++, but I'll skip those here):
- https://stackoverflow.com/questions/45052282/why-is-memcmpa-b-4-only-sometimes-optimized-to-a-uint32-comparison https://stackoverflow.com/questions/45052282/why-is-memcmpa-...
- https://stackoverflow.com/questions/23055704/why-cant-gcc-optimize-the-logical-bitwise-and-pair-in-x-x-4242-to-x https://stackoverflow.com/questions/23055704/why-cant-gcc-op...
- https://stackoverflow.com/questions/26052640/why-does-gcc-implement-isnan-more-efficiently-for-c-cmath-than-c-math-h https://stackoverflow.com/questions/26052640/why-does-gcc-im...
- https://stackoverflow.com/questions/18951520/gcc-optimization-missed-opportunity https://stackoverflow.com/questions/18951520/gcc-optimizatio...
But my favorite is this one:
- https://stackoverflow.com/questions/26053934/is-it-feasible-for-gcc-to-optimize-isnanx-isnany-into-isunorderedx-y https://stackoverflow.com/questions/26053934/is-it-feasible-...
That one is now optimized in GCC and Clang: (isnan(x) || isnan(y)) becomes a single instruction on x86.
Some of these are very tricky, but the isnan pairing one is simple, and quite useful for some math routines whose first order of business is finding NaNs.