[Bug tree-optimization/100864] (a&!b) | b is not opimized to a | b for comparisons

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Jun 2 01:33:13 GMT 2021


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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |pinskia at gcc dot gnu.org
   Last reconfirmed|                            |2021-06-02
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |ASSIGNED
            Summary|(a&!b) | b is not opimized  |(a&!b) | b is not opimized
                   |to a | b for conditionals   |to a | b for comparisons

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The pattern which matches this when this is not a comparison:
(for bitop (bit_and bit_ior)
     rbitop (bit_ior bit_and)
  /* (x | y) & x -> x */
  /* (x & y) | x -> x */
 (simplify
  (bitop:c (rbitop:c @0 @1) @0)
  @0)
 /* (~x | y) & x -> x & y */
 /* (~x & y) | x -> x | y */
 (simplify
  (bitop:c (rbitop:c (bit_not @0) @1) @0)
  (bitop @0 @1)))

We should be able to add something similar for 
tcc_comparison/inverted_tcc_comparison_with_nans too.


More information about the Gcc-bugs mailing list