1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 11:42:57 +01:00

CodeGen: use MSVC division on windows itanium

Windows itanium is identical to MSVC when dealing with everything but C++.
Lower the math routines into msvcrt rather than compiler-rt.

llvm-svn: 284175
This commit is contained in:
Saleem Abdulrasool 2016-10-13 23:00:11 +00:00
parent ec882c3b4f
commit 520d92773b
2 changed files with 40 additions and 1 deletions

View File

@ -114,7 +114,8 @@ X86TargetLowering::X86TargetLowering(const X86TargetMachine &TM,
addBypassSlowDiv(64, 16);
}
if (Subtarget.isTargetKnownWindowsMSVC()) {
if (Subtarget.isTargetKnownWindowsMSVC() ||
Subtarget.isTargetWindowsItanium()) {
// Setup Windows compiler runtime calls.
setLibcallName(RTLIB::SDIV_I64, "_alldiv");
setLibcallName(RTLIB::UDIV_I64, "_aulldiv");

View File

@ -0,0 +1,38 @@
; RUN: llc -mtriple i686-windows-itanium -filetype asm -o - %s | FileCheck %s
define i64 @f(i64 %i, i64 %j) {
%1 = sdiv i64 %i, %j
ret i64 %1
}
; CHECK-LABEL: _f:
; CHECK-NOT: calll ___divdi3
; CHECK: calll __alldiv
define i64 @g(i64 %i, i64 %j) {
%1 = udiv i64 %i, %j
ret i64 %1
}
; CHECK-LABEL: _g:
; CHECK-NOT: calll ___udivdi3
; CHECK: calll __aulldiv
define i64 @h(i64 %i, i64 %j) {
%1 = srem i64 %i, %j
ret i64 %1
}
; CHECK-LABEL: _h:
; CHECK-NOT: calll ___moddi3
; CHECK: calll __allrem
define i64 @i(i64 %i, i64 %j) {
%1 = urem i64 %i, %j
ret i64 %1
}
; CHECK-LABEL: _i:
; CHECK-NOT: calll ___umoddi3
; CHECK: calll __aullrem