[PATCH] D24071: [compiler-rt] [builtins] Allow building the necessary ARM builtins for MSVC mode with cmake
Martin Storsjö via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 31 05:00:42 PDT 2016
mstorsjo added a comment.
In https://reviews.llvm.org/D24071#530136, @rengolin wrote:
> In https://reviews.llvm.org/D24071#530115, @jmolloy wrote:
> > Ah, OK, then we need to handle them similar to __eabi_divmod. The right place to change is in lib/Target/ARM/ARMISelLowering.cpp - look for divmod and see what changes you need to teach LLVM that __rt_div* isn't just DIV but DIVMOD too.
> Yup. In EABI, both mod and divmod call aeabi_divmod. Mod, in DAG, connects to the second return value directly and LLVM knows how to lower that directly.
> I suspect you'll need to do the same for many other EABI calls, not just divmod.
Actually, in my testing with a fairly large codebase, it doesn't emit any EABI calls (those are only hooked up in ARMISelLowering.cpp if the target uses EABI) - the only ones outside of the ones that are present in the msvc "builtins" static lib are __moddi3 and __umoddi3.
With a bit of crude hacking, I managed to hook up __rt_sdiv and __rt_sdiv64 to be called in the same fashion as __aeabi_idivmod and __aeabi_ldivmod. But there's another gotcha - __rt_sdiv takes the two operands in the opposite order compared to __aeabi_idivmod. How do I change that for these ones?
More information about the llvm-commits