[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 Feb 23 01:54:09 PST 2022


LuoYuanke added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp:3925
+    Type *ArgTy = ArgVT.getTypeForEVT(*DAG.getContext());
+    Entry.Ty = PointerType::get(ArgTy, 0);
+    Entry.IsSExt = false;
----------------
mgehre-amd wrote:
> LuoYuanke wrote:
> > Not sure if the pointer is "i32 *" or "i129 *".
> The pointer here will be i256* (after i129 is expanded to i256).
> The `__udivei4` argument is `unsigned int[]` to allow for any bitsize.
Is it reasonable to have the pointer be "i32 *" so that is align the prototype of `__udivei4`?


================
Comment at: llvm/test/CodeGen/X86/udivmodei5.ll:28
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rdx
+; CHECK-NEXT:    addq $104, %rsp
----------------
mgehre-amd wrote:
> LuoYuanke wrote:
> > Is there any ABI description that shows how to pass i129 parameter or return i129 value?
> My observation is that those get passed around as pointers, and my interpretation is that they are handled like big structs. Also we only seem to generated power-of-2 sizes after SelectionDAG, so we are passing a i256 here.
OK, backend would call TLI->getNumRegistersForCallingConv() to calculate how many virtual register are needed and follow the calling convention to allocate register or memory.


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