https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115896
--- Comment #1 from Gabriel Ravier <gabravier at gmail dot com> --- A generalization of this is that `(a << cst0) == cst1` should be foldable to `a == cst0 >> cst1`, leading to the much more obvious case of: bool f1(int8_t a) { int32_t b = a << 4; return b == -128; } being optimized by LLVM to `a == -8` (I think since commit 291c3d8ff21652a7bd654cfc170e0891e46a84da), which GCC does not do.