[llvm-branch-commits] [llvm] [LoongArch] Load suitable immediates with LU12I.W+SLLI.D (PR #242357)
Rong Mantle Bao via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Sat Nov 14 00:49:23 PST 2026
================
@@ -412,8 +420,20 @@ bool LoongArchMergeBaseOffsetOpt::foldLargeOffset(
MachineOperand ImmOp = Curr->getOperand(2);
if (ImmOp.getTargetFlags() != LoongArchII::MO_None || !Hi12)
return false;
- Offset += ImmOp.getImm() << 52;
- Mask &= ~0xFFF0000000000000ULL;
+ const int64_t Imm = ImmOp.getImm();
+ Offset += (static_cast<uint64_t>(Imm) << 52) << Shift;
+ Mask &= ~(0xFFF0000000000000ULL << Shift);
+ Reg = Curr->getOperand(1).getReg();
+ Instrs.push_back(Curr);
+ break;
+ }
+ case LoongArch::SLLI_D: {
----------------
CSharperMantle wrote:
Should be addressed by now. The codegen should be identical to baseline without the folding budget increase.
https://github.com/llvm/llvm-project/pull/242357
More information about the llvm-branch-commits
mailing list