[llvm] [RISCV] Add a MIR pass to reassociate shXadd, add, and slli to form more shXadd. (PR #87544)

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 4 14:08:24 PDT 2024


================
@@ -0,0 +1,166 @@
+//===- RISCVOptZba.cpp - MI Zba instruction optimizations -----------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===---------------------------------------------------------------------===//
+//
+// This pass attempts to reassociate expressions like
+//   (sh3add Z, (add X, (slli Y, 6)))
+// To
+//   (sh3add (sh3add Y, Z), X)
+//
+// This reduces number of instructions needing by spreading the shift amount
+// across to 2 sh3adds. This can be generalized to sh1add/sh2add and other
----------------
preames wrote:

The second part of this comment looks stale?

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


More information about the llvm-commits mailing list