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