[llvm] [DAGCombiner][LegalizeTypes] Fuse i128 sdiv+srem / udiv+urem into single __divmodti4 / __udivmodti4 call (PR #187908)

Takashi Idobe via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 22 16:24:43 PDT 2026


================
@@ -1786,6 +1786,8 @@ defset list<RuntimeLibcallImpl> Int128RTLibcalls = {
   def __lshrti3 : RuntimeLibcallImpl<SRL_I128>;
   def __ashrti3 : RuntimeLibcallImpl<SRA_I128>;
   def __multi3 : RuntimeLibcallImpl<MUL_I128>;
+  def __divmodti4 : RuntimeLibcallImpl<SDIVREM_I128>;
----------------
Takashiidobe wrote:

I haven't hooked up `__divmoddi4` support for 32-bit targets. If it shows up I misimplemented the PR since I just want i128 for mostly 64-bit targets for now.

`llvm/test/CodeGen/ARM/divmod-eabi.ll` still is emitting `aeabi_ldivmod` so that should be at least a sanity check that's not being replaced by this PR.

https://github.com/llvm/llvm-project/pull/187908


More information about the llvm-commits mailing list