[llvm] [AArch64] Optimization of repeated constant loads (#51483) (PR #86249)

David Green via llvm-commits llvm-commits at lists.llvm.org
Fri May 17 07:38:43 PDT 2024


================
@@ -518,6 +518,14 @@ static inline void expandMOVImmSimple(uint64_t Imm, unsigned BitSize,
     Insn.push_back({ Opc, Imm16,
                      AArch64_AM::getShifterImm(AArch64_AM::LSL, Shift) });
   }
+
+  // Now, we get 16-bit divided Imm. If high and low bits are same in
+  // 32-bit, there is an opportunity to reduce instruction.
+  if (Insn.size() > 2 && (Imm >> 32) == (Imm & UINT_MAX)) {
----------------
davemgreen wrote:

I would use 0xffffffff instead of UINT_MAX. They are likely always the same value, but the ff's is more explicit about the size.

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


More information about the llvm-commits mailing list