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/50984] New: Boolean return value expression clears register too often


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

             Bug #: 50984
           Summary: Boolean return value expression clears register too
                    often
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: drepper.fsp@gmail.com
            Target: x86_64-linux


Compile this code with the current HEAD gcc (or 4.5, I tried that as well) and
you see less than optimal code:

int
f(int a, int b)
{
  return a & 8 && b & 4;
}

For x86-64 I see this asm code:
    xorl    %eax, %eax
    andl    $8, %edi
    je    .L2
    xorl    %eax, %eax      <----- Unnecessary !!!
    andl    $4, %esi
    setne    %al
.L2:
    rep
    ret

The compiler should realize that the second xor is unnecessary.


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