1//===- ArmSVEDialect.cpp - MLIR ArmSVE dialect 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 ArmSVE dialect and its operations.
10//
11//===----------------------------------------------------------------------===//
12
13#include "mlir/Dialect/ArmSVE/IR/ArmSVEDialect.h"
14#include "mlir/Dialect/LLVMIR/LLVMTypes.h"
15#include "mlir/Dialect/Vector/IR/VectorOps.h"
16#include "mlir/IR/Builders.h"
17#include "mlir/IR/DialectImplementation.h"
18#include "mlir/IR/OpImplementation.h"
19#include "mlir/IR/TypeUtilities.h"
20#include "llvm/ADT/TypeSwitch.h"
21
22using namespace mlir;
23using namespace mlir::arm_sve;
24
25//===----------------------------------------------------------------------===//
26// ScalableVector versions of general helpers for comparison ops
27//===----------------------------------------------------------------------===//
28
29/// Return the scalable vector of the same shape and containing i1.
30static Type getI1SameShape(Type type) {
31 auto i1Type = IntegerType::get(type.getContext(), 1);
32 if (auto sVectorType = llvm::dyn_cast<VectorType>(type))
33 return VectorType::get(sVectorType.getShape(), i1Type,
34 sVectorType.getScalableDims());
35 return nullptr;
36}
37
38//===----------------------------------------------------------------------===//
39// Tablegen Definitions
40//===----------------------------------------------------------------------===//
41
42#include "mlir/Dialect/ArmSVE/IR/ArmSVEDialect.cpp.inc"
43
44#define GET_OP_CLASSES
45#include "mlir/Dialect/ArmSVE/IR/ArmSVE.cpp.inc"
46
47#define GET_TYPEDEF_CLASSES
48#include "mlir/Dialect/ArmSVE/IR/ArmSVETypes.cpp.inc"
49
50void ArmSVEDialect::initialize() {
51 addOperations<
52#define GET_OP_LIST
53#include "mlir/Dialect/ArmSVE/IR/ArmSVE.cpp.inc"
54 >();
55}
56

source code of mlir/lib/Dialect/ArmSVE/IR/ArmSVEDialect.cpp