This is an archive of the discontinued LLVM Phabricator instance.

[mips] Improve genConstMult() so it works with arbitrary precision
ClosedPublic

Authored by mstojanovic on Sep 21 2017, 4:38 AM.

Details

Summary

APInt is now used instead of uint64_t in function genConstMult() allowing multiplication optimizations with constants of arbitrary length.

Diff Detail

Repository
rL LLVM

Event Timeline

mstojanovic created this revision.Sep 21 2017, 4:38 AM
sdardis requested changes to this revision.Sep 21 2017, 8:40 AM

A negative value have broken it for int128_t, but it's broken for large positive values as well. You need to switch genConstMult to accept an APInt and perform arbitrary precision arithmetic in genConstMult as well.

This revision now requires changes to proceed.Sep 21 2017, 8:40 AM
mstojanovic edited edge metadata.
mstojanovic retitled this revision from [mips] Fix negative constant multiplication when using int128_t to [mips] Improve genConstMult() so it works with arbitrary precision.
mstojanovic edited the summary of this revision. (Show Details)

Added arbitrary precision in genConstMult().

sdardis accepted this revision.Oct 4 2017, 10:43 AM

LGTM with inline nit addressed.

test/CodeGen/Mips/const-mult.ll
66 ↗(On Diff #116799)

Add a test case with a large positive constant.

This revision is now accepted and ready to land.Oct 4 2017, 10:43 AM

Added large positive number test case.

This revision was automatically updated to reflect the committed changes.