[llvm] r284175 - CodeGen: use MSVC division on windows itanium
Saleem Abdulrasool via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 13 16:00:11 PDT 2016
Author: compnerd
Date: Thu Oct 13 18:00:11 2016
New Revision: 284175
URL: http://llvm.org/viewvc/llvm-project?rev=284175&view=rev
Log:
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.
Added:
llvm/trunk/test/CodeGen/X86/divide-windows-itanium.ll
Modified:
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=284175&r1=284174&r2=284175&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Thu Oct 13 18:00:11 2016
@@ -114,7 +114,8 @@ X86TargetLowering::X86TargetLowering(con
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");
Added: llvm/trunk/test/CodeGen/X86/divide-windows-itanium.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/divide-windows-itanium.ll?rev=284175&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/divide-windows-itanium.ll (added)
+++ llvm/trunk/test/CodeGen/X86/divide-windows-itanium.ll Thu Oct 13 18:00:11 2016
@@ -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
+
More information about the llvm-commits
mailing list