[Mlir-commits] [llvm] [mlir] [mlir][x86vector] Simplify intrinsic generation (PR #133692)

Andrzej WarzyƄski llvmlistbot at llvm.org
Tue Apr 8 09:25:40 PDT 2025


================
@@ -91,21 +72,14 @@ def MaskCompressOp : AVX512_Op<"mask.compress", [Pure,
   let assemblyFormat = "$k `,` $a (`,` $src^)? attr-dict"
                        " `:` type($dst) (`,` type($src)^)?";
   let hasVerifier = 1;
-}
 
-def MaskCompressIntrOp : AVX512_IntrOverloadedOp<"mask.compress", [
-  Pure,
-  AllTypesMatch<["a", "src", "res"]>,
-  TypesMatchWith<"`k` has the same number of bits as elements in `res`",
-                 "res", "k",
-                 "VectorType::get({::llvm::cast<VectorType>($_self).getShape()[0]}, "
-                 "IntegerType::get($_self.getContext(), 1))">]> {
-  let arguments = (ins VectorOfLengthAndType<[16, 8],
-                                             [F32, I32, F64, I64]>:$a,
-                   VectorOfLengthAndType<[16, 8],
-                                         [F32, I32, F64, I64]>:$src,
-                   VectorOfLengthAndType<[16, 8],
-                                         [I1]>:$k);
+  let extraClassDeclaration = [{
+    /// Return LLVM intrinsic function name matching op variant.
+    std::string getIntrinsicName() {
+      // Overload is resolved later by intrisic call lowering.
----------------
banach-space wrote:

I guess this is the only one that's overloaded? I am wondering specifically about the comment.

Also, given that many ops implement this, why not introduce an interface? That would simplify `CallIntrinsic` a bit (no need to make it a template).

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


More information about the Mlir-commits mailing list