http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52070
Bug #: 52070 Summary: missing integer comparison optimization Classification: Unclassified Product: gcc Version: 4.6.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassig...@gcc.gnu.org ReportedBy: drepper....@gmail.com Compile this code with gcc 4.6.2: #include <stddef.h> size_t b; int f(size_t a) { return b == 0 || a < b; } For x86-64 I see this result: f: movq b(%rip), %rdx movl $1, %eax testq %rdx, %rdx je .L2 xorl %eax, %eax cmpq %rdi, %rdx seta %al .L2: rep ret This can be more done without a conditional jump: f: movq b(%rip), %rdx xorl %eax, %eax subq $1, %rdx cmpq %rdi, %rdx setae %al rep ret Unless the b==0 test is marked as likely I'd say this code is performing better on all architectures.