This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Optimize mul in the zba extension with SH*ADD
AbandonedPublic

Authored by benshi001 on Aug 10 2021, 5:25 AM.

Details

Summary

This patch does the following optimization of mul with a constant in RV64.

(sext_inreg (mul x, 3 * power_of_2), i32) -> (SLLIW (SH1ADD x, x), bits)
(sext_inreg (mul x, 5 * power_of_2), i32) -> (SLLIW (SH2ADD x, x), bits)
(sext_inreg (mul x, 9 * power_of_2), i32) -> (SLLIW (SH3ADD x, x), bits)

Diff Detail

Event Timeline

benshi001 created this revision.Aug 10 2021, 5:25 AM
benshi001 requested review of this revision.Aug 10 2021, 5:25 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 10 2021, 5:25 AM
benshi001 updated this revision to Diff 365453.Aug 10 2021, 5:57 AM

If D107708 is accepted this will no longer be necessary.

If D107708 is accepted this will no longer be necessary.

That is great. And I still suggest D107817 be merged, since we have not checked optimization of SHXADD with i32 type in rv64.

benshi001 abandoned this revision.Aug 10 2021, 6:34 PM