https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94617
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
IIRC you can also express the range test this way:
const char* vanilla_bandpass(int a, int b, int x, const char* low, const char*
high)
{
const bool within_interval { (unsigned long)x - a < (unsigned long)b - a };
return (within_interval ? high : low);
}
which gives you
_Z16vanilla_bandpassiiiPKcS0_:
.LFB0:
.cfi_startproc
movslq %edi, %rdi
movslq %edx, %rdx
movslq %esi, %rsi
movq %rcx, %rax
subq %rdi, %rdx
subq %rdi, %rsi
cmpq %rsi, %rdx
cmovb %r8, %rax
ret