[llvm] [AMDGPU] Canonicalize G_ZEXT of the shift amount in RegBankCombiner (PR #131792)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue May 13 03:14:01 PDT 2025


================
@@ -134,6 +134,22 @@ def combine_fmul_with_select_to_fldexp : GICombineRule<
           [{ return Helper.matchCombineFmulWithSelectToFldexp(*${root}, *${sel}, ${matchinfo}); }]),
   (apply  [{ Helper.applyBuildFn(*${root}, ${matchinfo}); }])>;
 
+// (shift x, (zext amt)) -> (shift x, (and (anyext amt), mask)
+//
+// The pattern is longer, but is better for matching during ISel.
----------------
arsenm wrote:

At worst you should only need to add more explicit types to the patterns. The shift amount has a general register that supports many types 

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


More information about the llvm-commits mailing list