http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52056
--- Comment #1 from gccbug at jamasaru dot com 2012-01-30 22:34:37 UTC --- While not relevant to gcc itself, it is interesting that clang also has trouble with consistently identifying this optimization, but in an opposite way to GCC. For clang, the unsigned shift code is faster (11.9 seconds) compared to clang's signed shift (13.3 seconds.) GCC's speeds are 24.3 and 11.3 seconds respectively. clang does not have any sensitivity to the static variable declaration.