[llvm-bugs] [Bug 42818] New: Missed optimization for std::div

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jul 29 15:05:41 PDT 2019


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

            Bug ID: 42818
           Summary: Missed optimization for std::div
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: david.bolvansky at gmail.com
                CC: llvm-bugs at lists.llvm.org

std::div - Computes both the quotient and the remainder of the division of the
numerator x by the denominator y.

int d() {

    std::div_t q = std::div(12, 6);

    return q.rem;
}

Clang trunk -O3
d():                              # @mxain()
        push    rax
        mov     edi, 12
        mov     esi, 6
        call    div
        shr     rax, 32
        pop     rcx
        ret

-- 
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/20190729/57c9a01e/attachment.html>


More information about the llvm-bugs mailing list