[llvm] [GlobalISel] Combine (X >> C) << C to X & ((-1 >> C) << C) (PR #114821)

Thorsten Schütt via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 5 06:29:55 PST 2024


================
@@ -365,6 +365,13 @@ def bitreverse_lshr : GICombineRule<
                                                     MRI.getType(${amt}.getReg())}}); }]),
   (apply (G_SHL $d, $val, $amt))>;
 
+def lsb_bits_clearing_by_shifts_to_and: GICombineRule<
+  (defs root:$root, build_fn_matchinfo:$matchinfo),
+  (match (G_LSHR $d, $src, $amt1),
+         (G_SHL $root, $d, $amt2):$root,
----------------
tschuett wrote:

You can put G_CONSTANTs on `amt1` and `amt2`. There are examples in Combine.td.

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


More information about the llvm-commits mailing list