https://gcc.gnu.org/bugzilla/show_bug.cgi?id=28306
Steven Bosscher <steven at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed|2006-07-07 17:30:13 |2019-3-5 Host|i686-pc-linux-gnu | --- Comment #4 from Steven Bosscher <steven at gcc dot gnu.org> --- GCC trunk today on x86-64 produces: gen_x86_64_shrd(int): xorl %eax, %eax ret ok(int): movl $1, %eax ret ix86_split_ashr(int): testl %edi, %edi movl $ok(int), %eax movl $gen_x86_64_shrd(int), %edx cmove %rdx, %rax xorl %edi, %edi jmp *%rax FWIW clang trunk also does not optimize this, yielding: ix86_split_ashr(int): # @ix86_split_ashr(int) testl %edi, %edi movl $gen_x86_64_shrd(int), %eax movl $ok(int), %ecx cmoveq %rax, %rcx xorl %edi, %edi jmpq *%rcx # TAILCALL ok(int): # @ok(int) movl $1, %eax retq gen_x86_64_shrd(int): # @gen_x86_64_shrd(int) xorl %eax, %eax retq ICC 19.0.1 _does_ optimize, resulting in: ix86_split_ashr(int): ret #24.1 _INTERNALf242c0c5::gen_x86_64_shrd(int): xorl %eax, %eax #6.10 ret #6.10 _INTERNALf242c0c5::ok(int): movl $1, %eax #12.10 ret #12.10