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

            Bug ID: 47550
           Summary: Missed optimization for range check for negative
                    numbers
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]

bool rangecheck (int i, int x)
{
  return i > x && i < 0;
}



Clang:
rangecheck(int, int):                       # @rangecheck(int, int)
        cmp     edi, esi
        setg    cl
        test    edi, edi
        sets    al
        and     al, cl
        ret

GCC:
rangecheck(int, int):
        cmp     edi, esi
        setg    al
        shr     edi, 31
        and     eax, edi
        ret


https://godbolt.org/z/PPTP4o

-- 
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