[llvm-bugs] [Bug 45961] New: Poor x86-64 64-bit divide code generation (regression)

via llvm-bugs llvm-bugs at lists.llvm.org
Sun May 17 12:10:15 PDT 2020


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

            Bug ID: 45961
           Summary: Poor x86-64 64-bit divide code generation (regression)
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: raul at tambre.ee
                CC: craig.topper at gmail.com, llvm-bugs at lists.llvm.org,
                    llvm-dev at redking.me.uk, spatel+llvm at rotateright.com

define i32 @div64(i32 %0, i32 %1) #0 {
  %3 = sext i32 %0 to i64
  %4 = sext i32 %1 to i64
  %5 = sdiv i64 %3, %4
  %6 = trunc i64 %5 to i32
  ret i32 %6
}

attributes #0 = { "target-cpu"="x86-64"}

LLVM 11 (trunk):
f(int, int):                                 # @f(int, int)
        movsxd  rax, edi
        movsxd  rcx, esi
        mov     rdx, rax
        or      rdx, rcx
        shr     rdx, 32
        je      .LBB0_1
        cqo
        idiv    rcx
        ret
.LBB0_1:
        mov     eax, edi
        xor     edx, edx
        div     esi
        ret

LLVM 10:

f(int, int):                                 # @f(int, int)
        movsxd  rax, edi
        movsxd  rcx, esi
        cqo
        idiv    rcx
        ret

from
https://stackoverflow.com/questions/61856447/difference-of-long-long-vs-int-int

-- 
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/20200517/e0f62c89/attachment.html>


More information about the llvm-bugs mailing list