Line data Source code
1 : /**
2 : * Copyright (c) 2025 Huawei Technologies Co., Ltd.
3 : * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
4 : * CANN Open Software License Agreement Version 2.0 (the "License").
5 : * Please refer to the License for details. You may not use this file except in compliance with the License.
6 : * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
7 : * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
8 : * See LICENSE in the root of the software repository for the full text of the License.
9 : */
10 :
11 : #include "ccu_operator.h"
12 : #include "ccu_datatype.h"
13 :
14 : namespace Hccl {
15 : namespace CcuRep {
16 :
17 1 : template <> void CcuArithmeticOperator<Variable, Variable>::Check() const
18 : {
19 : // nothing
20 1 : }
21 8 : template <> void CcuArithmeticOperator<Variable, Address>::Check() const
22 : {
23 : // nothing
24 8 : }
25 1 : template <> void CcuArithmeticOperator<Address, Address>::Check() const
26 : {
27 : // nothing
28 1 : }
29 :
30 62 : template <> void CcuRelationalOperator<Variable, uint64_t>::Check() const
31 : {
32 : // nothing
33 62 : }
34 :
35 1 : CcuArithmeticOperator<Variable, Variable> Variable::operator+(const Variable &varB) const
36 : {
37 1 : return CcuArithmeticOperator<Variable, Variable>(*this, varB, CcuArithmeticOperatorType::ADDITION);
38 : }
39 1 : CcuArithmeticOperator<Variable, Address> Variable::operator+(const Address &addrB) const
40 : {
41 1 : return CcuArithmeticOperator<Variable, Address>(*this, addrB, CcuArithmeticOperatorType::ADDITION);
42 : }
43 7 : CcuArithmeticOperator<Variable, Address> Address::operator+(const Variable &varB) const
44 : {
45 7 : return CcuArithmeticOperator<Variable, Address>(varB, *this, CcuArithmeticOperatorType::ADDITION);
46 : }
47 1 : CcuArithmeticOperator<Address, Address> Address::operator+(const Address &addrB) const
48 : {
49 1 : return CcuArithmeticOperator<Address, Address>(*this, addrB, CcuArithmeticOperatorType::ADDITION);
50 : }
51 :
52 48 : CcuRelationalOperator<Variable, uint64_t> Variable::operator!=(uint64_t immediate) const
53 : {
54 48 : return CcuRelationalOperator<Variable, uint64_t>(*this, immediate, CcuRelationalOperatorType::NOT_EQUAL);
55 : }
56 :
57 14 : CcuRelationalOperator<Variable, uint64_t> Variable::operator==(uint64_t immediate) const
58 : {
59 14 : return CcuRelationalOperator<Variable, uint64_t>(*this, immediate, CcuRelationalOperatorType::EQUAL);
60 : }
61 :
62 : }; // namespace CcuRep
63 : }; // namespace Hccl
|