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