[llvm] [GIsel][AArch64] Legalize <2 x i16> for G_INSERT_VECTOR_ELT (PR #65830)

Amara Emerson via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 10 08:11:11 PDT 2023


================
@@ -718,8 +718,9 @@ AArch64LegalizerInfo::AArch64LegalizerInfo(const AArch64Subtarget &ST)
 
   getActionDefinitionsBuilder(G_INSERT_VECTOR_ELT)
       .legalIf(typeInSet(0, {v16s8, v8s8, v8s16, v4s16, v4s32, v2s32, v2s64}))
-      .clampMinNumElements(0, s16, 4)
-      .clampMaxNumElements(0, s16, 8);
+      .minScalarOrEltIf(
+          [=](const LegalityQuery &Query) { return Query.Types[0] == v2s16; },
+          0, s32);
----------------
aemerson wrote:

Why do you need to add handling for the destination type in LegalizerHelper? Can't you just pass 1 as the type index here?

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


More information about the llvm-commits mailing list