3 ms·
One of the comments on that article links to this https://llvm.org/bugs/show_bug.cgi?id=1488 https://llvm.org/bugs/show_bug.cgi?id=1488 which rather suggests th
by gjm11 10y ago
One of the comments on that article links to this https://llvm.org/bugs/show_bug.cgi?id=1488 https://llvm.org/bugs/show_bug.cgi?id=1488 which rather suggests that this surprisingly specific optimization was added in order to speed up some calculations in one of the SPEC benchmarks.
(The benchmark in question is code from a chess program called Crafty, which represents a chess position as a bunch of 64-bit bitmaps. Unsurprisingly, 64-bit popcount is quite often useful for this.)
- treerex 10y agoCompiler vendors have been doing stuff like this (recognizing specific code patterns from common benchmarks) for 30 years, back in the days when there was real competition amongst C compilers (Borland vs. Zortech, for example.)
- gjm11 10y agoYup. But the HN discussion of this one seemed to be treating it as an instance of compilers being terribly clever to benefit their actual users, rather than yet another benchmark hack.