[llvm] [GISel] Funnel shift combiner port from SelectionDAG ISel to GlobalISel (PR #135132)

Axel Sorenson via llvm-commits llvm-commits at lists.llvm.org
Sat May 10 04:39:53 PDT 2025


================
@@ -1034,20 +1034,26 @@ def funnel_shift_overshift: GICombineRule<
 >;
 
 // Transform: fshl x, z, y | shl x, y -> fshl x, z, y
+// Transform: shl x, y | fshl x, z, y  -> fshl x, z, y
+def funnel_shift_or_shift_to_funnel_shift_left_frags : GICombinePatFrag<
+  (outs root: $dst, $out1, $out2), (ins),
+  !foreach(inst, [(G_OR $dst, $out1, $out2), (G_OR $dst, $out2, $out1)], 
+           (pattern (G_FSHL $out1, $x, $z, $y), (G_SHL $out2, $x, $y), inst))>;
 def funnel_shift_or_shift_to_funnel_shift_left: GICombineRule<
   (defs root:$root), 
-  (match (G_FSHL $out1, $x, $z, $y),
-         (G_SHL $out2, $x, $y),
-         (G_OR $root, $out1, $out2)),
+  (match (funnel_shift_or_shift_to_funnel_shift_left_frags $root, $out1, $out2)),
   (apply (GIReplaceReg $root, $out1))
 >;
----------------
axelcool1234 wrote:

@davemgreen You pointed out the fact the AArch test wasn't triggering (thanks, by the way). Do you think this is an appropriate fix for this? 

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


More information about the llvm-commits mailing list