[llvm] [RISCV] Improve constant materialization by using a sequence that end… (PR #66943)
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 26 09:25:00 PDT 2023
================
@@ -206,10 +206,25 @@ InstSeq generateInstSeq(int64_t Val, const FeatureBitset &ActiveFeatures) {
assert(ActiveFeatures[RISCV::Feature64Bit] &&
"Expected RV32 to only need 2 instructions");
+ // If the lower 13 bits are something like 0x17ff, try to turn it into 0x1800
+ // and use a final addi to correct it back to 0x17ff. This will create a
+ // sequence ending in 2 addis.
+ if ((Val & 0xfff) != 0 && (Val & 0x1800) == 0x1000) {
----------------
preames wrote:
Ah, okay. That finally makes sense.
https://github.com/llvm/llvm-project/pull/66943
More information about the llvm-commits
mailing list