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

            Bug ID: 103356
           Summary: bool0 == ~bool1 should simplify to bool1 ^ bool0
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

Take:
bool f(bool a, bool b)
{
  b = !b;
  return a==b;
}

---- CUT ---
LLVM produces:
        mov     eax, edi
        xor     eax, esi
        ret

While GCC produces:
        xor     esi, 1
        cmp     sil, dil
        sete    al
        ret

GCC should be able to produce the xor case.

Reply via email to