[PATCH] D83381: [AMDGPU] Fix and simplify AMDGPUCodeGenPrepare::expandDivRem32

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 8 04:26:51 PDT 2020


foad created this revision.
foad added reviewers: arsenm, rampitec, b-sumner.
Herald added subscribers: llvm-commits, kerbowa, asbirlea, hiraditya, t-tye, tpr, dstuttard, yaxunl, nhaehnle, wdng, jvesely, kzhuravl.
Herald added a project: LLVM.

Fix the division/remainder algorithm by adding a second quotient
refinement step, which is required in some cases like
0xFFFFFFFFu / 0x11111111u (https://bugs.llvm.org/show_bug.cgi?id=46212).

Also document, rewrite and simplify it by ensuring that we always have a
lower bound on inv(y), which simplifies the UNR step and the quotient
refinement steps.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D83381

Files:
  llvm/lib/Target/AMDGPU/AMDGPUCodeGenPrepare.cpp
  llvm/test/CodeGen/AMDGPU/GlobalISel/sdiv.i32.ll
  llvm/test/CodeGen/AMDGPU/GlobalISel/srem.i32.ll
  llvm/test/CodeGen/AMDGPU/GlobalISel/udiv.i32.ll
  llvm/test/CodeGen/AMDGPU/GlobalISel/urem.i32.ll
  llvm/test/CodeGen/AMDGPU/amdgpu-codegenprepare-fold-binop-select.ll
  llvm/test/CodeGen/AMDGPU/amdgpu-codegenprepare-idiv.ll
  llvm/test/CodeGen/AMDGPU/bypass-div.ll
  llvm/test/CodeGen/AMDGPU/idiv-licm.ll
  llvm/test/CodeGen/AMDGPU/sdiv.ll
  llvm/test/CodeGen/AMDGPU/udivrem.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83381.276370.patch
Type: text/x-patch
Size: 475691 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200708/a6ab1260/attachment-0001.bin>


More information about the llvm-commits mailing list