[PATCH] D120329: [SelectionDAG] Emit calls to __divei4 and friends for division/remainder of large integers

LuoYuanke via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 9 01:08:43 PST 2022


LuoYuanke added inline comments.


================
Comment at: llvm/include/llvm/IR/RuntimeLibcalls.def:50
 HANDLE_LIBCALL(MUL_I128, "__multi3")
+HANDLE_LIBCALL(MUL_IEXT, nullptr)
+
----------------
Why set mul? Is there any test case for it?


================
Comment at: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:2110
+  default:
+    LC = Call_IEXT;
+    break;
----------------
Do we support bitsize that is no power of 2 (e.g., MVT::i1)? Should we check if the bit size exceed 128?


================
Comment at: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:4346
     break;
   case ISD::MUL:
+    Results.push_back(ExpandIntLibCall(
----------------
Why touch MUL? Can't MUL be splitted by Codegen? 


================
Comment at: llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp:3990
+  else {
+    SDValue Result =
+        passArguments_DIVREM(TLI, RTLIB::SDIV_IEXT, DAG, N, dl, VT);
----------------
Do we need to check type bit size exceed 128?


================
Comment at: llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp:3991
+    SDValue Result =
+        passArguments_DIVREM(TLI, RTLIB::SDIV_IEXT, DAG, N, dl, VT);
+    SplitInteger(Result, Lo, Hi);
----------------
Is expandExtIntRes_DIVREM more readable as the function name?


================
Comment at: llvm/test/CodeGen/X86/udivmodei5.ll:9
+; X86-NEXT:    pushl %ebp
+; X86-NEXT:    .cfi_def_cfa_offset 8
+; X86-NEXT:    .cfi_offset %ebp, -8
----------------
Add nounwind to avoid generating cfi instruction.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D120329/new/

https://reviews.llvm.org/D120329



More information about the llvm-commits mailing list