https://bugs.llvm.org/show_bug.cgi?id=49028

            Bug ID: 49028
           Summary: Failure to optimize out test based on shr flags
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedb...@nondot.org
          Reporter: gabrav...@gmail.com
                CC: llvm-bugs@lists.llvm.org

extern bool z;

uint16_t f(uint16_t m)
{
    m >>= 1;
    z = !m;
    return m;
}

On x86 -O3, GCC outputs this:

f(unsigned short):
  mov eax, edi
  shr ax
  sete BYTE PTR z[rip]
  ret

LLVM outputs this:

f(unsigned short):
  mov eax, edi
  shr eax
  test ax, ax
  sete byte ptr [rip + z]
  ret

The `test` seems like a net loss to me.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to