[PATCH] D97811: [GlobalISel] Handle non-multiples of the base type in narrowScalarAddSub

Justin Bogner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 26 10:54:05 PDT 2021


bogner marked 2 inline comments as done.
bogner added inline comments.


================
Comment at: llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp:4512
+  extractParts(Src1, RegTy, NarrowTy, LeftoverTy, Src1Regs, Src1Left);
+  extractParts(Src2, RegTy, NarrowTy, DummyTy, Src2Regs, Src2Left);
 
----------------
arsenm wrote:
> Also I still want to kill G_EXTRACT usage
I agree in principle but I think it's probably best to do that systematically since it applies to so much of LegalizerHelper right now.


================
Comment at: llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp:4523
+    Register DstReg =
+        MRI.createGenericVirtualRegister(MRI.getType(Src1Regs[i]));
     Register CarryOut = MRI.createGenericVirtualRegister(LLT::scalar(1));
----------------
arsenm wrote:
> Why do you need to getType here? It should be the same as NarrowTy?
Not necessarily for the last register - since we appended Src1Left/Src2Left to the source registers the last register can be smaller


================
Comment at: llvm/test/CodeGen/AArch64/GlobalISel/legalize-add.mir:110
+    %7:_(s96) = G_TRUNC %5(s128)
+    %8:_(s96) = G_ADD %6, %7
+    %9:_(s128) = G_ANYEXT %8(s96)
----------------
arsenm wrote:
> Should also add cases that aren't a nice multiple of the target size like s33
Went with s65 since s33 will just be widened on aarch64 instead


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97811/new/

https://reviews.llvm.org/D97811



More information about the llvm-commits mailing list