[llvm] [GlobalISel] Import extract/insert subvector (PR #110287)

Thorsten Schütt via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 28 12:25:24 PDT 2024


================
@@ -2588,6 +2588,20 @@ bool IRTranslator::translateKnownIntrinsic(const CallInst &CI, Intrinsic::ID ID,
                          getOrCreateVReg(*CI.getOperand(0)),
                          getOrCreateVReg(*CI.getOperand(1)));
     return true;
+  case Intrinsic::vector_extract: {
+    ConstantInt *Index = cast<ConstantInt>(CI.getOperand(1));
+    MIRBuilder.buildExtractSubvector(getOrCreateVReg(CI),
+                                     getOrCreateVReg(*CI.getOperand(0)),
+                                     Index->getZExtValue());
+    return true;
+  }
+  case Intrinsic::vector_insert: {
----------------
tschuett wrote:

`G_INSERT_SUBVECTOR` takes two vectors and an index and returns a vector. The second argument is inserted into the first argument. If the second vector would be a `<1 x Ty> vector`, we would still need to do a `G_INSERT_VECTOR_ELT`.

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


More information about the llvm-commits mailing list