diff --git a/lib/Target/X86/X86ISelLowering.cpp b/lib/Target/X86/X86ISelLowering.cpp index b4cb04344ea..d02dc761db0 100644 --- a/lib/Target/X86/X86ISelLowering.cpp +++ b/lib/Target/X86/X86ISelLowering.cpp @@ -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"); diff --git a/test/CodeGen/X86/divide-windows-itanium.ll b/test/CodeGen/X86/divide-windows-itanium.ll new file mode 100644 index 00000000000..4a8a9138073 --- /dev/null +++ b/test/CodeGen/X86/divide-windows-itanium.ll @@ -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 +