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