This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/50984] New: Boolean return value expression clears register too often
- From: "drepper.fsp at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 03 Nov 2011 18:09:00 +0000
- Subject: [Bug tree-optimization/50984] New: Boolean return value expression clears register too often
- Auto-submitted: auto-generated
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.