xref: /llvm-project/mlir/lib/Dialect/X86Vector/IR/X86VectorDialect.cpp (revision 8df54a6a03a6d07e3053eff9806b450ec9193772)
1 //===- X86VectorDialect.cpp - MLIR X86Vector ops implementation -----------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file implements the X86Vector dialect and its operations.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #include "mlir/Dialect/X86Vector/X86VectorDialect.h"
14 #include "mlir/Dialect/LLVMIR/LLVMTypes.h"
15 #include "mlir/IR/Builders.h"
16 #include "mlir/IR/OpImplementation.h"
17 #include "mlir/IR/TypeUtilities.h"
18 #include "mlir/Interfaces/InferTypeOpInterface.h"
19 
20 using namespace mlir;
21 
22 #include "mlir/Dialect/X86Vector/X86VectorDialect.cpp.inc"
23 
initialize()24 void x86vector::X86VectorDialect::initialize() {
25   addOperations<
26 #define GET_OP_LIST
27 #include "mlir/Dialect/X86Vector/X86Vector.cpp.inc"
28       >();
29 }
30 
verify()31 LogicalResult x86vector::MaskCompressOp::verify() {
32   if (getSrc() && getConstantSrc())
33     return emitError("cannot use both src and constant_src");
34 
35   if (getSrc() && (getSrc().getType() != getDst().getType()))
36     return emitError("failed to verify that src and dst have same type");
37 
38   if (getConstantSrc() && (getConstantSrc()->getType() != getDst().getType()))
39     return emitError(
40         "failed to verify that constant_src and dst have same type");
41 
42   return success();
43 }
44 
45 #define GET_OP_CLASSES
46 #include "mlir/Dialect/X86Vector/X86Vector.cpp.inc"
47