------- Comment #6 from svfuerst at gmail dot com 2010-04-30 20:30 ------- For posterity, I might as well note that with the sbb added on the end we don't need the initial mov instruction if we do some register renaming. This leaves the, hopefully optimal this time, five-instruction fragment as the goal:
shr $0x3f,%rsi lea (%rdi,%rsi,1),%rax and $0x1,%eax sub %rsi,%rax sbb %rdx,%rdx -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43883