[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)
commitf997759aef281363c6209b6bb3ddc737188b8931
treee73dacd532c7f14aa04701bc22280ff897bda382
parenta03380808cf5ab1e7179700ff904324e6c097a2c
[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

llvm-svn: 283383
llvm/lib/Target/ARM/ARMISelLowering.cpp
llvm/test/CodeGen/ARM/Windows/dbzchk.ll
llvm/test/CodeGen/ARM/divmod-eabi.ll