http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59615
--- Comment #2 from Uroš Bizjak <ubizjak at gmail dot com> ---
Looking at the assembly, you probably want:
--cut here--
int test (int a, int b, int c)
{
unsigned r = a + b;
if (r < (unsigned) a)
return 1;
else if (r > c)
return 1;
return 0;
}
--cut here--
gcc-4.8.2 -O2:
test:
addl %esi, %edi
movl $1, %eax
jc .L2
xorl %eax, %eax
cmpl %edx, %edi
seta %al
.L2:
rep ret
Please note how the compiler is able to generate jc without compare insn.
