• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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: "or2"
17    isa:
18      title: Two address binary operation on accumulator
19      description: >
20        Perform specified binary operation on accumulator and register and store result into accumulator
21      exceptions:
22        - x_none
23    commands:
24      - file-name: "op_vs_8_zero"
25        isa:
26          instructions:
27            - sig: or2 v:in:i32
28              acc: inout:i32
29              prefix: bit
30              format: [pref_op_v_8]
31        code-template: |
32          #
33              ldai 0
34              movi v0, %s
35              mov v1, v0
36              or2 v0
37              mov v0, v1
38              jne v0, set_failure
39              ldai 0
40              jmp fall_through
41          set_failure:
42              ldai 1
43          fall_through:
44        description: Check or2 with zero and various values.
45        cases:
46          - values:
47              - "0"
48          - values:
49              - "1"
50          - values:
51              - "-1"
52          - values:
53              - "0x7FFFFFFF"
54          - values:
55              - "0x80000000"
56          - values:
57              - "-0x7FFFFFFF"
58          - values:
59              - "-0x80000000"
60          - values:
61              - "0xFFFFFFFF"
62          - values:
63              - "-0xFFFFFFFF"
64
65      - file-name: "op_vs_8_pone"
66        isa:
67          instructions:
68            - sig: or2 v:in:i32
69              acc: inout:i32
70              prefix: bit
71              format: [pref_op_v_8]
72        code-template: |
73          #
74              ldai 1
75              movi v0, %s
76              or2 v0
77              movi v0, %s
78              jne v0, set_failure
79              ldai 0
80              jmp fall_through
81          set_failure:
82              ldai 1
83          fall_through:
84        description: Check or2 with +1 and various values.
85        cases:
86          - values:
87              - "0"
88              - "1"
89          - values:
90              - "1"
91              - "1"
92          - values:
93              - "-1"
94              - "-1"
95          - values:
96              - "0x7FFFFFFF"
97              - "0x7FFFFFFF"
98          - values:
99              - "0x80000000"
100              - "0x80000001"
101          - values:
102              - "-0x7FFFFFFF"
103              - "-0x7FFFFFFF"
104          - values:
105              - "-0x80000000"
106              - "0x80000001"
107          - values:
108              - "0xFFFFFFFF"
109              - "0xFFFFFFFF"
110          - values:
111              - "-0xFFFFFFFF"
112              - "1"
113      - file-name: "op_vs_8_none"
114        isa:
115          instructions:
116            - sig: or2 v:in:i32
117              acc: inout:i32
118              prefix: bit
119              format: [pref_op_v_8]
120        code-template: |
121          #
122              ldai -1
123              movi v0, %s
124              or2 v0
125              movi v0, -1
126              jne v0, set_failure
127              ldai 0
128              jmp fall_through
129          set_failure:
130              ldai 1
131          fall_through:
132        description: Check or2 with -1 and various values.
133        cases:
134          - values:
135              - "0"
136          - values:
137              - "1"
138          - values:
139              - "-1"
140          - values:
141              - "0x7FFFFFFF"
142          - values:
143              - "0x80000000"
144          - values:
145              - "-0x7FFFFFFF"
146          - values:
147              - "-0x80000000"
148          - values:
149              - "0xFFFFFFFF"
150          - values:
151              - "-0xFFFFFFFF"
152
153      - file-name: "op_vs_8_pmax"
154        isa:
155          instructions:
156            - sig: or2 v:in:i32
157              acc: inout:i32
158              prefix: bit
159              format: [pref_op_v_8]
160        code-template: |
161          #
162              ldai 0x7FFFFFFF
163              movi v0, %s
164              or2 v0
165              movi v0, %s
166              jne v0, set_failure
167              ldai 0
168              jmp fall_through
169          set_failure:
170              ldai 1
171          fall_through:
172        description: Check or2 with +max and various values.
173        cases:
174          - values:
175              - "0"
176              - "0x7FFFFFFF"
177          - values:
178              - "1"
179              - "0x7FFFFFFF"
180          - values:
181              - "-1"
182              - "0xFFFFFFFF"
183          - values:
184              - "0x7FFFFFFF"
185              - "0x7FFFFFFF"
186          - values:
187              - "0x80000000"
188              - "0xFFFFFFFF"
189          - values:
190              - "-0x7FFFFFFF"
191              - "0xFFFFFFFF"
192          - values:
193              - "-0x80000000"
194              - "0xFFFFFFFF"
195          - values:
196              - "0xFFFFFFFF"
197              - "0xFFFFFFFF"
198          - values:
199              - "-0xFFFFFFFF"
200              - "0x7FFFFFFF"
201
202      - file-name: "op_vs_8_nmax"
203        isa:
204          instructions:
205            - sig: or2 v:in:i32
206              acc: inout:i32
207              prefix: bit
208              format: [pref_op_v_8]
209        code-template: |
210          #
211              ldai -0x80000000
212              movi v0, %s
213              or2 v0
214              movi v0, %s
215              jne v0, set_failure
216              ldai 0
217              jmp fall_through
218          set_failure:
219              ldai 1
220          fall_through:
221        description: Check or2 with -max and various values.
222        cases:
223          - values:
224              - "0"
225              - "0x80000000"
226          - values:
227              - "1"
228              - "0x80000001"
229          - values:
230              - "-1"
231              - "0xFFFFFFFF"
232          - values:
233              - "0x7FFFFFFF"
234              - "0xFFFFFFFF"
235          - values:
236              - "0x80000000"
237              - "0x80000000"
238          - values:
239              - "-0x7FFFFFFF"
240              - "0x80000001"
241          - values:
242              - "-0x80000000"
243              - "0x80000000"
244          - values:
245              - "0xFFFFFFFF"
246              - "0xFFFFFFFF"
247          - values:
248              - "-0xFFFFFFFF"
249              - "0x80000001"
250
251      - file-name: "vals"
252        isa:
253          instructions:
254            - sig: or2 v:in:i32
255              acc: inout:i32
256              prefix: bit
257              format: [pref_op_v_8]
258        code-template: |
259          #
260              ldai %s
261              movi v0, %s
262              or2 v0
263              movi v0, %s
264              jne v0, set_failure
265              ldai 0
266              jmp fall_through
267          set_failure:
268              ldai 1
269          fall_through:
270        description: Check or2 with various values.
271        tags: ['tsan']
272        cases:
273          - values:
274              - "0xB98B551D"
275              - "0x86224577"
276              - "0xBFAB557F"
277          - values:
278              - "0xA395AE93"
279              - "0x7B843B94"
280              - "0xFB95BF97"
281          - values:
282              - "0xE8C8F0B9"
283              - "0x67A71796"
284              - "0xEFEFF7BF"
285          - values:
286              - "0x3E943F53"
287              - "0x46DDAA06"
288              - "0x7EDDBF57"
289          - values:
290              - "0xEB55B86B"
291              - "0xF33CDAA5"
292              - "0xFB7DFAEF"
293          - values:
294              - "0x26EA0C73"
295              - "0x76955D83"
296              - "0x76FF5DF3"
297          - values:
298              - "0x76E497AA"
299              - "0x8626722"
300              - "0x7EE6F7AA"
301          - values:
302              - "0xE645F7B6"
303              - "0xE78A8A5"
304              - "0xEE7DFFB7"
305          - values:
306              - "0x5193B1ED"
307              - "0x51FAC7A5"
308              - "0x51FBF7ED"
309          - values:
310              - "0x67A70527"
311              - "0x54B76EBF"
312              - "0x77B76FBF"
313
314      - file-name: "vals_mod32_1"
315        bugid: ['1324']
316        tags: ['verifier']
317        runner-options: ['verifier-failure', 'verifier-config']
318        isa:
319          instructions:
320            - sig: or2 v:in:i32
321              acc: inout:i32
322              prefix: bit
323              format: [pref_op_v_8]
324        code-template: |
325          #
326              ldai.64 %s
327              movi.64 v0, %s
328              or2 v0
329              movi.64 v0, %s
330              cmp.64 v0
331        description: Check or2 with incorrect accumulator and register types.
332        cases:
333          - values:
334              - "0x17FFFFFFF"
335              - "0x17FFFFFFF"
336              - "0x7FFFFFFF"
337          - values:
338              - "0x77777777FFFFFFFF"
339              - "0x1111111180000000"
340              - "0xFFFFFFFFFFFFFFFF"
341          - values:
342              - "0x180000000"
343              - "0x180000000"
344              - "0xFFFFFFFF80000000"
345
346      - file-name: "regs"
347        isa:
348          instructions:
349            - sig: or2 v:in:i32
350              acc: inout:i32
351              prefix: bit
352              format: [pref_op_v_8]
353        runner-options: ['compile-only']
354        code-template: |
355          #
356              or2 %s
357        check-type: none
358        description: Check or2 with various register numbers.
359        cases:
360          - values:
361              - "v255"
362          - values:
363              - "v256"
364            runner-options: ['compile-failure']
365
366      - file-name: "type"
367        bugid: ["964", "966"]
368        tags: ["verifier"]
369        isa:
370          verification:
371            - acc_type
372            - v1_type
373        runner-options: ['verifier-failure', 'verifier-config']
374        header-template: []
375        code-template: |
376          .record T {}
377          .function i32 main() {
378              %s
379              *s
380              or2 v0
381        check-type: exit-positive
382        description: Check 'or2' with incorrect accumulator and/or register types.
383        cases:
384          - values:
385            - ldai 0
386            id: acc_ok
387          - values:
388            - ldai.64 0
389          - values:
390            - fldai 0
391            bugid: ['7315']
392          - values:
393            - fldai.64 0
394          - values:
395            - lda.null
396          - values:
397            - |
398              #
399                  movi v1, 0
400                  newarr v1, v1, i32[]
401                  lda.obj v1
402          - values:
403            - lda.str "0"
404          - values:
405            - lda.type T
406          - values:
407            - |
408              #
409                  newobj v1, T
410                  lda.obj v1
411        template-cases:
412          - values:
413            - movi v0, 0
414            exclude: [acc_ok]
415          - values:
416            - movi.64 v0, 0
417          - values:
418            - fmovi v0, 0
419            bugid: ['7315']
420          - values:
421            - fmovi.64 v0, 0
422          - values:
423            - mov.null v0
424          - values:
425            - |
426              #
427                  movi v0, 0
428                  newarr v0, v0, i32[]
429          - values:
430            - |
431              #
432                  lda.str "0"
433                  sta.obj v0
434          - values:
435            - |
436              #
437                  lda.type T
438                  sta.obj v0
439          - values:
440            - newobj v0, T
441
442
443      - file-name: uninitialized_regs
444        isa:
445          instructions:
446            - sig: or2 v:in:i32
447              acc: inout:i32
448              prefix: bit
449              format: [pref_op_v_8]
450        description: Check 'or2' with uninitialized registers.
451        tags: ['verifier']
452        runner-options: ['verifier-failure', 'verifier-config']
453        code-template: |
454          #
455              %s
456              *s
457              or2 *s
458        check-type: exit-positive
459        template-cases:
460          - values:
461              - ''
462          - values:
463              - ldai 0
464            exclude: [init]
465        cases:
466          - values:
467              - ''
468              - v0
469          - values:
470              - movi v1, 0
471              - v1
472            id: init
473          - values:
474              - ''
475              - v8
476          - values:
477              - ''
478              - v15
479          - values:
480              - movi v15, 0
481              - v15
482            id: init
483