[llvm] [MacroFusion] Support commutable instructions (PR #82751)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 6 05:17:02 PST 2024


================
@@ -91,3 +91,24 @@ def TuneLDADDFusion
                    CheckIsImmOperand<2>,
                    CheckImmOperand<2, 0>
                  ]>>;
+
+// These should be covered by Zba extension.
+// * shift left by one and add:
+//   slli r1, r0, 1
+//   add r1, r1, r2
+// * shift left by two and add:
+//   slli r1, r0, 2
+//   add r1, r1, r2
+// * shift left by three and add:
+//   slli r1, r0, 3
+//   add r1, r1, r2
+def ShiftNAddFusion
+  : SimpleFusion<"shift-n-add-fusion", "HasShiftNAddFusion",
+                 "Enable SLLI+ADD to be fused to shift left by 1/2/3 and add",
+                 CheckAll<[
+                   CheckOpcode<[SLLI]>,
+                   CheckAny<[CheckImmOperand<2, 1>,
+                             CheckImmOperand<2, 2>,
+                             CheckImmOperand<2, 3>]>
----------------
arsenm wrote:

To be clear, this isn't listing out the different commuted indices lists? 

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


More information about the llvm-commits mailing list