public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/50984] New: Boolean return value expression clears register too often
@ 2011-11-03 18:09 drepper.fsp at gmail dot com
  2011-11-03 18:11 ` [Bug target/50984] " pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: drepper.fsp at gmail dot com @ 2011-11-03 18:09 UTC (permalink / raw)
  To: gcc-bugs

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.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-08-18  5:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-03 18:09 [Bug tree-optimization/50984] New: Boolean return value expression clears register too often drepper.fsp at gmail dot com
2011-11-03 18:11 ` [Bug target/50984] " pinskia at gcc dot gnu.org
2011-11-03 20:01 ` [Bug rtl-optimization/50984] " ubizjak at gmail dot com
2011-11-05 17:05 ` svfuerst at gmail dot com
2021-08-18  5:33 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).