https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106677
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- On the trunk we now get: _25 = SR.116_117 == 0; _27 = (unsigned char) _25; _32 = _27 | SR.116_117; Rather than: _119 = MAX_EXPR <1, SR.115_117>; But we should instead just get: SR.116_117 | 1 Though that should still be transformed into 1 (will fix that seperately). I have a quick patch which fixes that, we need to move `a ? zero_one_value : zero_one_value` part of match.pd below the min/max detection.