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