[PATCH] D111933: [RISCV] Optimize immediate materialisation with SLLI.UW

Ben Shi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 16 09:26:41 PDT 2021


benshi001 added a comment.

In D111933#3068373 <https://reviews.llvm.org/D111933#3068373>, @craig.topper wrote:

> Your description is not accurate. You’re not replacing LUI+ADDI+SLLI. You’re replacing LUI+SLLI+ADDI+SLLI.

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


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D111933/new/

https://reviews.llvm.org/D111933



More information about the llvm-commits mailing list