• 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:
15  - name: PandaAssembly
16    template: >
17      .language PandaAssembly
18
19tests:
20  - file-name: call.short
21    isa:
22      title: Static call
23      description: >
24        Call indicated static method, i.e. create new frame, pass values of arguments and
25        continue execution from the first instruction of a method.
26        Callee should treat accumulator value as undefined and cannot use it until accumulator
27        definition in the new frame.
28        Result (if any) is returned in accumulator (see 'Calling sequence' chapter for more details).
29        Method, its class and the number of argument is resolved by given method_id in
30        runtime constant-pool.
31        Arguments are passed in source registers in the same order as in method signature.
32        Non-range instructions can be used to pass up to 4 arguments (unused register slot values will
33        be discarded and corresponding registers will not be passed to the callee).
34        For methods with more arguments range kind of instruction is to be used, which takes the needed number
35        of arguments starting from 'vs' register.
36      verification:
37        - method_id_static
38        - compatible_arguments
39    commands:
40      - file-name: op_v1_4_v2_4_id_16
41        isa:
42          instructions:
43            - sig: call.short method_id, v1:in:top, v2:in:top
44              acc: out:top
45              format: [op_v1_4_v2_4_id_16]
46        header-template: []
47        description: Check that 'call.short' supports up to 2 arguments.
48        tags: ['tsan']
49        code-template: |
50          .function void f1(%s) {
51              return.void
52          }
53          .function i32 main() {
54          %s
55              call.short f1%s
56        check-type: exit-positive
57        cases:
58          - values:
59            - ''
60            - ''
61            - ''
62          - values:
63            - 'i32 a0'
64            - 'movi v0, 0'
65            - ', v0'
66          - values:
67            - 'i32 a0, i32 a1'
68            - 'movi v0, 0'
69            - ', v0, v0'
70          - values:
71            - 'i32 a0, i32 a1'
72            - |
73              #
74                  movi v0, 0
75                  movi v1, 0
76            - ', v0, v1'
77          - values:
78            - 'i32 a0, i32 a1'
79            - |
80              #
81                  movi v0, 0
82                  movi v1, 0
83            - ', v1, v0'
84          - values:
85            - 'i64 a0, f64 a1'
86            - |
87              #
88                  movi.64 v0, 0
89                  fmovi.64 v1, 0
90            - ', v0, v1'
91          - values:
92              - 'i32 a0, i32 a1, i32 a2'
93              - 'movi v0, 0'
94              - ', v0, v0, v0'
95            runner-options: [compile-failure]
96          - values:
97              - 'i32 a0, i32 a1, i32 a2'
98              - |
99                #
100                    movi v0, 0
101                    movi v1, 0
102                    movi v2, 0
103              - ', v0, v1, v2'
104            runner-options: [compile-failure]
105
106      - file-name: str_srg
107        isa:
108          instructions:
109            - sig: call.short method_id, v1:in:top, v2:in:top
110              acc: out:top
111              format: [op_v1_4_v2_4_id_16]
112        header-template: [panda_string]
113        description: Check that 'call.short' works with String object.
114        tags: ['tsan']
115        code-template: |
116          .function void f1(panda.String a0) {
117              return.void
118          }
119          .function i32 main() {
120          %s
121              call.short f1%s
122        check-type: exit-positive
123        cases:
124          - values:
125            - ''
126            - ''
127            runner-options: [compile-failure]
128          - values:
129            - |
130              #
131                  lda.str "some string"
132                  sta.obj v0
133            - ', v0'
134          - values:
135            - '    mov.null v0'
136            - ', v0'
137          - values:
138            - ''
139            - ', "some string"'
140            runner-options: [compile-failure]
141
142      - file-name: uninitialized_values
143        bugid: ['1324']
144        tags: ['verifier']
145        runner-options: ['verifier-failure', 'verifier-config']
146        isa:
147          instructions:
148            - sig: call.short method_id, v1:in:top, v2:in:top
149              acc: out:top
150              format: [op_v1_4_v2_4_id_16]
151        description: Verifier should check usage of uninitialized arguments passed to function.
152        header-template: []
153        code-template: |
154          .function void f1(%s) {
155              %s
156              return.void
157          }
158          .function i32 main() {
159              %s
160              call.short f1%s
161        check-type: exit-positive
162
163        # Template parameters:
164        #            1st argument is function arguments
165        #            2nd - usage of acc or reg
166        #            3rd - possible initialization of registers
167        #            4th - call.short parameters
168        cases:
169          - values:
170              - 'i32 a0' # parameter
171              - '' # no instructions
172              - |
173                #
174                    mov.null v0
175                    movi v2, 0
176              - ', v2' # use in call.short
177            bugid: ['1940']
178            runner-options: ['verifier-only', 'verifier-config']
179          - values: ['',                'lda v0',    '',    '']
180            description: Check usage of uninitialized register in function frame.
181            bugid: ['1702']
182          - values: ['',                'lda v0',    'movi v0, 0',    ', v0']
183            description: Check usage of uninitialized register in function frame.
184            bugid: ['1702']
185          - values: ['',                'sta v0',    '',    '']
186            description: Check usage of uninitialized accumulator in function frame.
187            bugid: ['1702']
188          - values: ['i32 a0',          '',          '',    ', v0']
189          - values: ['i32 a0, i32 a1',  '',          '',    ', v0, v0']
190          - values: ['i32 a0, i32 a1',  '',          '',    ', v0, v1']
191          - values: ['i32 a0, i32 a1',  '',          'movi v0, 0',    ', v0, v1']
192            description: Check if one of registers in 'call.short' is uninitialized.
193          - values: ['i32 a0, i32 a1',  '',          'movi v1, 0',    ', v0, v1']
194            description: Check if one of registers in 'call.short' is uninitialized.
195
196          - values: ['',                'lda a0',    '',    '']
197            description: Check usage of undefined parameter.
198            runner-options: [compile-failure]
199          - values: ['',                'lda a1',    '',    '']
200            description: Check usage of undefined parameter.
201            runner-options: [compile-failure]
202
203      - file-name: uninitialized_reg_no_arg
204        bugid: ['1324']
205        tags: ['verifier']
206        runner-options: ['verifier-failure', 'verifier-config']
207        isa:
208          instructions:
209            - sig: call.short method_id, v1:in:top, v2:in:top
210              acc: out:top
211              format: [op_v1_4_v2_4_id_16]
212        description: Verifier should check usage of uninitialized registers in function.
213        header-template: []
214        code-template: |
215          .function void f1() {
216              %s
217              return.void
218          }
219          .function i32 main() {
220              %s
221              call.short f1
222        check-type: exit-positive
223        cases:
224          - values:
225            - lda v0
226            - movi v0, 123
227          - values:
228            - lda v1
229            - movi v1, 123
230          - values:
231            - lda.64 v0
232            - movi.64 v0, 0xFFFFFFFFFFFFFFFF
233          - values:
234            - lda.64 v1
235            - movi.64 v1, 0xFFFFFFFFFFFFFFFF
236          - values:
237            - lda.64 v0
238            - fmovi.64 v0, 3.1415926535
239          - values:
240            - lda.64 v1
241            - movi.64 v1, 0xFFFFFFFFFFFFFFFF
242          - values:
243            - lda.obj v0
244            - |
245              #
246                  lda.str "some string"
247                  sta.obj v0
248          - values:
249            - lda.obj v1
250            - |
251              #
252                  lda.str "some string"
253                  sta.obj v1
254
255      - file-name: args_count_mismatch
256        runner-options: [compile-only]
257        isa:
258          instructions:
259            - sig: call.short method_id, v1:in:top, v2:in:top
260              acc: out:top
261              format: [op_v1_4_v2_4_id_16]
262        description: Check 'call.short' when arguments of function and instruction parameters mismatch.
263        header-template: []
264        code-template: |
265          .function void f1(%s) {
266              return.void
267          }
268          .function i32 main() {
269              %s
270              call.short f1%s
271        check-type: exit-positive
272
273        # Template parameters:
274        #            1st - function arguments
275        #            2nd - possible initialization of registers
276        #            3rd - call.short parameters
277        cases:
278          - values: ['',                '',            ', v0']
279            description: Check uninitialized register is ignored when its value is not used.
280          - values: ['',                '',            ', v0, v0']
281            description: Check uninitialized register is ignored when its value is not used.
282          - values: ['i32 a0',          '',            '']
283            runner-options: [compile-failure]
284            description: Mismatch function parameters.
285          - values: ['i32 a0, i32 a1',  'movi v0, 0',  ', v0']
286            runner-options: [compile-failure]
287            description: Mismatch function parameters.
288            ignore: true
289            bugid: ['1956', '1304']
290          - values: ['',                'movi v0, 0',  ', v0']
291            description: Check initialized register is ignored when its value is not used.
292          - values: ['i32 a0',          'movi v0, 0',  ', v0, v0']
293            description: Check initialized register is ignored when its value is not used.
294
295      - file-name: args_type_mismatch
296        bugid: ['1324']
297        tags: ['verifier']
298        runner-options: ['verifier-failure', 'verifier-config']
299        isa:
300          instructions:
301            - sig: call.short method_id, v1:in:top, v2:in:top
302              acc: out:top
303              format: [op_v1_4_v2_4_id_16]
304        description: Check 'call.short' when argument type of function and instruction mismatch.
305        header-template: []
306        code-template: |
307          %s
308          .function void f1(%s) {
309              return.void
310          }
311          .function i32 main() {
312              %s
313              call.short f1, v0
314        check-type: exit-positive
315
316        # Template parameters:
317        #            1 - type definitions
318        #            2 - function arguments
319        #            3 - possible initialization of registers
320        #            4 - call.short parameters
321        cases:
322            - values: ['',                'i32 a0',      'mov.null v0']
323            - values: ['',                'i64 a0',      'mov.null v0']
324            - values: ['',                'f64 a0',      'mov.null v0']
325            - values: ['',                'i32 a0',      'movi.64 v0, 0']
326            - values: ['',                'f64 a0',      'movi.64 v0, 0']
327            - values: ['.record Obj {}',  'Obj a0',      'movi.64 v0, 0']
328            - values: ['',                'i64 a0',      'movi v0, 0']
329            - values: ['',                'f64 a0',      'movi v0, 0']
330            - values: ['.record Obj {}',  'Obj a0',      'movi v0, 0']
331            - values: ['.record panda.String <external>', 'panda.String a0', 'movi v0, 0']
332            - values:
333              - '.record panda.String <external>'
334              - 'i32 a0'
335              - |
336                lda.str "some string"
337                    sta.obj v0
338
339            - values:
340              - |
341                #
342                .record Obj {}
343
344                .function void Obj.ctor(Obj a0) <ctor> {
345                    return.void
346                }
347              - i32 a0
348              - |
349                #
350                    initobj.short Obj.ctor
351                    sta.obj v0
352
353            - values:
354                - |
355                  #
356                  .record Obj {}
357
358                  .function void Obj.ctor(Obj a0) <ctor> {
359                      return.void
360                  }
361                - i64 a0
362                - |
363                  #
364                      initobj.short Obj.ctor
365                      sta.obj v0
366
367      - file-name: reg
368        runner-options: [compile-only]
369        isa:
370          instructions:
371            - sig: call.short method_id, v1:in:top, v2:in:top
372              acc: out:top
373              format: [op_v1_4_v2_4_id_16]
374        description: Check 'call.short' register number width.
375        header-template: []
376        code-template: |
377          .function void f1(i32 a0) {
378              return.void
379          }
380          .function i32 main() {
381              movi %s, 0
382              call.short f1, %s
383        check-type: exit-positive
384        cases:
385          - values: ['v0', 'v0']
386          - values: ['v7', 'v7']
387          - values: ['v8', 'v8']
388          - values: ['v15', 'v15']
389          - values: ['v16', 'v16']
390            runner-options: [compile-failure]
391          - values: ['v127', 'v127']
392            runner-options: [compile-failure]
393          - values: ['v0', '1']
394            runner-options: [compile-failure]
395          - values: ['v0', '1.1']
396            runner-options: [compile-failure]
397          - values: ['v0', '0xFFFFFFFFFFFFFFFF']
398            runner-options: [compile-failure]
399          - values: ['v0', '"some string"']
400            runner-options: [compile-failure]
401
402      - file-name: reg2
403        runner-options: [compile-only]
404        isa:
405          instructions:
406            - sig: call.short method_id, v1:in:top, v2:in:top
407              acc: out:top
408              format: [op_v1_4_v2_4_id_16]
409        description: Check 'call.short' register number width.
410        header-template: []
411        code-template: |
412          .function void f1(i32 a0, i32 a1) {
413              return.void
414          }
415          .function i32 main() {
416              movi %s, 0
417              movi %s, 1
418              call.short f1, %s, %s
419        check-type: exit-positive
420        cases:
421          - values: ['v0', 'v1', 'v0', 'v1']
422          - values: ['v7', 'v7', 'v7', 'v7']
423          - values: ['v7', 'v8', 'v7', 'v8']
424          - values: ['v15', 'v15', 'v15', 'v15']
425          - values: ['v15', 'v16', 'v15', 'v16']
426            runner-options: [compile-failure]
427          - values: ['v16', 'v15', 'v16', 'v15']
428            runner-options: [compile-failure]
429          - values: ['v16', 'v16', 'v16', 'v16']
430            runner-options: [compile-failure]
431          - values: ['v127', 'v127', 'v127', 'v127']
432            runner-options: [compile-failure]
433
434      - file-name: arg_1_i32_acc
435        isa:
436          instructions:
437            - sig: call.short method_id, v1:in:top, v2:in:top
438              acc: out:top
439              format: [op_v1_4_v2_4_id_16]
440        description: Check correctness of passed arguments. Load parameter to accumulator. Check i32 type of arguments.
441        header-template: []
442        code-template: |
443          .function i32 f1(i32 a0) {
444              lda a0
445              movi v1, %s
446              jne v1, exit_failure
447              ldai 0
448              return
449          exit_failure:
450              ldai 1
451              return
452          }
453          .function i32 main() {
454              movi v0, %s
455              call.short f1, v0
456
457        check-type: no-check
458        cases:
459          - values: ["0", "0"]
460          - values: ["1", "1"]
461          - values: ["1234567", "1234567"]
462          - values: ["0x7FFFFFFF", "0x7FFFFFFF"]
463          - values: ["0x80000000", "0x80000000"]
464          - values: ["0x9ABCDEF0", "0x9ABCDEF0"]
465          - values: ["0xFFFFFFFF", "0xFFFFFFFF"]
466
467      - file-name: arg_1_f64_acc
468        isa:
469          instructions:
470            - sig: call.short method_id, v1:in:top, v2:in:top
471              acc: out:top
472              format: [op_v1_4_v2_4_id_16]
473        description: Check correctness of passed arguments. Load parameter to accumulator. Check f64 type of arguments.
474        tags: ['irtoc_ignore']
475        header-template: []
476        code-template: |
477          .function i32 f1(f64 a0) {
478              lda.64 a0
479              fmovi.64 v1, %s
480              fcmpg.64 v1
481              return
482          }
483          .function i32 main() {
484              fmovi.64 v0, %s
485              call.short f1, v0
486        check-type: no-check
487        cases:
488          - values: ["0", "0"]
489          - values: ["1.1", "1.1"]
490          - values: ["0x7ff0000000000000", "0x7ff0000000000000"]
491          - values: ["0xfff0000000000000", "0xfff0000000000000"]
492          - values: ["0x7fefffffffffffff", "0x7fefffffffffffff"]
493          - values: ["0xffefffffffffffff", "0xffefffffffffffff"]
494          - values: ["100e100", "100e100"]
495
496      - file-name: arg_1_i32_reg
497        isa:
498          instructions:
499            - sig: call.short method_id, v1:in:top, v2:in:top
500              acc: out:top
501              format: [op_v1_4_v2_4_id_16]
502        description: Check correctness of passed arguments. Load parameter to register. Check i32 type of arguments.
503        header-template: []
504        code-template: |
505          .function i32 f1(i32 a0) {
506              mov v1, a0
507              ldai %s
508              jne v1, exit_failure
509              ldai 0
510              return
511          exit_failure:
512              ldai 1
513              return
514          }
515          .function i32 main() {
516              movi v0, %s
517              call.short f1, v0
518        check-type: no-check
519        cases:
520          - values: ["0", "0"]
521          - values: ["1", "1"]
522          - values: ["1234567", "1234567"]
523          - values: ["0x7FFFFFFF", "0x7FFFFFFF"]
524          - values: ["0x80000000", "0x80000000"]
525          - values: ["0x9ABCDEF0", "0x9ABCDEF0"]
526          - values: ["0xFFFFFFFF", "0xFFFFFFFF"]
527
528      - file-name: arg_1_f64_reg
529        isa:
530          instructions:
531            - sig: call.short method_id, v1:in:top, v2:in:top
532              acc: out:top
533              format: [op_v1_4_v2_4_id_16]
534        description: Check correctness of passed arguments. Load parameter to register. Check f64 type of arguments.
535        tags: ['irtoc_ignore']
536        header-template: []
537        code-template: |
538          .function i32 f1(f64 a0) {
539              mov.64 v1, a0
540              fldai.64 %s
541              fcmpg.64 v1
542              return
543          }
544          .function i32 main() {
545              fmovi.64 v0, %s
546              call.short f1, v0
547        check-type: no-check
548        cases:
549          - values: ["0", "0"]
550          - values: ["1.1", "1.1"]
551          - values: ["0x7ff0000000000000", "0x7ff0000000000000"]
552          - values: ["0xfff0000000000000", "0xfff0000000000000"]
553          - values: ["0x7fefffffffffffff", "0x7fefffffffffffff"]
554          - values: ["0xffefffffffffffff", "0xffefffffffffffff"]
555          - values: ["100e100", "100e100"]
556
557      - file-name: arg_2_i32_acc
558        isa:
559          instructions:
560            - sig: call.short method_id, v1:in:top, v2:in:top
561              acc: out:top
562              format: [op_v1_4_v2_4_id_16]
563        description: Check correctness of passed arguments. Load parameter to accumulator. Check i32 type of arguments.
564        header-template: []
565        code-template: |
566          .function i32 f1(i32 a0, i32 a1) {
567              lda a0
568              movi v1, %s
569              jeq v1, f1_l1
570          # 1st arg does not match, exit
571              ldai 1
572              return
573          f1_l1:
574              lda a1
575              movi v1, %s
576              jne v1, exit_failure
577              ldai 0
578              return
579          exit_failure:
580              ldai 1
581              return
582          }
583          .function i32 main() {
584              movi v0, %s
585              movi v1, %s
586              call.short f1, v0, v1
587
588        check-type: no-check
589        cases:
590          - values: ["0", "0", "0", "0"]
591          - values: ["0", "1", "0", "1"]
592          - values: ["1", "0", "1", "0"]
593          - values: ["0", "1234567", "0", "1234567"]
594          - values: ["1234567", "0", "1234567", "0"]
595          - values: ["0x7FFFFFFF", "0", "0x7FFFFFFF", "0"]
596          - values: ["0", "0x7FFFFFFF", "0", "0x7FFFFFFF"]
597          - values: ["0x7FFFFFFF", "0x7FFFFFFF", "0x7FFFFFFF", "0x7FFFFFFF"]
598          - values: ["0x12345678", "0x9ABCDEF0", "0x12345678", "0x9ABCDEF0"]
599          - values: ["0", "0x80000000", "0", "0x80000000"]
600          - values: ["0x80000000", "0", "0x80000000", "0"]
601          - values: ["0x80000000", "0x80000000", "0x80000000", "0x80000000"]
602          - values: ["0x9ABCDEF0", "0xFEDCBA09", "0x9ABCDEF0", "0xFEDCBA09"]
603          - values: ["0", "0xFFFFFFFF", "0", "0xFFFFFFFF"]
604          - values: ["0xFFFFFFFF", "0", "0xFFFFFFFF", "0"]
605          - values: ["0xFFFFFFFF", "0xFFFFFFFF", "0xFFFFFFFF", "0xFFFFFFFF"]
606
607      - file-name: arg_2_i32_reg
608        isa:
609          instructions:
610            - sig: call.short method_id, v1:in:top, v2:in:top
611              acc: out:top
612              format: [op_v1_4_v2_4_id_16]
613        description: Check correctness of passed arguments. Load parameter to register. Check i32 type of arguments.
614        header-template: []
615        code-template: |
616          .function i32 f1(i32 a0, i32 a1) {
617              mov v1, a0
618              ldai %s
619              jeq v1, f1_l1
620          # 1st arg does not match, exit
621              ldai 1
622              return
623          f1_l1:
624              mov v1, a1
625              ldai %s
626              jne v1, exit_failure
627              ldai 0
628              return
629          exit_failure:
630              ldai 1
631              return
632          }
633          .function i32 main() {
634              movi v0, %s
635              movi v1, %s
636              call.short f1, v0, v1
637        check-type: no-check
638        cases:
639          - values: ["0", "0", "0", "0"]
640          - values: ["0", "1", "0", "1"]
641          - values: ["1", "0", "1", "0"]
642          - values: ["0", "1234567", "0", "1234567"]
643          - values: ["1234567", "0", "1234567", "0"]
644          - values: ["0x7FFFFFFF", "0", "0x7FFFFFFF", "0"]
645          - values: ["0", "0x7FFFFFFF", "0", "0x7FFFFFFF"]
646          - values: ["0x7FFFFFFF", "0x7FFFFFFF", "0x7FFFFFFF", "0x7FFFFFFF"]
647          - values: ["0x12345678", "0x9ABCDEF0", "0x12345678", "0x9ABCDEF0"]
648          - values: ["0", "0x80000000", "0", "0x80000000"]
649          - values: ["0x80000000", "0", "0x80000000", "0"]
650          - values: ["0x80000000", "0x80000000", "0x80000000", "0x80000000"]
651          - values: ["0x9ABCDEF0", "0xFEDCBA09", "0x9ABCDEF0", "0xFEDCBA09"]
652          - values: ["0", "0xFFFFFFFF", "0", "0xFFFFFFFF"]
653          - values: ["0xFFFFFFFF", "0", "0xFFFFFFFF", "0"]
654          - values: ["0xFFFFFFFF", "0xFFFFFFFF", "0xFFFFFFFF", "0xFFFFFFFF"]
655
656      - file-name: arg_2_f64_acc
657        isa:
658          instructions:
659            - sig: call.short method_id, v1:in:top, v2:in:top
660              acc: out:top
661              format: [op_v1_4_v2_4_id_16]
662        description: Check correctness of passed arguments. Load parameter to accumulator. Check f64 type of arguments.
663        tags: ['tsan', 'irtoc_ignore']
664        header-template: []
665        code-template: |
666          .function i32 f1(f64 a0, f64 a1) {
667              lda.64 a0
668              fmovi.64 v1, %s
669              fcmpg.64 v1
670              jeqz f1_l1
671          # 1st arg does not match, exit
672              ldai 1
673              return
674          f1_l1:
675              lda.64 a1
676              fmovi.64 v1, %s
677              fcmpg.64 v1
678              return
679          }
680          .function i32 main() {
681              fmovi.64 v0, %s
682              fmovi.64 v1, %s
683              call.short f1, v0, v1
684
685        check-type: no-check
686        cases:
687          - values: ["0", "0", "0", "0"]
688          - values: ["1.2", "1.1", "1.2", "1.1"]
689          - values: ["0x7ff0000000000000", "0xfff0000000000000", "0x7ff0000000000000", "0xfff0000000000000"]
690          - values: ["0xffefffffffffffff", "0x7fefffffffffffff", "0xffefffffffffffff", "0x7fefffffffffffff"]
691          - values: ["100e100", "200e200", "100e100", "200e200"]
692
693      - file-name: arg_2_f64_reg
694        isa:
695          instructions:
696            - sig: call.short method_id, v1:in:top, v2:in:top
697              acc: out:top
698              format: [op_v1_4_v2_4_id_16]
699        description: Check correctness of passed arguments. Load parameter to register. Check f64 type of arguments.
700        tags: ['irtoc_ignore']
701        header-template: []
702        code-template: |
703          .function i32 f1(f64 a0, f64 a1) {
704              mov.64 v1, a0
705              fldai.64 %s
706              fcmpg.64 v1
707              jeqz f1_l1
708          # 1st arg does not match, exit
709              ldai 1
710              return
711          f1_l1:
712              mov.64 v1, a1
713              fldai.64 %s
714              fcmpg.64 v1
715              return
716          }
717          .function i32 main() {
718              fmovi.64 v0, %s
719              fmovi.64 v1, %s
720              call.short f1, v0, v1
721        check-type: no-check
722        cases:
723          - values: ["0", "0", "0", "0"]
724          - values: ["1.2", "1.1", "1.2", "1.1"]
725          - values: ["0x7ff0000000000000", "0xfff0000000000000", "0x7ff0000000000000", "0xfff0000000000000"]
726          - values: ["0xffefffffffffffff", "0x7fefffffffffffff", "0xffefffffffffffff", "0x7fefffffffffffff"]
727          - values: ["100e100", "200e200", "100e100", "200e200"]
728
729      - file-name: arg_1_i64_acc
730        isa:
731          instructions:
732            - sig: call.short method_id, v1:in:top, v2:in:top
733              acc: out:top
734              format: [op_v1_4_v2_4_id_16]
735        description: Check correctness of passed arguments. Load parameter to accumulator. Check i64 type of arguments.
736        header-template: []
737        code-template: |
738          .function i32 f1(i64 a0) {
739              lda.64 a0
740              movi.64 v1, %s
741              cmp.64 v1
742              return
743          }
744          .function i32 main() {
745              movi.64 v0, %s
746              call.short f1, v0
747
748        check-type: no-check
749        cases:
750          - values: ["0", "0"]
751          - values: ["1", "1"]
752          - values: ["0x1234567890ABCDEF", "0x1234567890ABCDEF"]
753          - values: ["0x7FFFFFFFFFFFFFFF", "0x7FFFFFFFFFFFFFFF"]
754          - values: ["0x8000000000000000", "0x8000000000000000"]
755          - values: ["0xFEDCBA0987654321", "0xFEDCBA0987654321"]
756          - values: ["0xFFFFFFFFFFFFFFFF", "0xFFFFFFFFFFFFFFFF"]
757
758      - file-name: arg_1_i64_reg
759        isa:
760          instructions:
761            - sig: call.short method_id, v1:in:top, v2:in:top
762              acc: out:top
763              format: [op_v1_4_v2_4_id_16]
764        description: Check correctness of passed arguments. Load parameter to accumulator. Check i64 type of arguments.
765        header-template: []
766        code-template: |
767          .function i32 f1(i64 a0) {
768              mov.64 v1, a0
769              ldai.64 %s
770              cmp.64 v1
771              return
772          }
773          .function i32 main() {
774              movi.64 v0, %s
775              call.short f1, v0
776
777        check-type: no-check
778        cases:
779          - values: ["0", "0"]
780          - values: ["1", "1"]
781          - values: ["0x1234567890ABCDEF", "0x1234567890ABCDEF"]
782          - values: ["0x7FFFFFFFFFFFFFFF", "0x7FFFFFFFFFFFFFFF"]
783          - values: ["0x8000000000000000", "0x8000000000000000"]
784          - values: ["0xFEDCBA0987654321", "0xFEDCBA0987654321"]
785          - values: ["0xFFFFFFFFFFFFFFFF", "0xFFFFFFFFFFFFFFFF"]
786
787      - file-name: arg_2_i64_acc
788        isa:
789          instructions:
790            - sig: call.short method_id, v1:in:top, v2:in:top
791              acc: out:top
792              format: [op_v1_4_v2_4_id_16]
793        description: Check correctness of passed arguments. Load parameter to accumulator.
794        tags: ['tsan']
795        header-template: []
796        code-template: |
797          .function i32 f1(i64 a0, i64 a1) {
798              lda.64 a0
799              movi.64 v1, %s
800              cmp.64 v1
801              jeqz f1_l1
802          # 1st arg does not match, exit
803              ldai 1
804              return
805          f1_l1:
806              lda.64 a1
807              movi.64 v1, %s
808              cmp.64 v1
809              return
810          }
811          .function i32 main() {
812              movi.64 v0, %s
813              movi.64 v1, %s
814              call.short f1, v0, v1
815
816        check-type: no-check
817        cases:
818          - values: ["0", "0", "0", "0"]
819          - values: ["0", "1", "0", "1"]
820          - values: ["1", "0", "1", "0"]
821          - values: ["0x1234567890ABCDEF", "0x234567890ABCDEF1", "0x1234567890ABCDEF", "0x234567890ABCDEF1"]
822          - values: ["0x7FFFFFFFFFFFFFFF", "0", "0x7FFFFFFFFFFFFFFF", "0"]
823          - values: ["0", "0x7FFFFFFFFFFFFFFF", "0", "0x7FFFFFFFFFFFFFFF"]
824          - values: ["0x7FFFFFFFFFFFFFFF", "0x7FFFFFFFFFFFFFFF", "0x7FFFFFFFFFFFFFFF", "0x7FFFFFFFFFFFFFFF"]
825          - values: ["0", "0x8000000000000000", "0", "0x8000000000000000"]
826          - values: ["0x8000000000000000", "0", "0x8000000000000000", "0"]
827          - values: ["0x8000000000000000", "0x8000000000000000", "0x8000000000000000", "0x8000000000000000"]
828          - values: ["0xFEDCBA0987654321", "0xEDCBA0987654321F", "0xFEDCBA0987654321", "0xEDCBA0987654321F"]
829          - values: ["0", "0xFFFFFFFFFFFFFFFF", "0", "0xFFFFFFFFFFFFFFFF"]
830          - values: ["0xFFFFFFFFFFFFFFFF", "0", "0xFFFFFFFFFFFFFFFF", "0"]
831          - values: ["0xFFFFFFFFFFFFFFFF", "0xFFFFFFFFFFFFFFFF", "0xFFFFFFFFFFFFFFFF", "0xFFFFFFFFFFFFFFFF"]
832
833      - file-name: arg_2_i64_reg
834        isa:
835          instructions:
836            - sig: call.short method_id, v1:in:top, v2:in:top
837              acc: out:top
838              format: [op_v1_4_v2_4_id_16]
839        description: Check correctness of passed arguments. Load parameter to register. Check i64 type of arguments.
840        header-template: []
841        code-template: |
842          .function i32 f1(i64 a0, i64 a1) {
843              mov.64 v1, a0
844              ldai.64 %s
845              cmp.64 v1
846              jeqz f1_l1
847          # 1st arg does not match, exit
848              ldai 1
849              return
850          f1_l1:
851              mov.64 v1, a1
852              ldai.64 %s
853              cmp.64 v1
854              return
855          }
856          .function i32 main() {
857              movi.64 v0, %s
858              movi.64 v1, %s
859              call.short f1, v0, v1
860
861        check-type: no-check
862        cases:
863          - values: ["0", "0", "0", "0"]
864          - values: ["0", "1", "0", "1"]
865          - values: ["1", "0", "1", "0"]
866          - values: ["0x1234567890ABCDEF", "0x234567890ABCDEF1", "0x1234567890ABCDEF", "0x234567890ABCDEF1"]
867          - values: ["0x7FFFFFFFFFFFFFFF", "0", "0x7FFFFFFFFFFFFFFF", "0"]
868          - values: ["0", "0x7FFFFFFFFFFFFFFF", "0", "0x7FFFFFFFFFFFFFFF"]
869          - values: ["0x7FFFFFFFFFFFFFFF", "0x7FFFFFFFFFFFFFFF", "0x7FFFFFFFFFFFFFFF", "0x7FFFFFFFFFFFFFFF"]
870          - values: ["0", "0x8000000000000000", "0", "0x8000000000000000"]
871          - values: ["0x8000000000000000", "0", "0x8000000000000000", "0"]
872          - values: ["0x8000000000000000", "0x8000000000000000", "0x8000000000000000", "0x8000000000000000"]
873          - values: ["0xFEDCBA0987654321", "0xEDCBA0987654321F", "0xFEDCBA0987654321", "0xEDCBA0987654321F"]
874          - values: ["0", "0xFFFFFFFFFFFFFFFF", "0", "0xFFFFFFFFFFFFFFFF"]
875          - values: ["0xFFFFFFFFFFFFFFFF", "0", "0xFFFFFFFFFFFFFFFF", "0"]
876          - values: ["0xFFFFFFFFFFFFFFFF", "0xFFFFFFFFFFFFFFFF", "0xFFFFFFFFFFFFFFFF", "0xFFFFFFFFFFFFFFFF"]
877
878      - file-name: arg_1_obj_acc
879        isa:
880          instructions:
881              - sig: call.short method_id, v1:in:top, v2:in:top
882                acc: out:top
883                format: [op_v1_4_v2_4_id_16]
884        description: Check correctness of passed arguments. Load parameter to accumulator. Check object type of arguments.
885        header-template: [obj_ctor]
886        code-template: |
887          .function Obj fnc(Obj a0) {
888              lda.obj a0
889              return.obj
890          }
891
892          .function i32 main() {
893              %s
894              sta.obj v0
895              ldai 0 # acc is i32
896              call.short fnc, v0 # acc contains returned Obj
897              jne.obj v0, return_ne_num
898              ldai 0
899              return
900          return_ne_num:
901              ldai 1
902              return
903
904        check-type: no-check
905        cases:
906          - values:
907            - "lda.null"
908          - values:
909            - "initobj Obj.ctor"
910
911      - file-name: arg_2_obj_acc
912        isa:
913          instructions:
914              - sig: call.short method_id, v1:in:top, v2:in:top
915                acc: out:top
916                format: [op_v1_4_v2_4_id_16]
917        description: Check correctness of passed arguments. Load parameter to accumulator. Check object type.
918        tags: ['tsan', 'irtoc_ignore']
919        header-template: [obj_ctor]
920        code-template: |
921          .record ObjTuple {
922              Obj o1
923              Obj o2
924          }
925
926          .function void ObjTuple.ctor(ObjTuple a0, Obj a1, Obj a2) <ctor> {
927              lda.obj a1
928              stobj.obj a0, ObjTuple.o1
929              lda.obj a2
930              stobj.obj a0, ObjTuple.o2
931              return.void
932          }
933
934          .function ObjTuple getObjTuple(Obj a0, Obj a1) {
935              mov.obj v0, a0
936              mov.obj v1, a1
937              initobj.short ObjTuple.ctor, v0, v1
938              return.obj
939          }
940
941          .function i32 main() {
942              %s
943              call.short getObjTuple, v0, v1
944              sta.obj v2
945
946              # check ObjTuple.o1 contains correct value (v0)
947              ldobj.obj v2, ObjTuple.o1
948              jeq.obj v0, tuple_2_check
949              ldai 1
950              return
951          tuple_2_check:
952              # check ObjTuple.o2 contains correct value (v1)
953              ldobj.obj v2, ObjTuple.o2
954              jeq.obj v1, tuple_2_check_passed
955              ldai 1
956              return
957          tuple_2_check_passed:
958              ldai 0
959
960        check-type: no-check
961        cases:
962          - values:
963              - |
964                #
965                    mov.null v0
966                    mov.null v1
967          - values:
968              - |
969                #
970                    initobj.short Obj.ctor
971                    sta.obj v0
972                    initobj.short Obj.ctor
973                    sta.obj v1
974          - values:
975              - |
976                #
977                    mov.null v0
978                    initobj Obj.ctor
979                    sta.obj v1
980          - values:
981              - |
982                #
983                    initobj Obj.ctor
984                    sta.obj v0
985                    mov.null v1
986
987      - file-name: arg_2_str_acc
988        isa:
989          instructions:
990              - sig: call.short method_id, v1:in:top, v2:in:top
991                acc: out:top
992                format: [op_v1_4_v2_4_id_16]
993        description: Check correctness of passed arguments. Load parameter to accumulator. Check String type.
994        tags: ['irtoc_ignore']
995        header-template: [panda_string]
996        code-template: |
997          .record ObjTuple {
998              panda.String o1
999              panda.String o2
1000          }
1001
1002          .function void ObjTuple.ctor(ObjTuple a0, panda.String a1, panda.String a2) <ctor> {
1003              lda.obj a1
1004              stobj.obj a0, ObjTuple.o1
1005              lda.obj a2
1006              stobj.obj a0, ObjTuple.o2
1007              return.void
1008          }
1009
1010          .function ObjTuple getObjTuple(panda.String a0, panda.String a1) {
1011              mov.obj v0, a0
1012              mov.obj v1, a1
1013              initobj.short ObjTuple.ctor, v0, v1
1014              return.obj
1015          }
1016
1017          .function i32 main() {
1018              %s
1019              call.short getObjTuple, v0, v1
1020              sta.obj v2
1021
1022              # check ObjTuple.o1 contains correct value (v0)
1023              ldobj.obj v2, ObjTuple.o1
1024              jeq.obj v0, tuple_2_check
1025              ldai 1
1026              return
1027          tuple_2_check:
1028              # check ObjTuple.o2 contains correct value (v1)
1029              ldobj.obj v2, ObjTuple.o2
1030              jeq.obj v1, tuple_2_check_passed
1031              ldai 1
1032              return
1033          tuple_2_check_passed:
1034              ldai 0
1035
1036        check-type: no-check
1037        cases:
1038          - values:
1039              - |
1040                #
1041                    mov.null v0
1042                    mov.null v1
1043          - values:
1044              - |
1045                #
1046                    lda.str "some string 1"
1047                    sta.obj v0
1048                    lda.str "some string 2"
1049                    sta.obj v1
1050          - values:
1051              - |
1052                #
1053                    mov.null v0
1054                    lda.str "some string 2"
1055                    sta.obj v1
1056          - values:
1057              - |
1058                #
1059                    lda.str "some string 1"
1060                    sta.obj v0
1061                    mov.null v1
1062
1063      - file-name: method_id_not_static_p
1064        tags: ['verifier']
1065        runner-options: ['verifier-failure', 'verifier-config']
1066        isa:
1067          instructions:
1068            - sig: call.short method_id, v1:in:top, v2:in:top
1069              acc: out:top
1070              format: [op_v1_4_v2_4_id_16]
1071          verification:
1072            - method_id_static
1073            - method_id_non_abstract
1074        description: Method_id must resolve to a static method in Panda Assembly context. Not static methods should be rejected by verifier.
1075        header-template: []
1076        code-template: |
1077            .record A {}
1078
1079            .function void A.ctor(A a0) <ctor> {
1080                return.void
1081            }
1082
1083            .function i32 A.foo(A a0%s) *s
1084
1085            .function i32 main() {
1086                initobj A.ctor
1087                sta.obj v0
1088                %s
1089                call.short A.foo, v0%s
1090        check-type: exit-positive
1091        cases:
1092            - values:
1093              - |
1094                {
1095                    ldai 0
1096                    return
1097                }
1098              ignore: true
1099              bugid: ['3247']
1100            - values: ['<noimpl>']
1101              ignore: true
1102              bugid: ['3247']
1103            - values:
1104              - |
1105                <static> {
1106                    ldai 0
1107                    return
1108                }
1109              runner-options: ['verifier-only', 'verifier-config']
1110        template-cases:
1111          - values: ['', '##-', '']
1112          - values: [', A a1', 'mov.obj v1, v0', ', v1']
1113
1114      - file-name: method_id_not_static_j
1115        tags: ['verifier', 'pa-verifier']
1116        runner-options: [verifier-failure, use-pa, verifier-config]
1117        isa:
1118          instructions:
1119            - sig: call.short method_id, v1:in:top, v2:in:top
1120              acc: out:top
1121              format: [op_v1_4_v2_4_id_16]
1122          verification:
1123            - method_id_static
1124            - method_id_non_abstract
1125        description: Method_id must resolve to a static method in PandaAssembly context. Not static methods should be rejected by verifier.
1126        header-template: [PandaAssembly]
1127        code-template: |
1128            .record A {}
1129
1130            .function void A.ctor(A a0) <ctor> {
1131                return.void
1132            }
1133
1134            .function i32 A.foo(A a0%s) *s
1135
1136            .function i32 main() {
1137                initobj A.ctor
1138                sta.obj v0
1139                %s
1140                call.short A.foo, v0%s
1141        check-type: exit-positive
1142        cases:
1143            - values:
1144              - |
1145                {
1146                    ldai 0
1147                    return
1148                }
1149              ignore: true
1150              bugid: ['3247']
1151            - values: ['<noimpl>']
1152              ignore: true
1153              bugid: ['3247']
1154            - values:
1155              - |
1156                <static> {
1157                      ldai 0
1158                      return
1159                }
1160              runner-options: [verifier-only, use-pa, verifier-config]
1161        template-cases:
1162          - values: ['', '##-', '']
1163          - values: [', A a1', 'mov.obj v1, v0', ', v1']
1164
1165      - file-name: method_id_not_static_j_2
1166        tags: ['verifier']
1167        bugid: ['3247']
1168        ignore: true
1169        runner-options: [verifier-failure, use-pa, verifier-config]
1170        isa:
1171          instructions:
1172            - sig: call.short method_id, v1:in:top, v2:in:top
1173              acc: out:top
1174              format: [op_v1_4_v2_4_id_16]
1175          verification:
1176            - method_id_static
1177            - method_id_non_abstract
1178        description: Method_id must resolve to a static method.
1179        header-template: []
1180        code-template: |
1181            .language PandaAssembly
1182
1183            .record A {}
1184            .function i32 A.foo(A a0) <noimpl>
1185            %s
1186            .function i32 %s.foo(%s a0) {
1187                ldai 0
1188                return
1189            }
1190
1191            .function i32 main() {
1192                newobj v0, %s
1193                call.short A.foo, v0
1194
1195        check-type: exit-positive
1196        cases:
1197          - values:
1198              - .record B <panda.extends=A> {}
1199              - B
1200              - B
1201              - B
1202
1203          - values:
1204              - |
1205                .record B <panda.extends=A> {}
1206                .record C <panda.extends=B> {}
1207              - C
1208              - C
1209              - C
1210
1211          - values:
1212              - |
1213                #
1214                .record B <panda.extends=A> {}
1215                .record C <panda.extends=B> {}
1216                .record D <panda.extends=C> {}
1217                .record E <panda.extends=D> {}
1218                .record F <panda.extends=E> {}
1219              - F
1220              - F
1221              - F
1222
1223      - file-name: method_id_abstract
1224        isa:
1225          instructions:
1226            - sig: call.short method_id, v1:in:top, v2:in:top
1227              acc: out:top
1228              format: [op_v1_4_v2_4_id_16]
1229          verification:
1230            - method_id_static
1231            - method_id_non_abstract
1232        description: Check verifier behavior when 'call.short' is used with abstract method.
1233        header-template: []
1234        runner-options: [use-pa]
1235        code-template: |
1236            .language PandaAssembly
1237
1238            .record A {}
1239            .function i32 A.foo(A a0) <noimpl>
1240
1241            %s
1242
1243            .function i32 main() {
1244                call.short %s.foo, v0
1245        check-type: exit-positive
1246        cases:
1247          - values:
1248              - ''
1249              - A
1250            runner-options: [verifier-failure, use-pa, verifier-config]
1251            tags: ['verifier', 'pa-verifier']
1252            bugid: ['3293', '5271']
1253          - values:
1254              - .record B <panda.extends=A> {}
1255              - B
1256            runner-options: [compile-failure]
1257
1258          - values:
1259              - |
1260                #
1261                .record B <panda.extends=A> {}
1262                .record C <panda.extends=B> {}
1263                .record D <panda.extends=C> {}
1264                .record E <panda.extends=D> {}
1265                .record F <panda.extends=E> {}
1266              - F
1267            runner-options: [compile-failure]
1268
1269      - file-name: amount_of_args
1270        isa:
1271          instructions:
1272              - sig: call.short method_id, v1:in:top, v2:in:top
1273                acc: out:top
1274                format: [op_v1_4_v2_4_id_16]
1275        header-template: []
1276        description: Compiler should check amount of `call.short` argument and function parameters.
1277        code-template: |
1278            .function void f1(i32 a0%s) {
1279                return.void
1280            }
1281            .function i32 main() {
1282                call.short f1%s
1283        check-type: none
1284        runner-options: [compile-failure]
1285        cases:
1286            - values: ['', '']
1287            - values: [', i32 a1', '']
1288            - values: [', i32 a1', ', v0']
1289            - values: [', i32 a1, i32 a2', '']
1290            - values: [', i32 a1, i32 a2', ', v0']
1291            - values: [', i32 a1, i32 a2', ', v0, v0']
1292            - values: [', i32 a1, i32 a2', ', v0, v0, v0']
1293
1294      - file-name: unused_regs
1295        isa:
1296          description: >
1297            Non-range instructions can be used to pass up to 4 arguments (unused register slot values will
1298            be discarded and corresponding registers will not be passed to the callee).
1299        header-template: []
1300        description: Verifier should ignore unused register slots.
1301        code-template: |
1302            .function i32 foo(%s) {
1303                ldai 0
1304                return
1305            }
1306            .function i32 main() {
1307                %s
1308                call.short foo%s
1309        check-type: no-check
1310        cases:
1311          - values:
1312            - ""
1313            - ""
1314            - ", v5"
1315          - values:
1316            - "i64 a0"
1317            - |
1318              #
1319                  movi.64 v5, 123456789
1320            - ", v5, v9"
1321