This is an archive of the discontinued LLVM Phabricator instance.

[ARM] Reapply: Use __rt_div functions for divrem on Windows
ClosedPublic

Authored by mstorsjo on Oct 6 2016, 9:32 AM.

Details

Summary

Reapplying r283383 after revert in r283442. The additional fix is a getting rid of a stray space in a function name, in the refactoring part of the commit.

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.

This is reapplying D24076 with one additional typo fix.

Diff Detail

Event Timeline

mstorsjo updated this revision to Diff 73809.Oct 6 2016, 9:32 AM
mstorsjo retitled this revision from to [ARM] Reapply: Use __rt_div functions for divrem on Windows.
mstorsjo updated this object.
mstorsjo added reviewers: compnerd, rovka.
mstorsjo added a subscriber: llvm-commits.
rovka accepted this revision.Oct 7 2016, 5:14 AM
rovka edited edge metadata.

Hi Martin,

I tested this with a config similar to the clang-native-arm-lnt bot and it seems to work fine. I think you can try to commit it again.

This revision is now accepted and ready to land.Oct 7 2016, 5:14 AM
This revision was automatically updated to reflect the committed changes.