[Bug c/13827] New: Missed reassociation optimization

nathan at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Fri Jan 23 09:32:00 GMT 2004


The compiler doesn't appear to convert
  (a & MASK) != (b & MASK)
into
  ((a ^ b) & MASK) != 0

The former occurs a lot in flag comparisons, and (I'd expect) bitfield
comparisons.

Here is the -O2 code I get
foo:
        pushl   %ebp
        movl    %esp, %ebp
        movl    8(%ebp), %edx
        movl    12(%ebp), %eax
        andl    $65280, %eax
        andl    $65280, %edx
        cmpl    %eax, %edx
        setne   %al
        movzbl  %al, %eax
        leave
        ret

-- 
           Summary: Missed reassociation optimization
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: nathan at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: i686-pc-linux-gnu


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



More information about the Gcc-bugs mailing list