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  - name: aoobe_p
19    template: |
20      .record panda.ArrayIndexOutOfBoundsException<external>
21  - name: aoobe_j
22    template: |
23      .record panda.ArrayIndexOutOfBoundsException<external>
24  - name: npe_p
25    template: |
26      .record panda.NullPointerException <external>
27  - name: npe_j
28    template: |
29      .record panda.NullPointerException <external>
30
31tests:
32  - file-name: "starr"
33    isa:
34      title: Store to array
35      description: >
36        Store accumulator content into array slot pointed by index.
37      instructions:
38        - sig: starr v1:in:i32[], v2:in:i32
39          acc: in:i32
40          format: [op_v1_4_v2_4]
41    commands:
42
43
44      - file-name: "reg_valid"
45        isa:
46          instructions:
47            - sig: starr v1:in:i32[], v2:in:i32
48              acc: in:i32
49              format: [op_v1_4_v2_4]
50        check-type: empty
51        runner-options: [compile-only]
52        description: Check 'starr' instruction with valid register numbers.
53        header-template: []
54        code-template: |
55          #
56          .function i32 main() {
57              starr %s, %s
58              ldai 0
59              return
60          }
61        cases:
62          - values: [v0, v15]
63          - values: [v15, v0]
64          - values: [v15, v15]
65          - case-template: |
66              #
67              .function i32 f1(i32[] a0, i32 a1) {
68                  starr a0, a1   # valid registers
69                  ldai 0
70                  return
71              }
72
73              .function i32 main() {
74                  call.short f1, v1, v2
75                  return
76              }
77
78
79      - file-name: "reg_v_invalid"
80        isa:
81          instructions:
82            - sig: starr v1:in:i32[], v2:in:i32
83              acc: in:i32
84              format: [op_v1_4_v2_4]
85        runner-options: [compile-failure]
86        description: Check 'starr' instruction with invalid register numbers.
87        code-template: |
88          #
89              starr %s, *s
90        check-type: exit-positive
91        template-cases:
92          - values: [v0]
93            exclude: [v0, v15]
94          - values: [v15]
95            exclude: [v0, v15]
96          - values: [v255]
97          - values: [v256]
98          - values: [v65536]
99          - values: [a0]
100          - values: ['V1']
101          - values: ['null']
102          - values: [0]
103        cases:
104          - values: [v0]
105            id: v0
106          - values: [v15]
107            id: v15
108          - values: [v255]
109          - values: [v256]
110          - values: [v65536]
111          - values: [a0]
112          - values: ['V1']
113          - values: ['null']
114          - values: [0]
115
116
117      - file-name: "reg_a_invalid"
118        isa:
119          instructions:
120            - sig: starr v1:in:i32[], v2:in:i32
121              acc: in:i32
122              format: [op_v1_4_v2_4]
123        runner-options: [compile-failure]
124        description: Check 'starr' instruction with invalid register numbers.
125        header-template: []
126        code-template: |
127              #
128              .function void f1(i32[] a0, i32 a1) {
129                  starr %s
130                  return.void
131              }
132
133              .function i32 main() {
134                  call.short f1, v1, v2
135        check-type: exit-positive
136        cases:
137          - values:
138            - 'a0, a2'
139          - values:
140            - 'a2, a1'
141
142
143      - file-name: null_pointer_p
144        isa:
145          exceptions:
146            - x_null
147        description: Check 'starr' behavior when array is null reference.
148        header-template: [npe_p]
149        tags: ['irtoc_ignore']
150        code-template: |
151          .function i32[] get_null() {
152              lda.null
153              return.obj
154          }
155          .function i32 main() {
156              call.short get_null
157              sta.obj v0
158              movi v1, %s
159              ldai 0
160          begin:
161              starr v0, v1
162          end:
163              ldai 1 # Should not reach this line
164              return
165
166          catch_NPE:
167              ldai 0 # Expected panda.NullPointerException
168              return
169
170          catch_all:
171              ldai 2 # Unexpected exception, test failed
172              return
173
174          .catch panda.NullPointerException, begin, end, catch_NPE
175          .catchall begin, end, catch_all
176        check-type: none
177        cases:
178          - values: [0]
179            tags: ['tsan']
180          - values: [1]
181          - values: [10]
182          - values: [128]
183          - values: [255]
184          - values: [65535]
185            tags: ['tsan']
186          - values: [0x7FFFFFFF]
187          - values: [0xFFFFFFFF]
188          - values: [0x80000000]
189
190
191      - file-name: null_pointer_j
192        isa:
193          exceptions:
194            - x_null
195        description: Check 'starr' behavior when array is null reference.
196        header-template: [PandaAssembly, npe_j]
197        runner-options: [use-pa]
198        tags: ['irtoc_ignore']
199        bugid: ['3047']
200        code-template: |
201          .function i32[] get_null() {
202              lda.null
203              return.obj
204          }
205          .function i32 main() {
206              call.short get_null
207              sta.obj v0
208              movi v1, %s
209              ldai 0
210          begin:
211              starr v0, v1
212          end:
213              ldai 1 # Should not reach this line
214              return
215
216          catch_NPE:
217              ldai 0 # Expected panda.NullPointerException
218              return
219
220          catch_all:
221              ldai 2 # Unexpected exception, test failed
222              return
223
224          .catch panda.NullPointerException, begin, end, catch_NPE
225          .catchall begin, end, catch_all
226        check-type: none
227        cases:
228          - values: [0]
229            tags: ['tsan']
230          - values: [1]
231          - values: [10]
232          - values: [128]
233          - values: [255]
234          - values: [65535]
235            tags: ['tsan']
236          - values: [0x7FFFFFFF]
237          - values: [0xFFFFFFFF]
238          - values: [0x80000000]
239
240
241      - file-name: array_out_of_bounds_exception_p
242        isa:
243          exceptions:
244            - x_bounds
245        description: Check 'starr' behavior when index is out of array bounds.
246        header-template: [aoobe_p, main]
247        tags: ['irtoc_ignore']
248        code-template: |
249          #
250              movi v0, *s
251              newarr v0, v0, %s
252              movi v1, *s
253              ldai 0
254          begin:
255              starr v0, v1
256          end:
257              ldai 1 # Should not reach this line
258              return
259
260          catch_AOOBE:
261              ldai 0 # Expected panda.ArrayIndexOutOfBoundsException
262              return
263
264          catch_all:
265              ldai 2 # Unexpected exception, test failed
266              return
267
268          .catch panda.ArrayIndexOutOfBoundsException, begin, end, catch_AOOBE
269          .catchall begin, end, catch_all
270        check-type: none
271        template-cases:
272            - values: ['u32[]']
273            - values: ['i32[]']
274        cases:
275          - values: [0, 0]
276            tags: ['tsan']
277          - values: [0, 1]
278          - values: [10, -10]
279          - values: [10, 128]
280          - values: [255, 255]
281          - values: [254, 255]
282          - values: [65535, 65535]
283            tags: ['tsan']
284          - values: [65535, 65536]
285          - values: [10, 0xFFFFFFFF]
286          - values: [256, 0xFFFFFFFE]
287          - values: [65536, 0xFFFFFFFD]
288            tags: ['tsan']
289          - values: [0x100000, 0xFFFFFFFC]
290          - values: [10, 0x80000000]
291          - values: [256, 0x80000001]
292          - values: [65536, 0x80000002]
293            tags: ['tsan']
294          - values: [0x100000, 0x80000003]
295
296
297      - file-name: array_out_of_bounds_exception_j
298        isa:
299          exceptions:
300            - x_bounds
301        description: Check 'starr' behavior when index is out of array bounds.
302        runner-options: [use-pa]
303        tags: ['irtoc_ignore']
304        header-template: [PandaAssembly, aoobe_j, main]
305        code-template: |
306          #
307              movi v0, %s
308              newarr v0, v0, i32[]
309              movi v1, %s
310              ldai 0
311          begin:
312              starr v0, v1
313          end:
314              ldai 1 # Should not reach this line
315              return
316
317          catch_AOOBE:
318              ldai 0 # Expected panda.ArrayIndexOutOfBoundsException
319              return
320
321          catch_all:
322              ldai 2 # Unexpected exception, test failed
323              return
324
325          .catch panda.ArrayIndexOutOfBoundsException, begin, end, catch_AOOBE
326          .catchall begin, end, catch_all
327        check-type: none
328        cases:
329          - values: [0, 0]
330            tags: ['tsan']
331          - values: [0, 1]
332          - values: [10, -10]
333          - values: [10, 128]
334          - values: [255, 255]
335          - values: [254, 255]
336          - values: [65535, 65535]
337            tags: ['tsan']
338          - values: [65535, 65536]
339          - values: [10, 0xFFFFFFFF]
340          - values: [256, 0xFFFFFFFE]
341          - values: [65536, 0xFFFFFFFD]
342            tags: ['tsan']
343          - values: [0x100000, 0xFFFFFFFC]
344          - values: [10, 0x80000000]
345          - values: [256, 0x80000001]
346          - values: [65536, 0x80000002]
347            tags: ['tsan']
348          - values: [0x100000, 0x80000003]
349
350
351      - file-name: uninitialized_regs
352        isa:
353          verification:
354            - v1_array_type
355            - v2_i32
356            - acc_type
357        description: Check 'starr' with uninitialized registers
358        tags: ['verifier']
359        runner-options: ['verifier-failure', 'verifier-config']
360        header-template: []
361        code-template: |
362            #
363            .function i32 main() {
364                %s
365                starr v1, v2
366        check-type: exit-positive
367        cases:
368          - values:
369              - |
370                # acc is not initialized
371                    movi v0, 10
372                    newarr v1, v0, i32[]
373                    movi v2, 0
374          - values:
375              - |
376                # v1 is not initialized
377                    movi v2, 0
378                    ldai 0
379          - values:
380              - |
381                # v2 is not initialized
382                    movi v0, 10
383                    newarr v1, v0, i32[]
384                    ldai 0
385          - values:
386              - |
387                # all regs are not initialized
388
389
390      - file-name: "acceptable_primitive_types_p"
391        isa:
392          verification:
393            - v1_array_type
394        description: Check acceptable array of primitive types for starr instruction in Panda Assembly context.
395        runner-options: ['verifier-only', 'verifier-config']
396        tags: ['verifier']
397        header-template: [main]
398        code-template: |
399          #
400              movi v0, 1
401              newarr v1, v0, %s
402              movi v2, 0
403              ldai 0
404              starr v1, v2
405        check-type: exit-positive
406        cases:
407          - values: ['u32[]']
408          - values: ['i32[]']
409
410
411      - file-name: "acceptable_primitive_types_j"
412        isa:
413          verification:
414            - v1_array_type
415        description: Check acceptable array of primitive types for starr instruction in PandaAssembly context.
416        runner-options: [verifier-only, use-pa, verifier-config]
417        tags: [verifier, pa-verifier]
418        header-template: [PandaAssembly, main]
419        code-template: |
420          #
421              movi v0, 1
422              newarr v1, v0, %s
423              movi v2, 0
424              ldai 0
425              starr v1, v2
426        check-type: exit-positive
427        cases:
428          - values: ['i32[]']
429
430
431      - file-name: "rejectable_primitive_types_p"
432        isa:
433          verification:
434            - v1_array_type
435        description: Check rejectable array of primitive types for starr instruction in Panda Assembly context.
436        runner-options: ['verifier-failure', 'verifier-config']
437        tags: ['verifier']
438        header-template: [main]
439        code-template: |
440          #
441              movi v0, 1
442              newarr v1, v0, %s
443              movi v2, 0
444              ldai 0
445              starr v1, v2
446        check-type: exit-positive
447        cases:
448          - values: ['u1[]']
449          - values: ['i8[]']
450          - values: ['u8[]']
451          - values: ['i16[]']
452          - values: ['u16[]']
453          - values: ['i64[]']
454          - values: ['u64[]']
455          - values: ['f32[]']
456          - values: ['f64[]']
457
458
459      - file-name: "rejectable_primitive_types_j"
460        isa:
461          verification:
462            - v1_array_type
463        description: Check rejectable array of primitive types for starr instruction in PandaAssembly context.
464        runner-options: [verifier-failure, use-pa, verifier-config]
465        tags: [verifier, pa-verifier]
466        bugid: ['3293', '5271']
467        header-template: [PandaAssembly, main]
468        code-template: |
469          #
470              movi v0, 1
471              newarr v1, v0, %s
472              movi v2, 0
473              ldai 0
474              starr v1, v2
475        check-type: exit-positive
476        cases:
477          - values: ['u1[]']
478          - values: ['i8[]']
479          - values: ['u8[]']
480          - values: ['i16[]']
481          - values: ['u16[]']
482          - values: ['u32[]']
483          - values: ['i64[]']
484          - values: ['u64[]']
485          - values: ['f32[]']
486          - values: ['f64[]']
487
488
489      - file-name: "arr_type_p"
490        isa:
491          verification:
492            - v1_array_type
493        description: Check 'starr' with incorrect array type in Panda Assembly context. See also "rejectable_primitive_types" tests.
494        runner-options: ['verifier-failure', 'verifier-config']
495        tags: ['verifier']
496        header-template: []
497        code-template: |
498          #
499          .record A {}
500          .function void A.ctor(A a0) <ctor> {
501              return.void
502          }
503          .record panda.String <external>
504          .record panda.Object <external>
505          .function i32 main() {
506              %s
507              movi v1, 0
508              ldai 0
509              starr v0, v1
510        check-type: exit-positive
511        cases:
512          - values:
513              - movi v0, 0
514          - values:
515              - movi.64 v0, 0
516          - values:
517              - fmovi v0, 0
518          - values:
519              - fmovi.64 v0, 0
520          - values:
521              - |
522                #
523                    initobj A.ctor
524                    sta.obj v0
525          - values:
526              - |
527                #
528                    movi v0, 1
529                    newarr v0, v0, A[]
530          - values:
531              - |
532                #
533                    lda.type A
534                    sta.obj v0
535          - values:
536              - |
537                #
538                    lda.type A[]
539                    sta.obj v0
540          - values:
541              - |
542                #
543                    lda.type panda.String
544                    sta.obj v0
545          - values:
546              - |
547                #
548                    lda.type panda.String[]
549                    sta.obj v0
550          - values:
551              - |
552                #
553                    lda.type panda.Object
554                    sta.obj v0
555          - values:
556              - |
557                #
558                    lda.type panda.Object[]
559                    sta.obj v0
560          - values:
561              - |
562                #
563                    lda.str "string"
564                    sta.obj v0
565          - values:
566              - |
567                #
568                    movi v0, 1
569                    newarr v0, v0, panda.Object[]
570          - values:
571              - |
572                #
573                    movi v0, 1
574                    newarr v0, v0, panda.String[]
575
576
577      - file-name: "arr_type_j"
578        isa:
579          verification:
580            - v1_array_type
581        description: Check 'starr' with incorrect array type in PandaAssembly context. See also "rejectable_primitive_types" tests.
582        runner-options: [verifier-failure, use-pa, verifier-config]
583        tags: [verifier, pa-verifier]
584        bugid: ['3293', '5271']
585        header-template: [PandaAssembly]
586        code-template: |
587          #
588          .record A {}
589          .function void A.ctor(A a0) <ctor> {
590              return.void
591          }
592          .record panda.Object <external>
593          .function void panda.Object.ctor(panda.Object a0) <external,ctor>
594          .function i32 main() {
595              %s
596              movi v1, 0
597              ldai 0
598              starr v0, v1
599        check-type: exit-positive
600        cases:
601          - values:
602              - movi v0, 0
603          - values:
604              - movi.64 v0, 0
605          - values:
606              - fmovi v0, 0
607          - values:
608              - fmovi.64 v0, 0
609          - values:
610              - |
611                #
612                    initobj A.ctor
613                    sta.obj v0
614          - values:
615              - |
616                #
617                    movi v0, 1
618                    newarr v0, v0, A[]
619          - values:
620              - |
621                #
622                    initobj panda.Object.ctor
623                    sta.obj v0
624          - values:
625              - |
626                #
627                    movi v0, 1
628                    newarr v0, v0, panda.Object[]
629          - values:
630              - |
631                #
632                    lda.type A
633                    sta.obj v0
634          - values:
635              - |
636                #
637                    lda.type A[]
638                    sta.obj v0
639          - values:
640              - |
641                #
642                    lda.type panda.Object
643                    sta.obj v0
644          - values:
645              - |
646                #
647                    lda.type panda.Object[]
648                    sta.obj v0
649          - values:
650              - |
651                #
652                    lda.str "string"
653                    sta.obj v0
654
655
656      - file-name: "index_type_p"
657        isa:
658          verification:
659            - v2_i32
660        description: Check 'starr' with incorrect array index type in Panda Assembly context.
661        runner-options: ['verifier-failure', 'verifier-config']
662        tags: ['verifier']
663        header-template: []
664        code-template: |
665          #
666          .record A {}
667          .function void A.ctor(A a0) <ctor> {
668              return.void
669          }
670          .record panda.String <external>
671          .record panda.Object <external>
672          .function i32 main() {
673              movi v0, 1
674              newarr v1, v0, *s
675              %s
676              ldai 0
677              starr v1, v2
678        check-type: exit-positive
679        cases:
680          - values: ['u32[]']
681          - values: ['i32[]']
682        template-cases:
683          - values:
684              - mov.null v2
685          - values:
686              - movi.64 v2, 0
687          - values:
688              - fmovi v2, 0
689          - values:
690              - fmovi.64 v2, 0
691          - values:
692              - |
693                #
694                    initobj A.ctor
695                    sta.obj v1
696          - values:
697              - |
698                #
699                    movi v0, 1
700                    newarr v2, v0, A[]
701          - values:
702              - |
703                #
704                    lda.type A
705                    sta.obj v2
706          - values:
707              - |
708                #
709                    lda.type A[]
710                    sta.obj v2
711          - values:
712              - |
713                #
714                    lda.type panda.String
715                    sta.obj v2
716          - values:
717              - |
718                #
719                    lda.type panda.String[]
720                    sta.obj v2
721          - values:
722              - |
723                #
724                    lda.type panda.Object
725                    sta.obj v2
726          - values:
727              - |
728                #
729                    lda.type panda.Object[]
730                    sta.obj v2
731          - values:
732              - |
733                #
734                    lda.str "string"
735                    sta.obj v2
736          - values:
737              - |
738                #
739                    movi v0, 1
740                    newarr v2, v0, panda.Object[]
741          - values:
742              - |
743                #
744                    movi v0, 1
745                    newarr v2, v0, panda.String[]
746
747
748      - file-name: "index_type_j"
749        isa:
750          verification:
751            - v2_i32
752        description: Check 'starr' with incorrect array index type in PandaAssembly context.
753        runner-options: [verifier-failure, use-pa, verifier-config]
754        tags: [verifier, pa-verifier]
755        bugid: ['3293', '5271']
756        header-template: [PandaAssembly]
757        code-template: |
758          #
759          .record A {}
760          .function void A.ctor(A a0) <ctor> {
761              return.void
762          }
763          .record panda.Object <external>
764          .function void panda.Object.ctor(panda.Object a0) <external,ctor>
765          .function i32 main() {
766              movi v0, 1
767              newarr v1, v0, *s
768              %s
769              ldai 0
770              starr v1, v2
771        check-type: exit-positive
772        cases:
773          - values: ['i32[]']
774        template-cases:
775          - values:
776              - mov.null v2
777          - values:
778              - movi.64 v2, 0
779          - values:
780              - fmovi v2, 0
781          - values:
782              - fmovi.64 v2, 0
783          - values:
784              - |
785                #
786                    initobj A.ctor
787                    sta.obj v2
788          - values:
789              - |
790                #
791                    movi v0, 1
792                    newarr v2, v0, A[]
793          - values:
794              - |
795                #
796                    initobj panda.Object.ctor
797                    sta.obj v2
798          - values:
799              - |
800                #
801                    movi v0, 1
802                    newarr v2, v0, panda.Object[]
803          - values:
804              - |
805                #
806                    lda.type A
807                    sta.obj v2
808          - values:
809              - |
810                #
811                    lda.type A[]
812                    sta.obj v2
813          - values:
814              - |
815                #
816                    lda.type panda.Object
817                    sta.obj v2
818          - values:
819              - |
820                #
821                    lda.type panda.Object[]
822                    sta.obj v2
823          - values:
824              - |
825                #
826                    lda.str "string"
827                    sta.obj v2
828
829
830      - file-name: "acc_type_p"
831        isa:
832          verification:
833            - acc_type
834        description: Check 'starr' with incorrect accumulator type in Panda Assembly context.
835        runner-options: ['verifier-failure', 'verifier-config']
836        tags: ['verifier']
837        header-template: []
838        code-template: |
839          #
840          .record A {}
841          .function void A.ctor(A a0) <ctor> {
842              return.void
843          }
844          .record panda.String <external>
845          .record panda.Object <external>
846          .function i32 main() {
847              movi v0, 1
848              newarr v1, v0, *s
849              movi v2, 0
850              %s
851              starr v1, v2
852        check-type: exit-positive
853        cases:
854          - values: ['u32[]']
855          - values: ['i32[]']
856        template-cases:
857          - values:
858              - lda.null
859          - values:
860              - ldai.64 0
861          - values:
862              - fldai 0
863          - values:
864              - fldai.64 0
865          - values:
866              - |
867                #
868                    initobj A.ctor
869          - values:
870              - |
871                #
872                    lda.type A
873          - values:
874              - |
875                #
876                    lda.type panda.String
877          - values:
878              - |
879                #
880                    lda.type panda.String[]
881          - values:
882              - |
883                #
884                    lda.type panda.Object
885          - values:
886              - |
887                #
888                    lda.type panda.Object[]
889          - values:
890              - |
891                #
892                    lda.str "string"
893          - values:
894              - |
895                #
896                    movi v0, 1
897                    newarr v0, v0, panda.Object[]
898                    lda.obj v0
899          - values:
900              - |
901                #
902                    movi v0, 1
903                    newarr v0, v0, panda.String[]
904                    lda.obj v0
905
906
907      - file-name: "acc_type_j"
908        isa:
909          verification:
910            - acc_type
911        description: Check 'starr' with incorrect accumulator type in PandaAssembly context.
912        runner-options: [verifier-failure, use-pa, verifier-config]
913        tags: [verifier, pa-verifier]
914        bugid: ['3293', '5271']
915        header-template: [PandaAssembly]
916        code-template: |
917          #
918          .record A {}
919          .function void A.ctor(A a0) <ctor> {
920              return.void
921          }
922          .record panda.Object <external>
923          .function void panda.Object.ctor(panda.Object a0) <external,ctor>
924          .function i32 main() {
925              movi v0, 1
926              newarr v1, v0, *s
927              movi v2, 0
928              %s
929              starr v1, v2
930        check-type: exit-positive
931        cases:
932          - values: ['i32[]']
933        template-cases:
934          - values:
935              - lda.null
936          - values:
937              - ldai.64 0
938          - values:
939              - fldai 0
940          - values:
941              - fldai.64 0
942          - values:
943              - |
944                #
945                    initobj A.ctor
946          - values:
947              - |
948                #
949                    initobj panda.Object.ctor
950          - values:
951              - |
952                #
953                    lda.type A
954          - values:
955              - |
956                #
957                    lda.type A[]
958          - values:
959              - |
960                #
961                    lda.type panda.Object
962          - values:
963              - |
964                #
965                    lda.type panda.Object[]
966          - values:
967              - |
968                #
969                    lda.str "string"
970          - values:
971              - |
972                #
973                    movi v0, 1
974                    newarr v0, v0, panda.Object[]
975                    lda.obj v0
976          - values:
977              - |
978                #
979                    movi v0, 1
980                    newarr v0, v0, A[]
981                    lda.obj v0
982
983
984      - file-name: "mult_regs_types_p"
985        isa:
986          verification:
987            - v1_array_type
988            - v2_i32
989            - acc_type
990        description: Check 'starr' with multiple incorrect register types in Panda Assembly context.
991        runner-options: ['verifier-failure', 'verifier-config']
992        tags: ['verifier']
993        header-template: []
994        code-template: |
995          #
996          .record A {}
997          .function void A.ctor(A a0) <ctor> {
998              return.void
999          }
1000          .record panda.String <external>
1001          .record panda.Object <external>
1002          .function void panda.Object.ctor(panda.Object a0) <external,ctor>
1003          .function i32 main() {
1004              %s
1005              starr v1, v2
1006        check-type: exit-positive
1007        cases:
1008          - values:
1009              - |
1010                # all registers invalid
1011                    initobj panda.Object.ctor
1012                    sta.obj v1
1013                    movi.64 v2, 0
1014                    lda.str "test string"
1015          - values:
1016              - |
1017                # v1 and v2 invalid
1018                    lda.str "test string"
1019                    sta.obj v1
1020                    fmovi.64 v2, 1
1021                    ldai 0
1022          - values:
1023              - |
1024                # v1 and acc invalid
1025                    lda.type panda.Object
1026                    sta.obj v1
1027                    movi v2, 0
1028                    lda.str "test string"
1029          - values:
1030              - |
1031                # v2 and acc invalid
1032                    movi v0, 1
1033                    newarr v1, v0, i32[]
1034                    sta.obj v2
1035                    initobj A.ctor
1036
1037
1038      - file-name: "mult_regs_types_j"
1039        isa:
1040          verification:
1041            - v1_array_type
1042            - v2_i32
1043            - acc_type
1044        description: Check 'starr' with multiple incorrect register types in PandaAssembly context.
1045        runner-options: [verifier-failure, use-pa, verifier-config]
1046        tags: [verifier, pa-verifier]
1047        bugid: ['3293', '5271']
1048        header-template: [PandaAssembly]
1049        code-template: |
1050          #
1051          .record A {}
1052          .function void A.ctor(A a0) <ctor> {
1053              return.void
1054          }
1055          .record panda.Object <external>
1056          .function void panda.Object.ctor(panda.Object a0) <external,ctor>
1057          .function i32 main() {
1058              %s
1059              starr v1, v2
1060        check-type: exit-positive
1061        cases:
1062          - values:
1063              - |
1064                # all registers invalid
1065                    initobj panda.Object.ctor
1066                    sta.obj v1
1067                    movi.64 v2, 0
1068                    lda.str "test string"
1069          - values:
1070              - |
1071                # v1 and v2 invalid
1072                    lda.str "test string"
1073                    sta.obj v1
1074                    fmovi.64 v2, 1
1075                    ldai 0
1076          - values:
1077              - |
1078                # v1 and acc invalid
1079                    lda.type panda.Object
1080                    sta.obj v1
1081                    movi v2, 0
1082                    lda.str "test string"
1083          - values:
1084              - |
1085                # v2 and acc invalid
1086                    movi v0, 1
1087                    newarr v1, v0, i32[]
1088                    sta.obj v2
1089                    initobj A.ctor
1090
1091
1092      - file-name: "store_arr_p"
1093        isa:
1094          instructions:
1095            - sig: starr v1:in:i32[], v2:in:i32
1096              acc: in:i32
1097              format: [op_v1_4_v2_4]
1098        description: Check starr stores items to array of different size and type in Panda Assembly context.
1099        code-template: |
1100          #
1101              movi v0, *s
1102              newarr v1, v0, %s
1103              movi v2, *s
1104              ldai 1234567
1105              starr v1, v2
1106        check-type: exit-positive
1107        template-cases:
1108          - values: ['u32[]']
1109          - values: ['i32[]']
1110        cases:
1111          - values: ['1', '0']
1112          - values: ['255', '254']
1113            tags: ['tsan']
1114          - values: ['65536', '65535']
1115
1116
1117      - file-name: "store_arr_j"
1118        isa:
1119          instructions:
1120            - sig: starr v1:in:i32[], v2:in:i32
1121              acc: in:i32
1122              format: [op_v1_4_v2_4]
1123        description: Check starr stores items to array of different size and type in PandaAssembly context.
1124        runner-options: ['use-pa']
1125        header-template: [PandaAssembly, main]
1126        code-template: |
1127          #
1128              movi v0, *s
1129              newarr v1, v0, %s
1130              movi v2, *s
1131              ldai 1234567
1132              starr v1, v2
1133        check-type: exit-positive
1134        template-cases:
1135          - values: ['i32[]']
1136        cases:
1137          - values: ['1', '0']
1138          - values: ['255', '254']
1139          - values: ['65536', '65535']
1140            tags: ['tsan']
1141
1142
1143      - file-name: "store_all_elements"
1144        isa:
1145          description: >
1146            Store accumulator content into array slot pointed by index.
1147        description: Check starr stores correct items into array of primitives.
1148        header-template: []
1149        code-template: |
1150            .function i32 main() {
1151                movi v7, *s         # v7 is array size
1152                newarr v1, v7, %s          # v1 - testable array
1153
1154                movi v2, 0          # array index
1155            fill_array:
1156                lda v2
1157                starr v1, v2        # v1[v2] = acc
1158                inci v2, 1          # v2 = v2 + 1
1159                lda v2
1160                jne v7, fill_array
1161                inci v2, -1
1162            check_array:
1163                lda v2
1164                ldarr v1
1165                jeq v2, ok
1166                ldai 2
1167                return
1168            ok:
1169                inci v2, -1
1170                lda v2
1171                jgez check_array
1172        check-type: exit-positive
1173        template-cases:
1174          - values:
1175            - i32[]
1176            tags: ['tsan']
1177          - values:
1178            - u32[]
1179        cases:
1180          - values: [10000]
1181