[PATCH] D126644: [llvm/CodeGen] Add ExpandLargeDivRem pass

Phoebe Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 17 07:32:56 PDT 2022


pengfei added a comment.

> One issues is that we don't have a fixed type here. There are existing library functions to do 64 bit or 128 bit division, but here we want to implement divisions with any bitsize above 129. This makes defining an ABI harder.

Yeah, X86 psABI has new defination for fixed bitsize. But it doesn't help here.

> In addition, the main runtime library on Linux is libgcc, and it lacks such functions. It won't be easy to get them added to libgcc due to the fact that gcc doesn't have _BitInt support yet.

Applaud. Implementing runtime library per to ABI is problematic. It is easy resulting in backward compatibility issues. So I incline to this approach. But I didn't look into the details and long discussions, I'd like to other reviewers to sign off.



================
Comment at: llvm/include/llvm/CodeGen/ExpandLargeDivRem.h:1
+//===----- ExpandReductions.h - Expand large div/rem ----------------------===//
+//
----------------
Update the name.


================
Comment at: llvm/include/llvm/CodeGen/MachinePassRegistry.def:46
 FUNCTION_PASS("post-inline-ee-instrument", EntryExitInstrumenterPass, (true))
+FUNCTION_PASS("expandlargedivrem", ExpandLargeDivRemPass, ())
 FUNCTION_PASS("expand-reductions", ExpandReductionsPass, ())
----------------
Nit: Maybe better to use `expand-large-div-rem`.


================
Comment at: llvm/lib/CodeGen/ExpandLargeDivRem.cpp:1
+//===--- ExpandMemCmp.cpp - Expand large div/rem ---------------------------===/
+//
----------------
Ditto.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D126644



More information about the llvm-commits mailing list