Page MenuHomePhabricator

[mips] Materialize constants for multiplication

Authored by sdardis on Apr 5 2018, 5:53 AM.



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 PR 36884.

Thanks to npl for reporting the issue!

Diff Detail


Event Timeline

sdardis created this revision.Apr 5 2018, 5:53 AM
atanasyan added inline comments.
732 ↗(On Diff #141136)

clang-format these lines

LGTM, though to me it seems like WorkQueue behaves more like a WorkStack.
Which makes less sense when I think about it, but reflects better how it works.

abeserminji accepted this revision.Apr 12 2018, 10:11 AM
This revision is now accepted and ready to land.Apr 12 2018, 10:11 AM

Thanks for the review.

715 ↗(On Diff #141136)

I'll rename this to WorkStack.

732 ↗(On Diff #141136)

Will fix on commit.

This revision was automatically updated to reflect the committed changes.