/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/include/llvm/Support/ScalableSize.h
Line | Count | Source |
1 | | //===- ScalableSize.h - Scalable vector size info ---------------*- C++ -*-===// |
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 provides a struct that can be used to query the size of IR types |
10 | | // which may be scalable vectors. It provides convenience operators so that |
11 | | // it can be used in much the same way as a single scalar value. |
12 | | // |
13 | | //===----------------------------------------------------------------------===// |
14 | | |
15 | | #ifndef LLVM_SUPPORT_SCALABLESIZE_H |
16 | | #define LLVM_SUPPORT_SCALABLESIZE_H |
17 | | |
18 | | namespace llvm { |
19 | | |
20 | | class ElementCount { |
21 | | public: |
22 | | unsigned Min; // Minimum number of vector elements. |
23 | | bool Scalable; // If true, NumElements is a multiple of 'Min' determined |
24 | | // at runtime rather than compile time. |
25 | | |
26 | | ElementCount(unsigned Min, bool Scalable) |
27 | 27.5M | : Min(Min), Scalable(Scalable) {} |
28 | | |
29 | | ElementCount operator*(unsigned RHS) { |
30 | | return { Min * RHS, Scalable }; |
31 | | } |
32 | 4 | ElementCount operator/(unsigned RHS) { |
33 | 4 | return { Min / RHS, Scalable }; |
34 | 4 | } |
35 | | |
36 | 10.0M | bool operator==(const ElementCount& RHS) const { |
37 | 10.0M | return Min == RHS.Min && Scalable == RHS.Scalable9.94M ; |
38 | 10.0M | } |
39 | | }; |
40 | | |
41 | | } // end namespace llvm |
42 | | |
43 | | #endif // LLVM_SUPPORT_SCALABLESIZE_H |