https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106138
--- Comment #7 from Pavel M <pavel.morozkin at gmail dot com> --- May be useful: https://devblogs.microsoft.com/cppblog/new-code-optimizer. Search for "Bit Estimator" section containing "Folding comparisons and branches".