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: unassignedb...@nondot.org
          Reporter: r...@twiddle.net
                CC: htmldevelo...@gmail.com, llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to