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

            Bug ID: 45700
           Summary: Failure to optimize condition into sbb
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected]

int f(int a, unsigned b, unsigned c)
{
    if (b <= c)
        a++;
    return a;
}

This optimizes into an sbb on gcc : 

f(int, unsigned int, unsigned int):
  mov eax, edi
  cmp edx, esi
  sbb eax, -1
  ret

With LLVM, this is output instead :

f(int, unsigned int, unsigned int):
  xor eax, eax
  cmp esi, edx
  setbe al
  add eax, edi
  ret

And I doubt that is faster than the sbb.

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

Reply via email to