OSDN Git Service

[mips] Materialize constants for multiplication
authorSimon Dardis <simon.dardis@mips.com>
Fri, 13 Apr 2018 16:09:07 +0000 (16:09 +0000)
committerSimon Dardis <simon.dardis@mips.com>
Fri, 13 Apr 2018 16:09:07 +0000 (16:09 +0000)
commit4467b4ce957527a69e8d1cca95ad9b07d038f162
tree3fe1fdfebb2b52a4bee96ba1c2051f1119a7813e
parentcef8ffa7205eda8f4f00073163324638fa0bda94
[mips] Materialize constants for multiplication

Previously, the MIPS backend would alwyas break down constant multiplications
into a series of shifts, adds, and subs. This patch changes that so the cost of
doing so is estimated.

The cost is estimated against worst case constant materialization and retrieving
the results from the HI/LO registers.

For cases where the value type of the multiplication is not legal, the cost of
legalization is estimated and is accounted for before performing the
optimization of breaking down the constant

This resolves PR36884.

Thanks to npl for reporting the issue!

Reviewers: abeserminji, smaksimovic

Differential Revision: https://reviews.llvm.org/D45316

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330037 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/Mips/MipsSEISelLowering.cpp
test/CodeGen/Mips/const-mult.ll