Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion llvm/include/llvm/IR/RuntimeLibcalls.td
Original file line number Diff line number Diff line change
Expand Up @@ -2129,7 +2129,7 @@ defvar X86CommonLibcalls =
);

defvar Windows32DivRemMulCalls =
LibcallImpls<(add WindowsDivRemMulLibcalls),
LibcallsWithCC<(add WindowsDivRemMulLibcalls), X86_STDCALL,
RuntimeLibcallPredicate<"TT.isWindowsMSVCEnvironment() || TT.isWindowsItaniumEnvironment()">>;

def X86_32SystemLibrary
Expand Down
72 changes: 72 additions & 0 deletions llvm/test/CodeGen/X86/win32-int-runtime-libcalls.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
; RUN: llc -mtriple=i686-windows-msvc < %s | FileCheck %s

define i64 @test_sdiv_i64(i64 %a, i64 %b) {
; CHECK-LABEL: test_sdiv_i64:
; CHECK: # %bb.0:
; CHECK-NEXT: pushl {{[0-9]+}}(%esp)
; CHECK-NEXT: pushl {{[0-9]+}}(%esp)
; CHECK-NEXT: pushl {{[0-9]+}}(%esp)
; CHECK-NEXT: pushl {{[0-9]+}}(%esp)
; CHECK-NEXT: calll __alldiv
; CHECK-NEXT: retl
%ret = sdiv i64 %a, %b
ret i64 %ret
}

define i64 @test_srem_i64(i64 %a, i64 %b) {
; CHECK-LABEL: test_srem_i64:
; CHECK: # %bb.0:
; CHECK-NEXT: pushl {{[0-9]+}}(%esp)
; CHECK-NEXT: pushl {{[0-9]+}}(%esp)
; CHECK-NEXT: pushl {{[0-9]+}}(%esp)
; CHECK-NEXT: pushl {{[0-9]+}}(%esp)
; CHECK-NEXT: calll __allrem
; CHECK-NEXT: retl
%ret = srem i64 %a, %b
ret i64 %ret
}

define i64 @test_udiv_i64(i64 %a, i64 %b) {
; CHECK-LABEL: test_udiv_i64:
; CHECK: # %bb.0:
; CHECK-NEXT: pushl {{[0-9]+}}(%esp)
; CHECK-NEXT: pushl {{[0-9]+}}(%esp)
; CHECK-NEXT: pushl {{[0-9]+}}(%esp)
; CHECK-NEXT: pushl {{[0-9]+}}(%esp)
; CHECK-NEXT: calll __aulldiv
; CHECK-NEXT: retl
%ret = udiv i64 %a, %b
ret i64 %ret
}

define i64 @test_urem_i64(i64 %a, i64 %b) {
; CHECK-LABEL: test_urem_i64:
; CHECK: # %bb.0:
; CHECK-NEXT: pushl {{[0-9]+}}(%esp)
; CHECK-NEXT: pushl {{[0-9]+}}(%esp)
; CHECK-NEXT: pushl {{[0-9]+}}(%esp)
; CHECK-NEXT: pushl {{[0-9]+}}(%esp)
; CHECK-NEXT: calll __aullrem
; CHECK-NEXT: retl
%ret = urem i64 %a, %b
ret i64 %ret
}

define i64 @test_mul_i64(i64 %a, i64 %b) {
; CHECK-LABEL: test_mul_i64:
; CHECK: # %bb.0:
; CHECK-NEXT: pushl %esi
; CHECK-NEXT: movl {{[0-9]+}}(%esp), %ecx
; CHECK-NEXT: movl {{[0-9]+}}(%esp), %esi
; CHECK-NEXT: movl %ecx, %eax
; CHECK-NEXT: mull %esi
; CHECK-NEXT: imull {{[0-9]+}}(%esp), %ecx
; CHECK-NEXT: addl %ecx, %edx
; CHECK-NEXT: imull {{[0-9]+}}(%esp), %esi
; CHECK-NEXT: addl %esi, %edx
; CHECK-NEXT: popl %esi
; CHECK-NEXT: retl
%ret = mul i64 %a, %b
ret i64 %ret
}
Loading