[llvm-branch-commits] [llvm] AMDGPU/GlobalISel: RegBankLegalize rules for load (PR #112882)

Nicolai Hähnle via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Nov 28 07:32:23 PST 2024


================
@@ -116,6 +193,50 @@ void RegBankLegalizeHelper::lower(MachineInstr &MI,
     MI.eraseFromParent();
     break;
   }
+  case SplitLoad: {
+    LLT DstTy = MRI.getType(MI.getOperand(0).getReg());
+    unsigned Size = DstTy.getSizeInBits();
+    // Even split to 128-bit loads
+    if (Size > 128) {
+      LLT B128;
+      if (DstTy.isVector()) {
+        LLT EltTy = DstTy.getElementType();
+        B128 = LLT::fixed_vector(128 / EltTy.getSizeInBits(), EltTy);
+      } else {
+        B128 = LLT::scalar(128);
+      }
+      if (Size / 128 == 2)
+        splitLoad(MI, {B128, B128});
+      if (Size / 128 == 4)
+        splitLoad(MI, {B128, B128, B128, B128});
----------------
nhaehnle wrote:

I would expect this to be an else-if chain with an `else llvm_unreachable` at the end.

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


More information about the llvm-branch-commits mailing list