[Bug tree-optimization/52409] New: ((~a)|(~b)) is not simplified at the tree level

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Feb 28 07:13:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52409

             Bug #: 52409
           Summary: ((~a)|(~b)) is not simplified at the tree level
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: pinskia@gcc.gnu.org


Take:
int f(int a, int b)
{
  a = ~a;
  b = ~b;
  return a|b;
}

int g(int a, int b)
{
  return ~(a&b);
}
--- CUT ---
Currently the tree level does not try to combine them, fold does it though.  
I saw this with bools in GCC itself. In the bool case, we can fold it further
to just (a&b) == 0.  

Likewise for (~a)&(~b) into ~(a|b).



More information about the Gcc-bugs mailing list