https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52252
--- Comment #12 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to rguent...@suse.de from comment #11) > We're lacking a way to say one of the bit_not should be single-used, > one multi-use would be OK and a fair trade-off - not sure if that > would be enough here, of course. That would mena changing to > a condition with single_use (). That does not fix it though. Because in this case we have: c_19 = ~r_16; m_20 = ~g_17; y_21 = ~b_18; tmp_22 = MIN_EXPR <m_20, y_21>; k_23 = MIN_EXPR <c_19, tmp_22>; _1 = c_19 - k_23; _3 = m_20 - k_23; _5 = y_21 - k_23; .. = k_23; So both bit_not are used more than once. so we have `~a - MIN<MIN<~a, ~b>, ~c>` which is the same as `MAX<MAX<a,b>,c> - a`. Let me file this as a seperate bug to continue the discussion there.