OSDN Git Service

[ARM] Use __rt_div functions for divrem on Windows
authorMartin Storsjo <martin@martin.st>
Wed, 5 Oct 2016 21:08:02 +0000 (21:08 +0000)
committerMartin Storsjo <martin@martin.st>
Wed, 5 Oct 2016 21:08:02 +0000 (21:08 +0000)
commit8c96de46937060554649f11c599ff6dcccef20bd
tree236f5d76c1c8c69873bccc53bf25c1d39bc88e75
parent53666490406a64ec562c830b1f5f1f2b7eb2ed8d
[ARM] Use __rt_div functions for divrem on Windows

This avoids falling back to calling out to the GCC rem functions
(__moddi3, __umoddi3) when targeting Windows.

The __rt_div functions have flipped the two arguments compared
to the __aeabi_divmod functions. To match MSVC, we emit a
check for division by zero before actually calling the library
function (even if the library function itself also might do
the same check).

Not all calls to __rt_div functions for division are currently
merged with calls to the same function with the same parameters
for the remainder. This is more wasteful than a div + mls as before,
but avoids calls to __moddi3.

Differential Revision: https://reviews.llvm.org/D24076

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283383 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/ARM/ARMISelLowering.cpp
test/CodeGen/ARM/Windows/dbzchk.ll
test/CodeGen/ARM/divmod-eabi.ll