[PATCH] D140750: [TargetLowering] Teach BuildUDIV to take advantage of leading zeros in the dividend.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 28 21:14:34 PST 2022


craig.topper created this revision.
craig.topper added reviewers: RKSimon, spatel, lebedev.ri, efriedma, arsenm.
Herald added subscribers: kosarev, StephenFan, frasercrmck, kerbowa, luismarques, apazos, sameer.abuasal, pengfei, s.egerton, Jim, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, hiraditya, jvesely, nemanjai.
Herald added a project: All.
craig.topper requested review of this revision.
Herald added subscribers: pcwang-thead, MaskRay, wdng.
Herald added a project: LLVM.

If the dividend has leading zeros, we can use them to reduce the
size of the multiplier and avoid the fixup cases.

This patch is for scalars only, but we might be able to do this
for vectors in a follow up.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D140750

Files:
  llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
  llvm/test/CodeGen/AArch64/funnel-shift.ll
  llvm/test/CodeGen/AArch64/urem-vector-lkk.ll
  llvm/test/CodeGen/AMDGPU/fshr.ll
  llvm/test/CodeGen/ARM/select-imm.ll
  llvm/test/CodeGen/PowerPC/funnel-shift.ll
  llvm/test/CodeGen/PowerPC/urem-vector-lkk.ll
  llvm/test/CodeGen/RISCV/urem-vector-lkk.ll
  llvm/test/CodeGen/X86/divide-by-constant.ll
  llvm/test/CodeGen/X86/funnel-shift.ll
  llvm/test/CodeGen/X86/pr38217.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D140750.485577.patch
Type: text/x-patch
Size: 74714 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221229/7f4201e3/attachment.bin>


More information about the llvm-commits mailing list