This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Optimize some mul operation using SH*ADDUW instruction
AbandonedPublic

Authored by Jimerlife on Jan 9 2022, 11:19 PM.

Details

Summary

I saw this patch (https://reviews.llvm.org/D105796) optimize some mul operation with SH*ADD instruction.
so, I think this maybe also apply to SH*ADDUW.

value = rs1 & 0xFFFFFFFF
(mul value, 3 * power_of_2) -> (SLLI (SH1ADDUW value, value), bits)
(mul value, 5 * power_of_2) -> (SLLI (SH2ADDUW value, value), bits)
(mul value, 9 * power_of_2) -> (SLLI (SH3ADDUW value, value), bits)

Diff Detail