1# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6# http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14definitions: []
15tests:
16  - file-name: 'not'
17    isa:
18      title: Unary
19      description: >
20        Perform specified operation on accumulator
21      exceptions:
22        - x_none
23
24    commands:
25      - file-name: 'op_none'
26        isa:
27          instructions:
28            - sig: not
29              acc: inout:i32
30              prefix: bit
31              format: [pref_op_none]
32        code-template: |
33          #
34              ldai %s
35              not
36              movi v0, %s
37              jne v0, set_failure
38              ldai 0
39              return
40          set_failure:
41              ldai 1
42              return
43        check-type: none
44        description: Check `not` with various values.
45        tags: ['tsan']
46        cases:
47          - values: ['0', '0xFFFFFFFF']
48          - values: ['1', '0xFFFFFFFE']
49          - values: ['-1', '0x0']
50          - values: ['0xF', '0xFFFFFFF0']
51          - values: ['-0xF', '0xE']
52          - values: ['0x7F', '0xFFFFFF80']
53          - values: ['-0x7F', '0x7E']
54          - values: ['0x80', '0xFFFFFF7F']
55          - values: ['-0x80', '0x7F']
56          - values: ['0xFF', '0xFFFFFF00']
57          - values: ['-0xFF', '0xFE']
58          - values: ['0xFFF', '0xFFFFF000']
59          - values: ['-0xFFF', '0xFFE']
60          - values: ['0xFFFF', '0xFFFF0000']
61          - values: ['-0xFFFF', '0xFFFE']
62          - values: ['0xFFFFF', '0xFFF00000']
63          - values: ['-0xFFFFF', '0xFFFFE']
64          - values: ['0xFFFFFF', '0xFF000000']
65          - values: ['-0xFFFFFF', '0xFFFFFE']
66          - values: ['0xFFFFFFF', '0xF0000000']
67          - values: ['-0xFFFFFFF', '0xFFFFFFE']
68          - values: ['0x7FFFFFFF', '0x80000000']
69          - values: ['-0x7FFFFFFF', '0x7FFFFFFE']
70          - values: ['0x80000000', '0x7FFFFFFF']
71          - values: ['-0x80000000', '0x7FFFFFFF']
72          - values: ['0xFFFFFFFF', '0x0']
73          - values: ['-0xFFFFFFFF', '0xFFFFFFFE']
74
75      - file-name: 'vals'
76        isa:
77          instructions:
78            - sig: not
79              acc: inout:i32
80              prefix: bit
81              format: [pref_op_none]
82        code-template: |
83          #
84              ldai %s
85              not
86              movi v0, %s
87              jne v0, set_failure
88              ldai 0
89              return
90          set_failure:
91              ldai 1
92              return
93        check-type: none
94        description: Check `not` with various values.
95        cases:
96          - values: ['0x3F1E2404', '0xC0E1DBFB']
97          - values: ['0x8E119A05', '0x71EE65FA']
98          - values: ['0x8408A74', '0xF7BF758B']
99          - values: ['0xEF517B96', '0x10AE8469']
100          - values: ['0x3D39D8B1', '0xC2C6274E']
101          - values: ['0x80AD01AA', '0x7F52FE55']
102          - values: ['0xB563F333', '0x4A9C0CCC']
103          - values: ['0xEBB8A558', '0x14475AA7']
104          - values: ['0x8C648714', '0x739B78EB']
105          - values: ['0xFDC5CD51', '0x23A32AE']
106          - values: ['0x2D459E9E', '0xD2BA6161']
107          - values: ['0x33D4670E', '0xCC2B98F1']
108          - values: ['0x798A4886', '0x8675B779']
109          - values: ['0xF49E5BB9', '0xB61A446']
110          - values: ['0x540A6EEF', '0xABF59110']
111          - values: ['0x4C0CA0DD', '0xB3F35F22']
112          - values: ['0x4FD745F', '0xFB028BA0']
113          - values: ['0xCFC655A7', '0x3039AA58']
114          - values: ['0x4F8D850D', '0xB0727AF2']
115          - values: ['0x2F71A383', '0xD08E5C7C']
116
117      - file-name: type
118        bugid: ['964', '966']
119        tags: ['verifier']
120        isa:
121          verification:
122            - acc_type
123        runner-options: ['verifier-failure', 'verifier-config']
124        header-template: []
125        code-template: |
126          .record T {}
127          .record panda.String <external>
128          .record panda.Object <external>
129          #
130          .function i32 main() {
131              %s
132              not
133        check-type: exit-positive
134        description: Check `not` with incorrect accumulator type.
135        cases:
136          - values:
137              - ldai.64 1
138          - values:
139              - fldai 1.0
140          - values:
141              - fldai.64 1.0
142          - values:
143              - lda.type T
144          - values:
145              - lda.type T[]
146          - values:
147              - lda.type panda.Object
148          - values:
149              - lda.type panda.String
150          - values:
151              - lda.str "x"
152          - values:
153              - |
154                newobj v0, T
155                lda.obj v0
156          - values:
157              - lda.null
158          - values:
159              - |
160                #
161                    movi v0, 10
162                    newarr v0, v0, i32[]
163                    lda.obj v0
164
165      - file-name: uninitialized_regs
166        bugid: ['2787']
167        tags: ['verifier']
168        isa:
169          instructions:
170            - sig: not
171              acc: inout:i32
172              prefix: bit
173              format: [pref_op_none]
174        description: Check 'not' with uninitialized accumulator.
175        runner-options: ['verifier-failure', 'verifier-config']
176        header-template: []
177        code-template: |
178          #
179          .function i32 main() {
180              # acc is undefined
181              not
182        check-type: exit-positive
183