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 
19 using namespace mlir;
20 
21 #include "mlir/Dialect/X86Vector/X86VectorDialect.cpp.inc"
22 
23 void x86vector::X86VectorDialect::initialize() {
24   addOperations<
25 #define GET_OP_LIST
26 #include "mlir/Dialect/X86Vector/X86Vector.cpp.inc"
27       >();
28 }
29 
30 static LogicalResult verify(x86vector::MaskCompressOp op) {
31   if (op.src() && op.constant_src())
32     return emitError(op.getLoc(), "cannot use both src and constant_src");
33 
34   if (op.src() && (op.src().getType() != op.dst().getType()))
35     return emitError(op.getLoc(),
36                      "failed to verify that src and dst have same type");
37 
38   if (op.constant_src() && (op.constant_src()->getType() != op.dst().getType()))
39     return emitError(
40         op.getLoc(),
41         "failed to verify that constant_src and dst have same type");
42 
43   return success();
44 }
45 
46 #define GET_OP_CLASSES
47 #include "mlir/Dialect/X86Vector/X86Vector.cpp.inc"
48