https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118012
Georg-Johann Lay <gjl at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |michael.collison at linaro dot org | |, rguenth at gcc dot gnu.org --- Comment #3 from Georg-Johann Lay <gjl at gcc dot gnu.org> --- Seems it started at r13-4459 with a match.pd pattern that doesn't even try to work out additional costs. +/* ((x & 0x1) == 0) ? y : z <op> y -> (-(typeof(y))(x & 0x1) & z) <op> y */ +(for op (bit_xor bit_ior) + (simplify + (cond (eq zero_one_valued_p@0 + integer_zerop) + @1 + (op:c @2 @1)) + (if (INTEGRAL_TYPE_P (type) + && TYPE_PRECISION (type) > 1 + && (INTEGRAL_TYPE_P (TREE_TYPE (@0)))) + (op (bit_and (negate (convert:type @0)) @2) @1)))) + +/* ((x & 0x1) == 0) ? z <op> y : y -> (-(typeof(y))(x & 0x1) & z) <op> y */ +(for op (bit_xor bit_ior) + (simplify + (cond (ne zero_one_valued_p@0 + integer_zerop) + (op:c @2 @1) + @1) + (if (INTEGRAL_TYPE_P (type) + && TYPE_PRECISION (type) > 1 + && (INTEGRAL_TYPE_P (TREE_TYPE (@0)))) + (op (bit_and (negate (convert:type @0)) @2) @1)))) +