18508a63bSEmilio Cota //===- X86VectorDialect.cpp - MLIR X86Vector ops implementation -----------===//
28508a63bSEmilio Cota //
38508a63bSEmilio Cota // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
48508a63bSEmilio Cota // See https://llvm.org/LICENSE.txt for license information.
58508a63bSEmilio Cota // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
68508a63bSEmilio Cota //
78508a63bSEmilio Cota //===----------------------------------------------------------------------===//
88508a63bSEmilio Cota //
98508a63bSEmilio Cota // This file implements the X86Vector dialect and its operations.
108508a63bSEmilio Cota //
118508a63bSEmilio Cota //===----------------------------------------------------------------------===//
128508a63bSEmilio Cota 
138508a63bSEmilio Cota #include "mlir/Dialect/X86Vector/X86VectorDialect.h"
148508a63bSEmilio Cota #include "mlir/Dialect/LLVMIR/LLVMTypes.h"
158508a63bSEmilio Cota #include "mlir/IR/Builders.h"
168508a63bSEmilio Cota #include "mlir/IR/OpImplementation.h"
178508a63bSEmilio Cota #include "mlir/IR/TypeUtilities.h"
186f9cceb7SJacques Pienaar #include "mlir/Interfaces/InferTypeOpInterface.h"
198508a63bSEmilio Cota 
208508a63bSEmilio Cota using namespace mlir;
218508a63bSEmilio Cota 
22485cc55eSStella Laurenzo #include "mlir/Dialect/X86Vector/X86VectorDialect.cpp.inc"
23485cc55eSStella Laurenzo 
initialize()248508a63bSEmilio Cota void x86vector::X86VectorDialect::initialize() {
258508a63bSEmilio Cota   addOperations<
268508a63bSEmilio Cota #define GET_OP_LIST
278508a63bSEmilio Cota #include "mlir/Dialect/X86Vector/X86Vector.cpp.inc"
288508a63bSEmilio Cota       >();
298508a63bSEmilio Cota }
308508a63bSEmilio Cota 
verify()3138abdddfSRiver Riddle LogicalResult x86vector::MaskCompressOp::verify() {
32*8df54a6aSJacques Pienaar   if (getSrc() && getConstantSrc())
3338abdddfSRiver Riddle     return emitError("cannot use both src and constant_src");
348508a63bSEmilio Cota 
35*8df54a6aSJacques Pienaar   if (getSrc() && (getSrc().getType() != getDst().getType()))
3638abdddfSRiver Riddle     return emitError("failed to verify that src and dst have same type");
378508a63bSEmilio Cota 
38*8df54a6aSJacques Pienaar   if (getConstantSrc() && (getConstantSrc()->getType() != getDst().getType()))
398508a63bSEmilio Cota     return emitError(
408508a63bSEmilio Cota         "failed to verify that constant_src and dst have same type");
418508a63bSEmilio Cota 
428508a63bSEmilio Cota   return success();
438508a63bSEmilio Cota }
448508a63bSEmilio Cota 
458508a63bSEmilio Cota #define GET_OP_CLASSES
468508a63bSEmilio Cota #include "mlir/Dialect/X86Vector/X86Vector.cpp.inc"
47