[llvm] [RISCV] Exploit sh3add/sh2add for stack offsets by shifted 12-bit constants (PR #87950)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 8 14:37:38 PDT 2024


================
@@ -239,6 +239,32 @@ void RISCVRegisterInfo::adjustReg(MachineBasicBlock &MBB,
     return;
   }
 
+  // Use shNadd if doing so lets us materialize a 12 bit immediate with a single
+  // instruction.  This saves 1 instruction over the full lui/addi+add fallback
+  // path.  We avoid anything which can be done with a single lui as it night
----------------
topperc wrote:

night -> might

https://github.com/llvm/llvm-project/pull/87950


More information about the llvm-commits mailing list