This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PR23664] Fold (a & C1) + (b & C2) to (a & C1) | (b & C2) iff (C1 & C2) == 0


On Tue, 7 Jul 2015, Hurugalawadi, Naveen wrote:

Please find attached the patch "PR23664.patch" that converts the pattern:-
(a & C1) + (b & C2) into (a & C1) | (b & C2) iff (C1 & C2) == 0.

We already have the following. I believe it would be better to merge them (use a 'for').

(simplify
 (bit_xor (convert1? (bit_and@4 @0 INTEGER_CST@1))
          (convert2? (bit_and@5 @2 INTEGER_CST@3)))
 (if (tree_nop_conversion_p (type, TREE_TYPE (@0))
      && tree_nop_conversion_p (type, TREE_TYPE (@2))
      && wi::bit_and (@1, @3) == 0)
  (bit_ior (convert @4) (convert @5))))

--
Marc Glisse


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]