• 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
14definitions: []
15
16tests:
17  - file-name: "mov.obj"
18    isa:
19      title: Move register-to-register
20      description: Move values between registers.
21      exceptions:
22        - x_none
23    commands:
24      - file-name: "op_p"
25        isa:
26          instructions:
27            - sig: mov.obj v1:out:ref, v2:in:ref
28              acc: none
29              format: [op_v1_4_v2_4, op_v1_8_v2_8, op_v1_16_v2_16]
30        code-template: |
31          %s
32          # header
33          .function i32 main() {
34          #
35              newobj v0, Object
36              lda.obj v0
37              mov.obj v1, v0
38              jne.obj v1, return_ne_num
39              ldai 0
40              return
41          return_ne_num:
42              ldai 1
43              return
44        header-template: []
45        description: Check mov.obj with different type of arguments (empty object, with fields, with static fields, string, type) in PandaAssemby context.
46        tags: ['tsan']
47        cases:
48          - values:
49              - |
50                .record Object {
51                }
52          - values:
53              - |
54                .record Object {
55                    i32 fld2
56                }
57          - values:
58              - |
59                .record Object {
60                    i64 fld2
61                }
62          - values:
63              - |
64                .record Object {
65                    u64 fld2
66                }
67          - values:
68              - |
69                .record Object {
70                    i32 fld2 <static>
71                }
72          - values:
73              - |
74                .record Object {
75                    i32 fld1
76                    i32 fld2 <static>
77                }
78
79          - values:
80              - |
81                .record Object {
82                    i64 fld1
83                    i64 fld2 <static>
84                }
85          - values:
86              - |
87                .record Object {
88                    f64 fld1
89                    f64 fld2 <static>
90                }
91          - values:
92              - |
93                .record Object {
94                    f32 fld1
95                    f32 fld2 <static>
96                    f64 fld3
97                    f64 fld4 <static>
98                    i32 fld5
99                    i32 fld6 <static>
100                    i64 fld7
101                    i64 fld8 <static>
102                }
103          - case-template: |
104              #
105              .function i32 main() {
106              # Check mov.obj for string
107                  lda.str ""
108                  sta.obj v0
109                  mov.obj v1, v0
110                  jne.obj v1, return_ne_num
111                  ldai 0
112                  return
113              return_ne_num:
114                  ldai 1
115                  return
116          - case-template: |
117              #
118              .record Object {}
119              .function i32 main() {
120              # Check mov.obj for type
121                  lda.type Object
122                  sta.obj v0
123                  mov.obj v1, v0
124                  jne.obj v1, return_ne_num
125                  ldai 0
126                  return
127              return_ne_num:
128                  ldai 1
129                  return
130
131      - file-name: "null"
132        isa:
133          instructions:
134            - sig: mov.obj v1:out:ref, v2:in:ref
135              acc: none
136              format: [op_v1_4_v2_4, op_v1_8_v2_8, op_v1_16_v2_16]
137        code-template: |
138          %s
139          # header
140          .function i32 main() {
141          # Check mov.obj for null
142              mov.null v0
143              mov.obj v1, v0
144              newobj v2, Object
145              lda.obj v2
146              jne.obj v1, ok
147              ldai 1
148              return
149          ok:
150              ldai 0
151              return
152        header-template: []
153        check-type: none
154        description: Check mov.obj with null value.
155        cases:
156          - values:
157              - |
158                .record Object {
159                }
160          - case-template: |
161              # header
162              .function i32 main() {
163              #
164                  mov.null v0
165                  mov.obj v1, v0
166                  lda.null
167                  jeq.obj v1, ok
168                  ldai 1
169                  return
170              ok:
171                  ldai 0
172                  return
173            case-check-type: none
174
175      - file-name: "op_4_8_16"
176        isa:
177            instructions:
178              - sig: mov.obj v1:out:ref, v2:in:ref
179                acc: none
180                format: [op_v1_4_v2_4, op_v1_8_v2_8, op_v1_16_v2_16]
181        code-template: |
182            .record Object {}
183            # header
184            .function i32 main() {
185            # Check mov.obj with different registers number
186                newobj v0, Object
187                lda.obj v0
188                mov.obj %s, v0
189                mov.obj v1, %s
190                jne.obj v1, return_ne_num
191                ldai 0
192                return
193            return_ne_num:
194                ldai 1
195                return
196        header-template: []
197        description: Check mov.obj instruction with different register numbers (4, 8, 16 bit).
198        cases:
199            - values: [v0, v0]
200            - values: [v7, v7]
201            - values: [v8, v8]
202            - values: [v15, v15]
203            - values: [v16, v16]
204            - values: [v127, v127]
205            - values: [v128, v128]
206            - values: [v255, v255]
207            - values: [v256, v256]
208            - values: [v16384, v16384]
209            - values: [v32767, v32767]
210            - values: [v32768, v32768]
211            - values: [v65524, v65524]
212            - values: [v65535, v65535]
213            - values: [v65536, v65536]
214              runner-options: [compile-failure]
215      - file-name: "op_4_8_16_null"
216        isa:
217            instructions:
218              - sig: mov.obj v1:out:ref, v2:in:ref
219                acc: none
220                format: [op_v1_4_v2_4, op_v1_8_v2_8, op_v1_16_v2_16]
221        code-template: |
222            # Check mov.obj with different registers number and null
223                mov.null v0
224                mov.obj %s, v0
225                mov.obj v1, %s
226                lda.null
227                jne.obj v1, return_ne_num
228                ldai 0
229                return
230            return_ne_num:
231                ldai 1
232                return
233        description: Check mov.obj instruction with different register numbers (4, 8, 16 bit) and null value.
234        cases:
235            - values: [v0, v0]
236            - values: [v7, v7]
237            - values: [v8, v8]
238            - values: [v15, v15]
239            - values: [v16, v16]
240            - values: [v127, v127]
241            - values: [v128, v128]
242            - values: [v255, v255]
243            - values: [v256, v256]
244            - values: [v16384, v16384]
245            - values: [v32767, v32767]
246            - values: [v32768, v32768]
247            - values: [v65524, v65524]
248            - values: [v65535, v65535]
249            - values: [v65536, v65536]
250              runner-options: [compile-failure]
251
252      - file-name: "op_type"
253        tags: ['verifier']
254        bugid: ['966', '964']
255        description: Check mov.obj instruction with incorrect type of source argument.
256        isa:
257            instructions:
258              - sig: mov.obj v1:out:ref, v2:in:ref
259                acc: none
260                format: [op_v1_4_v2_4, op_v1_8_v2_8, op_v1_16_v2_16]
261            verification:
262              - v2_type
263        code-template: |
264            # Check mov.obj with wrong type
265                %s
266                mov.obj v1, v0
267        check-type: none
268        runner-options: ['verifier-failure', 'verifier-debug-config']
269        cases:
270            - values:
271                - movi v0, 123
272            - values:
273                - movi.64 v0, 123
274            - values:
275                - fmovi.64 v0, 123
276            - values:
277                - movi v0, 0
278            - values:
279                - movi.64 v0, 0
280            - values:
281                - fmovi.64 v0, 0
282
283      - file-name: "err"
284        isa:
285            instructions:
286              - sig: mov.obj v1:out:ref, v2:in:ref
287                acc: none
288                format: [op_v1_4_v2_4, op_v1_8_v2_8, op_v1_16_v2_16]
289            verification:
290              - v2_type
291        code-template: |
292            #
293                %s
294        check-type: none
295        runner-options: [compile-failure]
296        description: Check mov.obj instruction with wrong arguments.
297        cases:
298            - values:
299                - mov.obj 1, 1
300            - values:
301                - mov.obj "", v0
302            - values:
303                - mov.obj v0, ""
304            - values:
305                - mov.obj v0, 1
306            - values:
307                - mov.obj 1, v0
308            - values:
309                - mov.obj 0, v0
310            - values:
311                - mov.obj v0, 0
312            - values:
313                - mov.obj v0, 1.1
314            - values:
315                - mov.obj 1.1, v0
316            - values:
317                - mov.obj a0, a0
318            - values:
319                - mov.obj a0, v0
320            - values:
321                - mov.obj v0, a0
322            - values:
323                - mov.obj "", ""
324            - values:
325                - mov.obj a0, ""
326            - values:
327                - mov.obj "", a0
328
329      - file-name: "type_p"
330        tags: ['verifier']
331        isa:
332          instructions:
333            - sig: mov.obj v1:out:ref, v2:in:ref
334              acc: none
335              format: [op_v1_4_v2_4, op_v1_8_v2_8, op_v1_16_v2_16]
336          verification:
337            - v2_type
338        runner-options: ['verifier-failure', 'verifier-debug-config']
339        header-template: []
340        code-template: |
341            #
342            .record A {}
343            .record B {}
344            .record panda.String <external>
345            .record panda.Object <external>
346            .function i32 main() {
347                %s
348                *s
349                mov.obj v0, v1
350                ldai 0
351        check-type: no-check
352        description: Check mov.obj with incorrect source register type in PandaAssembly context. Destination type is not checked.
353        template-cases:
354          - values:
355              - |
356                #
357                    lda.type B
358                    sta.obj v0
359          - values:
360              - |
361                #
362                    lda.type B[]
363                    sta.obj v0
364          - values:
365              - |
366                #
367                    lda.type panda.String
368                    sta.obj v0
369          - values:
370              - |
371                #
372                    lda.type panda.Object
373                    sta.obj v0
374          - values:
375              - |
376                #
377                    movi v0, 10
378                    newarr v0, v0, i32[]
379          - values:
380              - mov.null v0
381          - values:
382              - movi v0, 0
383          - values:
384              - movi.64 v0, 0
385          - values:
386              - fmovi.64 v0, 0
387        cases:
388          - values:
389              - movi v1, 0
390          - values:
391              - movi.64 v1, 0
392          - values:
393              - fmovi.64 v1, 0
394
395      - file-name: uninitialized_regs
396        isa:
397          instructions:
398            - sig: mov.obj v1:out:ref, v2:in:ref
399              acc: none
400              format: [op_v1_4_v2_4, op_v1_8_v2_8, op_v1_16_v2_16]
401        description: Check mov.obj with uninitialized registers.
402        tags: ['verifier']
403        runner-options: ['verifier-failure', 'verifier-debug-config']
404        header-template: []
405        code-template: |
406          #
407          .function i32 main() {
408              %s
409              *s
410              mov.obj %s, *s
411              ldai 0
412        check-type: no-check
413        template-cases:
414          - values: ['', 'v0']
415          - values: ['', 'v256']
416          - values: ['', 'v65535']
417          - values:
418              - movi v2, 0
419              - v2
420          - values:
421              - |
422                #
423                    mov.null v1
424                    mov.obj v65534, v1
425              - v65534
426          - values:
427              - |
428                #
429                    mov.null v1
430                    mov.obj v257, v1
431              - v257
432        cases:
433          - values:
434              - ''
435              - v0
436          - values:
437              - ''
438              - v8
439          - values:
440              - ''
441              - v15
442          - values:
443              - ''
444              - v256
445          - values:
446              - ''
447              - v65535
448