blob: 1e5f9bd54201da88485af37f999cb92be43edafb [file] [log] [blame]
Viet-Hoa Doe1c3b462023-07-31 17:13:34 +01001/*
2* Copyright (c) 2023 Arm Limited.
3*
4* SPDX-License-Identifier: MIT
5*
6* Permission is hereby granted, free of charge, to any person obtaining a copy
7* of this software and associated documentation files (the "Software"), to
8* deal in the Software without restriction, including without limitation the
9* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10* sell copies of the Software, and to permit persons to whom the Software is
11* furnished to do so, subject to the following conditions:
12*
13* The above copyright notice and this permission notice shall be included in all
14* copies or substantial portions of the Software.
15*
16* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22* SOFTWARE.
23*/
24
25#ifndef CKW_INCLUDE_CKW_TYPES_OPERATORS_H
26#define CKW_INCLUDE_CKW_TYPES_OPERATORS_H
27
28#include <cstdint>
29
30namespace ckw
31{
32
33/** Unary operators and functions. */
34enum class UnaryOp : int32_t
35{
36 LogicalNot = 0x0000, // !
37 BitwiseNot = 0x0001, // ~
38
39 Exp = 0x0010,
40 Tanh = 0x0011,
41 Sqrt = 0x0012,
42 Erf = 0x0013,
43 Fabs = 0x0014,
44 Log = 0x0015,
45 Round = 0x0016,
46};
47
48/** Assignment operators. */
49enum class AssignmentOp : int32_t
50{
51 Increment = 0x0000, // +=
52 Decrement = 0x0001, // -=
53};
54
Viet-Hoa Do34b6c3a2023-08-22 11:11:23 +010055/** Binary operators. */
56enum class BinaryOp : int32_t
57{
58 // Elementwise
59 Add = 0x0000, // +
60 Sub = 0x0001, // -
61 Mul = 0x0002, // *
62 Div = 0x0003, // /
63 Mod = 0x0004, // %
64
65 // Relational
66 Equal = 0x1000, // ==
67 Less = 0x1001, // <
68 LessEqual = 0x1002, // <=
69 Greater = 0x1003, // >
70 GreaterEqual = 0x1004, // >=
71
72 // Algebra
73 MatMul_Nt_Nt = 0x2000, // X
74 MatMul_Nt_T = 0x2001, // X
75 MatMul_T_Nt = 0x2002, // X
76 MatMul_T_T = 0x2003, // X
77 Dot = 0x2004, // .
78
79 // Logical
80 LogicalAnd = 0x3000, // &&
81 LogicalOr = 0x3001, // ||
82
83 // Bitwise
84 BitwiseXOR = 0x4000, // ^
85
86 // Functions
87 Min = 0x8000,
88 Max = 0x8001,
89};
90
91/** Ternary operators. */
92enum class TernaryOp : int32_t
93{
94 Select = 0x0000,
95 Clamp = 0x0001,
96};
97
Viet-Hoa Doe1c3b462023-07-31 17:13:34 +010098} // namespace ckw
99
100#endif // CKW_INCLUDE_CKW_TYPES_OPERATORS_H