[PATCH] D111532: [RISCV] Optimize immediate materialisation with BCLRI
Ben Shi via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 11 07:18:17 PDT 2021
benshi001 marked an inline comment as done.
benshi001 added inline comments.
================
Comment at: llvm/lib/Target/RISCV/MCTargetDesc/RISCVMatInt.cpp:191
+ "Expected RV32 to only need 2 instructions");
+ int64_t NewVal = Val + 0x80000000;
+ if (NewVal < 0 && isInt<32>(NewVal)) {
----------------
craig.topper wrote:
> Can this be Val | 0x80000000? That makes more sense to me since BCLRI only affects 1 bit.
If we change to `Val | 0x80000000` instead of `Val + 0x80000000`,
we still need not to check `NewVal != Val`, and checking `NewVal < 0 && isInt<32>(NewVal)` is enough.
Since Val is not int32 while NewVal is.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D111532/new/
https://reviews.llvm.org/D111532
More information about the llvm-commits
mailing list