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/TypeUtilities.h"
18
19using namespace mlir;
20using namespace mlir::arm_sve;
21
22//===----------------------------------------------------------------------===//
23// ScalableVector versions of general helpers for comparison ops
24//===----------------------------------------------------------------------===//
25
26/// Return the scalable vector of the same shape and containing i1.
27static Type getI1SameShape(Type type) {
28 auto i1Type = IntegerType::get(context: type.getContext(), width: 1);
29 if (auto sVectorType = llvm::dyn_cast<VectorType>(Val&: type))
30 return VectorType::get(shape: sVectorType.getShape(), elementType: i1Type,
31 scalableDims: sVectorType.getScalableDims());
32 return nullptr;
33}
34
35//===----------------------------------------------------------------------===//
36// Tablegen Definitions
37//===----------------------------------------------------------------------===//
38
39#include "mlir/Dialect/ArmSVE/IR/ArmSVEDialect.cpp.inc"
40
41#define GET_OP_CLASSES
42#include "mlir/Dialect/ArmSVE/IR/ArmSVE.cpp.inc"
43
44#define GET_TYPEDEF_CLASSES
45#include "mlir/Dialect/ArmSVE/IR/ArmSVETypes.cpp.inc"
46
47void ArmSVEDialect::initialize() {
48 addOperations<
49#define GET_OP_LIST
50#include "mlir/Dialect/ArmSVE/IR/ArmSVE.cpp.inc"
51 >();
52}
53

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