[PATCH] D27245: Integer division expansion should handle constant divisors intelligently

Dmitri Shtilman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 29 19:07:20 PST 2016


dshtilman created this revision.
dshtilman added a reviewer: vsk.
dshtilman added subscribers: llvm-commits, qcolombet, RKSimon.
dshtilman set the repository for this revision to rL LLVM.

The following patch improves integer division sw expansion.
Namely - the case of division by a constant, which would be expanded to a simple multiplication by a magic number rather than a full division loop.
Implementation follows the DAG code in TargetLowering::BuildSDIV().
Ref: "Hacker's Delight" or "The PowerPC Compiler Writer's Guideā€.

Please review.
Dmitri


Repository:
  rL LLVM

https://reviews.llvm.org/D27245

Files:
  lib/Transforms/Utils/IntegerDivision.cpp
  unittests/Transforms/Utils/IntegerDivision.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27245.79694.patch
Type: text/x-patch
Size: 8924 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161130/aaf8c12a/attachment-0001.bin>


More information about the llvm-commits mailing list