[PATCH] D103799: [CostModel] Express cost(urem) as cost(div+mul+sub) when set to Expand.

Sander de Smalen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 7 03:01:53 PDT 2021


sdesmalen created this revision.
Herald added a subscriber: kristof.beyls.
sdesmalen requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

The Legalizer expands the operations of urem/srem into a div+mul+sub or divrem
when those are legal/custom. This patch changes the cost-model to reflect that
cost.

Since there is no 'divrem' Instruction in LLVM IR, the cost of divrem
is assumed to be the same as div+mul+sub since the three operations will
need to be executed at runtime regardless.

Patch co-authored by David Sherwood (@david-arm)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D103799

Files:
  llvm/include/llvm/CodeGen/BasicTTIImpl.h
  llvm/test/Analysis/CostModel/AArch64/sve-remainder.ll
  llvm/test/Analysis/CostModel/ARM/divrem.ll
  llvm/test/Analysis/CostModel/X86/rem.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103799.350218.patch
Type: text/x-patch
Size: 134694 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210607/92c8a689/attachment-0001.bin>


More information about the llvm-commits mailing list