================
@@ -487,6 +487,37 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
     return createAddrSpaceCast(src.getLoc(), src, newTy);
   }
 
+  
//===--------------------------------------------------------------------===//
+  // Other Instructions
+  
//===--------------------------------------------------------------------===//
+
+  mlir::Value createExtractElement(mlir::Location loc, mlir::Value vec,
+                                   mlir::Value idx) {
+    auto vecTy = mlir::cast<cir::VectorType>(vec.getType());
+    mlir::Type eltTy = vecTy.getElementType();
+    return cir::VecExtractOp::create(*this, loc, eltTy, vec, idx);
+  }
+
+  mlir::Value createExtractElement(mlir::Location loc, mlir::Value vec,
+                                   uint64_t idx) {
+    mlir::Value idxVal =
+        getConstAPInt(loc, getUIntNTy(64), llvm::APInt(64, idx));
+    return createExtractElement(loc, vec, idxVal);
----------------
Priyanshu3820 wrote:

Yes it works. LLVM's IRbuilder calls through the helper which is why i did it 
too. Your suggestion looks better so i am applying it.

https://github.com/llvm/llvm-project/pull/174003
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to