forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVectorInterfaces.cpp
31 lines (26 loc) · 1.21 KB
/
VectorInterfaces.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
//===- VectorInterfaces.cpp - Unrollable vector operations -*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "mlir/Interfaces/VectorInterfaces.h"
using namespace mlir;
VectorType mlir::vector::detail::transferMaskType(VectorType vecType,
AffineMap map) {
auto i1Type = IntegerType::get(map.getContext(), 1);
SmallVector<int64_t, 8> shape;
for (int64_t i = 0; i < vecType.getRank(); ++i) {
// Only result dims have a corresponding dim in the mask.
if (map.getResult(i).template isa<AffineDimExpr>()) {
shape.push_back(vecType.getDimSize(i));
}
}
return VectorType::get(shape, i1Type);
}
//===----------------------------------------------------------------------===//
// VectorUnroll Interfaces
//===----------------------------------------------------------------------===//
/// Include the definitions of the VectorUnroll interfaces.
#include "mlir/Interfaces/VectorInterfaces.cpp.inc"