https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110165

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This will fix the issue:
/* (zero_one == 0) ? y : z <op> y -> ((typeof(y))zero_one * z) <op> y */
(for op (bit_xor bit_ior plus)
 (simplify
  (cond (eq@3 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 (mult (convert:type @3) @2) @1))))

/* (zero_one != 0) ? z <op> y : y -> ((typeof(y))zero_one * z) <op> y */
(for op (bit_xor bit_ior plus)
 (simplify
  (cond (ne@3 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 (mult (convert:type @3) @2) @1))))

Though it could be improved better. maybe convert followed by & 1 and still @0
rather than @3. still deciding.

Reply via email to