Simplify "LUI+SLLI+ADDI+SLLI" and "LUI+ADDIW+SLLI+ADDI+SLLI" to
"LUI+ADDIW+SLLIUW" to reduce total instruction amount.
Paths
| Differential D111933
[RISCV] Optimize immediate materialisation with SLLI.UW ClosedPublic Authored by benshi001 on Oct 16 2021, 3:14 AM.
Details Summary Simplify "LUI+SLLI+ADDI+SLLI" and "LUI+ADDIW+SLLI+ADDI+SLLI" to "LUI+ADDIW+SLLIUW" to reduce total instruction amount.
Diff Detail
Event TimelineHerald added subscribers: achieveartificialintelligence, vkmr, frasercrmck and 24 others. · View Herald TranscriptOct 16 2021, 3:14 AM benshi001 added a parent revision: D111932: [RISCV][test] Add more tests of immediate materialisation. Comment Actions Your description is not accurate. You’re not replacing LUI+ADDI+SLLI. You’re replacing LUI+SLLI+ADDI+SLLI. Comment Actions
I should add more tests, sometimes my patch can reduce two instructions, for example long ass() { return 0xbbbbb111777; } The original instructions are lui a0, 188 addiw a0, a0, -1093 slli a0, a0, 12 addi a0, a0, 273 slli a0, a0, 12 addi a0, a0, 1911 ret which can be optimized by my patch to lui a0, 768955 addiw a0, a0, 273 slli.uw a0, a0, 12 addi a0, a0, 1911 ret Comment Actions
So how about change the description to "Use LUI+ADDI+SLLI.UW to reduce multiple SLLI+ADDI pairs" ? Comment Actions ping ... This would be the last patch of immediate materialisation optimization with the B extension. Can it be merged? This revision is now accepted and ready to land.Oct 26 2021, 7:22 PM Closed by commit rG97e52e1c3588: [RISCV] Optimize immediate materialisation with SLLI.UW in the Zba extension (authored by benshi001). · Explain WhyOct 26 2021, 7:53 PM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 382509 llvm/lib/Target/RISCV/MCTargetDesc/RISCVMatInt.cpp
llvm/test/CodeGen/RISCV/imm.ll
llvm/test/MC/RISCV/rv64zba-aliases-valid.s
|