This is the mail archive of the gcc-bugs@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]

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


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).


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