[Bug tree-optimization/50984] New: Boolean return value expression clears register too often
drepper.fsp at gmail dot com
gcc-bugzilla@gcc.gnu.org
Thu Nov 3 18:09:00 GMT 2011
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.
More information about the Gcc-bugs
mailing list