[PATCH] D82262: [RISCV] Optimize addition with an immediate

Ben Shi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 20 10:02:28 PDT 2020


benshi001 added a comment.

for (add i32 %a, 4094), it can be simplfied to
addi a0, a0, 2047
addi a0, a0, 2047.

The original assembly is
lui a1, 1
addi a1, a1, -2
add a0, a0, a1

However, this optimization can only be performed if the value generated by lui-addi has no other use.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82262





More information about the llvm-commits mailing list