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

Matthias Gehre via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 29 01:20:25 PDT 2022


mgehre-amd added a comment.

In D126644#3686479 <https://reviews.llvm.org/D126644#3686479>, @hiraditya wrote:

> We usually provide a runtime library for specialized functionalities like this. Are such division operations common enough to benefit from compiler generated code?

We explored and prototyped the approach of adding a functions to compiler-rt in a different PR. We discovered multiple issues.

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.
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.
Providing an additional runtime on top of libgcc with just those new functions is also new territory.

So in the end, a lot of things become easier by just doing the transformation on the IR directly.


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