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

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 28 19:09:05 PDT 2022


craig.topper added inline comments.


================
Comment at: llvm/lib/CodeGen/ExpandLargeDivRem.cpp:12
+// This is useful for backends like x86 that cannot lower divisions
+// with more than 128 bits.
+//
----------------
mgehre-amd wrote:
> craig.topper wrote:
> > mgehre-amd wrote:
> > > craig.topper wrote:
> > > > I think but haven't checked that 32-bit x86, ARM, RISCV32, and other 32-bit targets can't lower division with more than 64 bits.
> > > I checked x86_32 and it lowers 128 bit divisions to __divti3: https://godbolt.org/z/Y6hT9n3x5
> > But it fails to link https://godbolt.org/z/5x38Gxqa9 so I think that's a bug. __divti3 doesn't exist in 32-bit libgcc.
> That's a good observation! I will update the comment.
> I also need to modify the follow-up PR, https://reviews.llvm.org/D130076, 
> to set the correct limits for those targets.
I thought about disabling that libcall in 32-bit mode, but the it is supported by compiler-rt. So I guess a linker error when using libgcc is better than a compiler error when using compiler-rt or libgcc until we get this pass in.


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