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

Adam Siemieniuk via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 9 08:08:53 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.
----------------
adam-smnk wrote:

Yes, it is the only overloaded intrinsic. I just wanted to highlight that this doesn't require manual mangling but is handled by `llvm.call_intrinsic`.

Reworded the comment - hopefully now it's clearer.

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


More information about the llvm-commits mailing list