[llvm] [GlobalISel] Add multi-way splitting support for wide scalar shifts. (PR #155353)

David Green via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 27 00:53:07 PDT 2025


================
@@ -5992,6 +5992,27 @@ LegalizerHelper::narrowScalarShift(MachineInstr &MI, unsigned TypeIdx,
   if (DstEltSize % 2 != 0)
     return UnableToLegalize;
 
+  // Check if we should use multi-way splitting instead of recursive binary
+  // splitting.
+  //
+  // Multi-way splitting directly decomposes wide shifts (e.g., 128-bit ->
+  // 4×32-bit) in a single legalization step, avoiding the recursive overhead
+  // and dependency chains created by usual binary splitting approach
+  // (128->64->32).
+  //
+  // The >= 4 parts threshold ensures we only use this optimization when binary
----------------
davemgreen wrote:

Has this changed to >= 8?

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


More information about the llvm-commits mailing list