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: unassig...@gcc.gnu.org ReportedBy: drepper....@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.