[LLVMbugs] [Bug 20927] New: [ARM64] Inefficient range check sequence

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Sep 12 14:30:50 PDT 2014


            Bug ID: 20927
           Summary: [ARM64] Inefficient range check sequence
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: AArch64
          Assignee: unassignedbugs at nondot.org
          Reporter: grosbach at apple.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

long foo(long a, long b, long v1, long v2) {
  if (a >= v1 && a < v2)
    return b;
  return 0;

We generate:
    cmp    x0, x2
    csinc    w8, wzr, wzr, lt
    cmp    x0, x3
    csinc    w9, wzr, wzr, ge
    and    w8, w8, w9
    cmp    w8, #0
    csel    x0, x1, xzr, ne

This seems like it should have generated something like:
  mov x4, #0
  cmp x0, x2
  ccmp x0, x3, #imm, lt
  csel x0, x1, x4, ge

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140912/f555d283/attachment.html>

More information about the llvm-bugs mailing list