[llvm-bugs] [Bug 45284] New: [arm64] Missed optimizations in __int128_t comparisons

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Mar 23 12:58:27 PDT 2020


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

            Bug ID: 45284
           Summary: [arm64] Missed optimizations in __int128_t comparisons
           Product: new-bugs
           Version: trunk
          Hardware: Other
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: rth at twiddle.net
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

void doit(void);
void test(unsigned long addr, unsigned long size, unsigned long limit)
{
    if ((__uint128_t)addr + size <= (__uint128_t)limit + 1) doit();
}

with HEAD (85c30f3374d9), compiles to

        adds    x8, x1, x0
        adcs    x9, xzr, xzr
        adds    x10, x2, #1
        adcs    x11, xzr, xzr
        cmp     x8, x10                 // comparison start
        cset    w8, hi
        cmp     x9, x11
        cset    w9, hi
        csel    w8, w8, w9, eq          // comparison end
        tbz     w8, #0, .LBB1_2

The comparison can be done with

        cmp     x8, x10
        sbcs    xzr, x9, x11
        b.cs    .LBB1_2

a reduction of 3 insns.

-- 
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/20200323/dc8e2a28/attachment.html>


More information about the llvm-bugs mailing list