• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021 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
14---
15definitions: []
16tests:
17  - file-name: andi
18    isa:
19      title: Two address binary operation with immediate on accumulator
20      description: >
21        Perform specified binary operation on accumulator and immediate and store result into accumulator.
22        Immediate is sign extended to operand size.
23      exceptions:
24        - x_none
25    commands:
26      - file-name: op_imm_32_zero
27        isa:
28          instructions:
29            - sig: andi imm:i32
30              acc: inout:i32
31              format: [op_imm_32]
32        code-template: |
33          #
34              ldai 0
35              andi %s
36              movi v0, 0
37              jne v0, set_failure
38              ldai 0
39              jmp fall_through
40          set_failure:
41              ldai 1
42          fall_through:
43        description: Check `andi` with zero and various values.
44        cases:
45          - values: ["0"]
46          - values: ["1"]
47          - values: ["-1"]
48          - values: ["0x7FFFFFFF"]
49          - values: ["-0x7FFFFFFF"]
50          - values: ["0x80000000"]
51          - values: ["-0x80000000"]
52          - values: ["0xFFFFFFFF"]
53          - values: ["-0xFFFFFFFF"]
54      - file-name: op_imm_32_pone
55        isa:
56          instructions:
57            - sig: andi imm:i32
58              acc: inout:i32
59              format: [op_imm_32]
60        code-template: |
61          #
62              ldai 1
63              andi %s
64              movi v0, %s
65              jne v0, set_failure
66              ldai 0
67              jmp fall_through
68          set_failure:
69              ldai 1
70          fall_through:
71        description: Check `andi` with +1 and various values.
72        cases:
73          - values: ["0", "0x0"]
74          - values: ["1", "0x1"]
75          - values: ["-1", "0x1"]
76          - values: ["0x7FFFFFFF", "0x1"]
77          - values: ["-0x7FFFFFFF", "0x1"]
78          - values: ["0x80000000", "0x0"]
79          - values: ["-0x80000000", "0x0"]
80          - values: ["0xFFFFFFFF", "0x1"]
81          - values: ["-0xFFFFFFFF", "0x1"]
82      - file-name: op_imm_32_none
83        isa:
84          instructions:
85            - sig: andi imm:i32
86              acc: inout:i32
87              format: [op_imm_32]
88        code-template: |
89          #
90              ldai -1
91              andi %s
92              movi v0, %s
93              jne v0, set_failure
94              ldai 0
95              jmp fall_through
96          set_failure:
97              ldai 1
98          fall_through:
99        description: Check `andi` with -1 and various values.
100        cases:
101          - values: ["0", "0x0"]
102          - values: ["1", "0x1"]
103          - values: ["-1", "0xFFFFFFFF"]
104          - values: ["0x7FFFFFFF", "0x7FFFFFFF"]
105          - values: ["-0x7FFFFFFF", "0x80000001"]
106          - values: ["0x80000000", "0x80000000"]
107          - values: ["-0x80000000", "0x80000000"]
108          - values: ["0xFFFFFFFF", "0xFFFFFFFF"]
109          - values: ["-0xFFFFFFFF", "0x1"]
110      - file-name: op_imm_32_pmax
111        isa:
112          instructions:
113            - sig: andi imm:i32
114              acc: inout:i32
115              format: [op_imm_32]
116        code-template: |
117          #
118              ldai 0x7FFFFFFF
119              andi %s
120              movi v0, %s
121              jne v0, set_failure
122              ldai 0
123              jmp fall_through
124          set_failure:
125              ldai 1
126          fall_through:
127        description: Check `andi` with +max and various values.
128        cases:
129          - values: ["0", "0x0"]
130          - values: ["1", "0x1"]
131          - values: ["-1", "0x7FFFFFFF"]
132          - values: ["0x7FFFFFFF", "0x7FFFFFFF"]
133          - values: ["-0x7FFFFFFF", "0x1"]
134          - values: ["0x80000000", "0x0"]
135          - values: ["-0x80000000", "0x0"]
136          - values: ["0xFFFFFFFF", "0x7FFFFFFF"]
137          - values: ["-0xFFFFFFFF", "0x1"]
138      - file-name: op_imm_32_nmax
139        isa:
140          instructions:
141            - sig: andi imm:i32
142              acc: inout:i32
143              format: [op_imm_32]
144        code-template: |
145          #
146              ldai -0x80000000
147              andi %s
148              movi v0, %s
149              jne v0, set_failure
150              ldai 0
151              jmp fall_through
152          set_failure:
153              ldai 1
154          fall_through:
155        description: Check `andi` with -max and various values.
156        cases:
157          - values: ["0", "0x0"]
158          - values: ["1", "0x0"]
159          - values: ["-1", "0x80000000"]
160          - values: ["0x7FFFFFFF", "0x0"]
161          - values: ["-0x7FFFFFFF", "0x80000000"]
162          - values: ["0x80000000", "0x80000000"]
163          - values: ["-0x80000000", "0x80000000"]
164          - values: ["0xFFFFFFFF", "0x80000000"]
165          - values: ["-0xFFFFFFFF", "0x0"]
166      - file-name: vals
167        isa:
168          instructions:
169            - sig: andi imm:i32
170              acc: inout:i32
171              format: [op_imm_32]
172        code-template: |
173          #
174              ldai %s
175              andi %s
176              movi v0, %s
177              jne v0, set_failure
178              ldai 0
179              jmp fall_through
180          set_failure:
181              ldai 1
182          fall_through:
183        description: Check `andi` with various values.
184        tags: ['tsan']
185        cases:
186          - values: ["0x2F588FCE", "0x92D0BE61", "0x2508E40"]
187          - values: ["0xFDD750F7", "0x8DEDAFA6", "0x8DC500A6"]
188          - values: ["0x550BDA41", "0x753E04EF", "0x550A0041"]
189          - values: ["0x18C66A4A", "0x209E1E3", "0x6042"]
190          - values: ["0x92B9866", "0xC42D014", "0x8029004"]
191          - values: ["0xFAA76C6D", "0xBD0634D1", "0xB8062441"]
192          - values: ["0xDD868BD3", "0x3D37BD89", "0x1D068981"]
193          - values: ["0x54509EE1", "0xE6DA082F", "0x44500821"]
194          - values: ["0x6BB97107", "0x1DF6E02E", "0x9B06006"]
195          - values: ["0x8325D28B", "0x90A3B91E", "0x8021900A"]
196      - file-name: type_1
197        bugid: ["964", "966"]
198        tags: ["verifier"]
199        isa:
200          instructions:
201            - sig: andi imm:i32
202              acc: inout:i32
203              format: [op_imm_32]
204          verification:
205            - acc_type
206        runner-options: ['verifier-failure', 'verifier-debug-config']
207        code-template: |
208          #
209              %s
210              andi 1
211              ldai 0
212        check-type: no-check
213        description: Check `andi` with incorrect accumulator type.
214        cases:
215          - values: [fldai.64 0.0]
216          - values: [fldai.64 -0.0]
217          - values: [fldai.64 1.0]
218          - values: [fldai.64 -1.0]
219          - values: [fldai.64 0x7FF8000000000000]
220          - values: [fldai.64 0xFFFFFFFFFFFFFFFF]
221          - values: [fldai.64 0x7FF0000000000000]
222          - values: [fldai.64 0xFFF0000000000000]
223          - values: [fldai.64 0xFFEFFFFFFFFFFFFF]
224          - values: [fldai.64 0x7FEFFFFFFFFFFFFF]
225          - values: [fldai.64 0x0000000000000001]
226          - values: [fldai.64 0x8000000000000001]
227          - values: [fldai.64 3.14159265358979323846]
228          - values: [lda.str ""]
229          - values: [lda.str "some string"]
230          - values: [lda.null]
231          - values: [ldai.64 0]
232          - values: [ldai.64 1]
233          - values: [ldai.64 -1]
234          - values: [ldai.64 0x0000000100000000]
235          - values: [ldai.64 -0x0000000100000000]
236          - values: [ldai.64 0x0000000080000000]
237          - values: [ldai.64 -0x0000000080000000]
238          - values: [ldai.64 0x1000000000000000]
239          - values: [ldai.64 0x8000000000000000]
240          - values: [ldai.64 0xF000000000000000]
241          - values: [ldai.64 0xFFFFFFFF00000000]
242          - values: [ldai.64 0xFFFFFFFFFFFFFFFF]
243          - values: [ldai.64 -0x1000000000000000]
244          - values: [ldai.64 -0x8000000000000000]
245          - values: [ldai.64 -0xF000000000000000]
246          - values: [ldai.64 -0xFFFFFFFF00000000]
247          - values: [ldai.64 -0xFFFFFFFFFFFFFFFF]
248      - file-name: type_obj
249        bugid: ["964", "966"]
250        tags: ["verifier"]
251        isa:
252          instructions:
253            - sig: andi imm:i32
254              acc: inout:i32
255              format: [op_imm_32]
256          verification:
257            - acc_type
258        runner-options: ['verifier-failure', 'verifier-debug-config']
259        description: Check `andi` with incorrect accumulator type.
260        code-template: |
261          #
262          .record Object {}
263          .function i32 main() {
264              %s
265              andi 1
266              ldai 0
267              return
268        check-type: none
269        header-template: []
270        cases:
271          - values: [lda.type Object]
272          - values:
273            - |
274              newobj v0, Object
275              lda.obj v0
276
277      - file-name: type
278        isa:
279          instructions:
280            - sig: andi imm:i32
281              acc: inout:i32
282              format: [op_imm_32]
283          verification:
284            - acc_type
285        tags: ['verifier']
286        runner-options: ['verifier-failure', 'verifier-debug-config']
287        header-template: []
288        code-template: |
289          #
290          .record B {}
291          .record panda.String <external>
292          .record panda.Object <external>
293          .function i32 main() {
294              %s
295              andi 0
296              ldai 0
297        check-type: no-check
298        description: Check addi with incorrect register type.
299        cases:
300          - values:
301              - fldai.64 0
302          - values:
303              - |
304                #
305                    lda.type B
306          - values:
307              - |
308                #
309                    lda.type B[]
310          - values:
311              - |
312                #
313                    lda.type panda.String
314          - values:
315              - |
316                #
317                    lda.type panda.Object
318          - values:
319              - |
320                #
321                    movi v0, 10
322                    newarr v0, v0, i32[]
323                    lda.obj v0
324          - values:
325              - lda.null
326          - values:
327              - ldai.64 0
328
329      - file-name: uninitialized_regs
330        bugid: ['2260']
331        isa:
332          instructions:
333            - sig: andi imm:i32
334              acc: inout:i32
335              format: [op_imm_32]
336        description: Check andi with uninitialized registers.
337        tags: ['verifier']
338        runner-options: ['verifier-failure', 'verifier-debug-config']
339        header-template: []
340        code-template: |
341            #
342            .function i32 main() {
343                andi 0
344                ldai 0
345        check-type: no-check
346