[Bug target/59968] Unused BT patterns

hjl.tools at gmail dot com gcc-bugzilla@gcc.gnu.org
Tue Jan 28 18:22:00 GMT 2014


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59968

--- Comment #11 from H.J. Lu <hjl.tools at gmail dot com> ---
For

int bar1;
void
__attribute__((noinline))
foo1 (int y)
{
  if ((bar1 & (1 << y)))
    bar1 &= ~(1 << y);
}

we generate

    .cfi_startproc
    movl    bar1(%rip), %eax
    btl    %edi, %eax
    jnc    .L1
    movl    $-2, %edx
    movl    %edi, %ecx
    roll    %cl, %edx
    andl    %edx, %eax
    movl    %eax, bar1(%rip)
.L1:
    rep ret

I expect

    btr %edi, bar2(%rip)
    ret



More information about the Gcc-bugs mailing list