• 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  - 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.16"
33    isa:
34      title: Store to array
35      description: >
36        Store accumulator content into array slot pointed by index.
37        If size of element to store is less than 32, accumulator content will be truncated
38        to storage size before storing.
39      instructions:
40        - sig: starr.16 v1:in:i16[], v2:in:i32
41          acc: in:i16
42          format: [op_v1_4_v2_4]
43    commands:
44
45
46      - file-name: "reg_valid"
47        isa:
48          instructions:
49            - sig: starr.16 v1:in:i16[], v2:in:i32
50              acc: in:i16
51              format: [op_v1_4_v2_4]
52        check-type: empty
53        runner-options: [compile-only]
54        description: Check 'starr.16' instruction with valid register numbers.
55        header-template: []
56        code-template: |
57          #
58          .function i32 main() {
59              starr.16 %s, %s
60              ldai 0
61              return
62          }
63        cases:
64          - values: [v0, v15]
65          - values: [v15, v0]
66          - values: [v15, v15]
67          - case-template: |
68              #
69              .function i32 f1(i16[] a0, i32 a1) {
70                  starr.16 a0, a1   # valid registers
71                  ldai 0
72                  return
73              }
74
75              .function i32 main() {
76                  call.short f1, v1, v2
77                  return
78              }
79
80
81      - file-name: "reg_v_invalid"
82        isa:
83          instructions:
84            - sig: starr.16 v1:in:i16[], v2:in:i32
85              acc: in:i16
86              format: [op_v1_4_v2_4]
87        runner-options: [compile-failure]
88        description: Check 'starr.16' instruction with invalid register numbers.
89        code-template: |
90          #
91              starr.16 %s, *s
92        check-type: exit-positive
93        template-cases:
94          - values: [v0]
95            exclude: [v0, v15]
96          - values: [v15]
97            exclude: [v0, v15]
98          - values: [v255]
99          - values: [v256]
100          - values: [v65536]
101          - values: [a0]
102          - values: ['V1']
103          - values: ['null']
104          - values: [0]
105        cases:
106          - values: [v0]
107            id: v0
108          - values: [v15]
109            id: v15
110          - values: [v255]
111          - values: [v256]
112          - values: [v65536]
113          - values: [a0]
114          - values: ['V1']
115          - values: ['null']
116          - values: [0]
117
118
119      - file-name: "reg_a_invalid"
120        isa:
121          instructions:
122            - sig: starr.16 v1:in:i16[], v2:in:i32
123              acc: in:i16
124              format: [op_v1_4_v2_4]
125        runner-options: [compile-failure]
126        description: Check 'starr.16' instruction with invalid register numbers.
127        header-template: []
128        code-template: |
129              #
130              .function void f1(i16[] a0, i32 a1) {
131                  starr.16 %s
132                  return.void
133              }
134
135              .function i32 main() {
136                  call.short f1, v1, v2
137        check-type: exit-positive
138        cases:
139          - values:
140            - 'a0, a2'
141          - values:
142            - 'a2, a1'
143
144
145      - file-name: null_pointer_p
146        isa:
147          exceptions:
148            - x_null
149        description: Check 'starr.16' behavior when array is null reference.
150        tags: ['irtoc_ignore']
151        header-template: [npe_p]
152        code-template: |
153          .function i16[] get_null() {
154              lda.null
155              return.obj
156          }
157          .function i32 main() {
158              call.short get_null
159              sta.obj v0
160              movi v1, %s
161              ldai 0
162          begin:
163              starr.16 v0, v1
164          end:
165              ldai 1 # Should not reach this line
166              return
167
168          catch_NPE:
169              ldai 0 # Expected panda.NullPointerException
170              return
171
172          catch_all:
173              ldai 2 # Unexpected exception, test failed
174              return
175
176          .catch panda.NullPointerException, begin, end, catch_NPE
177          .catchall begin, end, catch_all
178        check-type: none
179        cases:
180          - values: [0]
181            tags: ['tsan']
182          - values: [1]
183          - values: [10]
184          - values: [128]
185          - values: [255]
186          - values: [65535]
187            tags: ['tsan']
188          - values: [0x7FFFFFFF]
189          - values: [0xFFFFFFFF]
190          - values: [0x80000000]
191
192
193      - file-name: null_pointer_j
194        isa:
195          exceptions:
196            - x_null
197        description: Check 'starr.16' behavior when array is null reference.
198        header-template: [PandaAssembly, npe_j]
199        tags: ['irtoc_ignore']
200        runner-options: [use-pa]
201        bugid: ['3047']
202        code-template: |
203          .function i16[] get_null() {
204              lda.null
205              return.obj
206          }
207          .function i32 main() {
208              call.short get_null
209              sta.obj v0
210              movi v1, %s
211              ldai 0
212          begin:
213              starr.16 v0, v1
214          end:
215              ldai 1 # Should not reach this line
216              return
217
218          catch_NPE:
219              ldai 0 # Expected panda.NullPointerException
220              return
221
222          catch_all:
223              ldai 2 # Unexpected exception, test failed
224              return
225
226          .catch panda.NullPointerException, begin, end, catch_NPE
227          .catchall begin, end, catch_all
228        check-type: none
229        cases:
230          - values: [0]
231            tags: ['tsan']
232          - values: [1]
233          - values: [10]
234          - values: [128]
235          - values: [255]
236          - values: [65535]
237            tags: ['tsan']
238          - values: [0x7FFFFFFF]
239          - values: [0xFFFFFFFF]
240          - values: [0x80000000]
241
242
243      - file-name: array_out_of_bounds_exception_p
244        isa:
245          exceptions:
246            - x_bounds
247        description: Check 'starr.16' behavior when index is out of array bounds.
248        header-template: [aoobe_p, main]
249        tags: ['irtoc_ignore']
250        code-template: |
251          #
252              movi v0, %s
253              newarr v0, v0, i16[]
254              movi v1, %s
255              ldai 0
256          begin:
257              starr.16 v0, v1
258          end:
259              ldai 1 # Should not reach this line
260              return
261
262          catch_AOOBE:
263              ldai 0 # Expected panda.ArrayIndexOutOfBoundsException
264              return
265
266          catch_all:
267              ldai 2 # Unexpected exception, test failed
268              return
269
270          .catch panda.ArrayIndexOutOfBoundsException, begin, end, catch_AOOBE
271          .catchall begin, end, catch_all
272        check-type: none
273        cases:
274          - values: [0, 0]
275            tags: ['tsan']
276          - values: [0, 1]
277          - values: [10, -10]
278          - values: [10, 128]
279          - values: [255, 255]
280          - values: [254, 255]
281          - values: [65535, 65535]
282            tags: ['tsan']
283          - values: [65535, 65536]
284          - values: [10, 0xFFFFFFFF]
285          - values: [256, 0xFFFFFFFE]
286          - values: [65536, 0xFFFFFFFD]
287            tags: ['tsan']
288          - values: [0x100000, 0xFFFFFFFC]
289          - values: [10, 0x80000000]
290          - values: [256, 0x80000001]
291          - values: [65536, 0x80000002]
292            tags: ['tsan']
293          - values: [0x100000, 0x80000003]
294
295
296      - file-name: array_out_of_bounds_exception_j
297        isa:
298          exceptions:
299            - x_bounds
300        description: Check 'starr.16' behavior when index is out of array bounds.
301        tags: ['irtoc_ignore']
302        runner-options: [use-pa]
303        header-template: [PandaAssembly, aoobe_j, main]
304        code-template: |
305          #
306              movi v0, %s
307              newarr v0, v0, i16[]
308              movi v1, %s
309              ldai 0
310          begin:
311              starr.16 v0, v1
312          end:
313              ldai 1 # Should not reach this line
314              return
315
316          catch_AOOBE:
317              ldai 0 # Expected panda.ArrayIndexOutOfBoundsException
318              return
319
320          catch_all:
321              ldai 2 # Unexpected exception, test failed
322              return
323
324          .catch panda.ArrayIndexOutOfBoundsException, begin, end, catch_AOOBE
325          .catchall begin, end, catch_all
326        check-type: none
327        cases:
328          - values: [0, 0]
329            tags: ['tsan']
330          - values: [0, 1]
331          - values: [10, -10]
332          - values: [10, 128]
333          - values: [255, 255]
334          - values: [254, 255]
335          - values: [65535, 65535]
336            tags: ['tsan']
337          - values: [65535, 65536]
338          - values: [10, 0xFFFFFFFF]
339          - values: [256, 0xFFFFFFFE]
340          - values: [65536, 0xFFFFFFFD]
341            tags: ['tsan']
342          - values: [0x100000, 0xFFFFFFFC]
343          - values: [10, 0x80000000]
344          - values: [256, 0x80000001]
345          - values: [65536, 0x80000002]
346            tags: ['tsan']
347          - values: [0x100000, 0x80000003]
348
349
350      - file-name: uninitialized_regs
351        isa:
352          verification:
353            - v1_array_type
354            - v2_i32
355            - acc_type
356        description: Check 'starr.16' with uninitialized registers
357        tags: ['verifier']
358        runner-options: ['verifier-failure', 'verifier-config']
359        header-template: []
360        code-template: |
361            #
362            .function i32 main() {
363                %s
364                starr.16 v1, v2
365        check-type: exit-positive
366        cases:
367          - values:
368              - |
369                # acc is not initialized
370                    movi v0, 10
371                    newarr v1, v0, i16[]
372                    movi v2, 0
373          - values:
374              - |
375                # v1 is not initialized
376                    movi v2, 0
377                    ldai 0
378          - values:
379              - |
380                # v2 is not initialized
381                    movi v0, 10
382                    newarr v1, v0, i16[]
383                    ldai 0
384          - values:
385              - |
386                # all regs are not initialized
387
388
389      - file-name: "acceptable_primitive_types_p"
390        isa:
391          verification:
392            - v1_array_type
393        description: Check acceptable array of primitive types for starr.16 instruction in Panda Assembly context.
394        runner-options: ['verifier-only', 'verifier-config']
395        tags: ['verifier']
396        header-template: [main]
397        code-template: |
398          #
399              movi v0, 1
400              newarr v1, v0, %s
401              movi v2, 0
402              ldai 0
403              starr.16 v1, v2
404        check-type: exit-positive
405        cases:
406          - values: ['i16[]']
407          - values: ['u16[]']
408
409
410      - file-name: "acceptable_primitive_types_j"
411        isa:
412          verification:
413            - v1_array_type
414        description: Check acceptable array of primitive types for starr.16 instruction in PandaAssembly context.
415        runner-options: [verifier-only, use-pa, verifier-config]
416        tags: [verifier, pa-verifier]
417        bugid: ['3293']
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.16 v1, v2
426        check-type: exit-positive
427        cases:
428          - values: ['i16[]']
429          - values: ['u16[]']
430
431
432      - file-name: "rejectable_primitive_types_p"
433        isa:
434          verification:
435            - v1_array_type
436        description: Check rejectable array of primitive types for starr.16 instruction in Panda Assembly context.
437        runner-options: ['verifier-failure', 'verifier-config']
438        tags: ['verifier']
439        header-template: [main]
440        code-template: |
441          #
442              movi v0, 1
443              newarr v1, v0, %s
444              movi v2, 0
445              ldai 0
446              starr.16 v1, v2
447        check-type: exit-positive
448        cases:
449          - values: ['u1[]']
450          - values: ['i8[]']
451          - values: ['u8[]']
452          - values: ['i32[]']
453          - values: ['u32[]']
454          - values: ['i64[]']
455          - values: ['u64[]']
456          - values: ['f32[]']
457          - values: ['f64[]']
458
459
460      - file-name: "rejectable_primitive_types_j"
461        isa:
462          verification:
463            - v1_array_type
464        description: Check rejectable array of primitive types for starr.16 instruction in PandaAssembly context.
465        runner-options: [verifier-failure, use-pa, verifier-config]
466        tags: [verifier, pa-verifier]
467        bugid: ['3293', '5271']
468        header-template: [PandaAssembly, main]
469        code-template: |
470          #
471              movi v0, 1
472              newarr v1, v0, %s
473              movi v2, 0
474              ldai 0
475              starr.16 v1, v2
476        check-type: exit-positive
477        cases:
478          - values: ['u1[]']
479          - values: ['i8[]']
480          - values: ['u8[]']
481          - values: ['i32[]']
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.16' 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.16 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.16' 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.16 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.16' 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.16 v1, v2
678        check-type: exit-positive
679        cases:
680          - values: ['u16[]']
681          - values: ['i16[]']
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.16' 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.16 v1, v2
771        check-type: exit-positive
772        cases:
773          - values: ['i16[]']
774          - values: ['u16[]']
775        template-cases:
776          - values:
777              - mov.null v2
778          - values:
779              - movi.64 v2, 0
780          - values:
781              - fmovi v2, 0
782          - values:
783              - fmovi.64 v2, 0
784          - values:
785              - |
786                #
787                    initobj A.ctor
788                    sta.obj v2
789          - values:
790              - |
791                #
792                    movi v0, 1
793                    newarr v2, v0, A[]
794          - values:
795              - |
796                #
797                    initobj panda.Object.ctor
798                    sta.obj v2
799          - values:
800              - |
801                #
802                    movi v0, 1
803                    newarr v2, v0, panda.Object[]
804          - values:
805              - |
806                #
807                    lda.type A
808                    sta.obj v2
809          - values:
810              - |
811                #
812                    lda.type A[]
813                    sta.obj v2
814          - values:
815              - |
816                #
817                    lda.type panda.Object
818                    sta.obj v2
819          - values:
820              - |
821                #
822                    lda.type panda.Object[]
823                    sta.obj v2
824          - values:
825              - |
826                #
827                    lda.str "string"
828                    sta.obj v2
829
830
831      - file-name: "acc_type_p"
832        isa:
833          verification:
834            - acc_type
835        description: Check 'starr.16' with incorrect accumulator type in Panda Assembly context.
836        runner-options: ['verifier-failure', 'verifier-config']
837        tags: ['verifier']
838        header-template: []
839        code-template: |
840          #
841          .record A {}
842          .function void A.ctor(A a0) <ctor> {
843              return.void
844          }
845          .record panda.String <external>
846          .record panda.Object <external>
847          .function i32 main() {
848              movi v0, 1
849              newarr v1, v0, *s
850              movi v2, 0
851              %s
852              starr.16 v1, v2
853        check-type: exit-positive
854        cases:
855          - values: ['u16[]']
856          - values: ['i16[]']
857        template-cases:
858          - values:
859              - lda.null
860          - values:
861              - ldai.64 0
862          - values:
863              - fldai 0
864          - values:
865              - fldai.64 0
866          - values:
867              - |
868                #
869                    initobj A.ctor
870          - values:
871              - |
872                #
873                    lda.type A
874          - values:
875              - |
876                #
877                    lda.type panda.String
878          - values:
879              - |
880                #
881                    lda.type panda.String[]
882          - values:
883              - |
884                #
885                    lda.type panda.Object
886          - values:
887              - |
888                #
889                    lda.type panda.Object[]
890          - values:
891              - |
892                #
893                    lda.str "string"
894          - values:
895              - |
896                #
897                    movi v0, 1
898                    newarr v0, v0, panda.Object[]
899                    lda.obj v0
900          - values:
901              - |
902                #
903                    movi v0, 1
904                    newarr v0, v0, panda.String[]
905                    lda.obj v0
906
907
908      - file-name: "acc_type_j"
909        isa:
910          verification:
911            - acc_type
912        description: Check 'starr.16' with incorrect accumulator type in PandaAssembly context.
913        runner-options: [verifier-failure, use-pa, verifier-config]
914        tags: [verifier, pa-verifier]
915        bugid: ['3293', '5271']
916        header-template: [PandaAssembly]
917        code-template: |
918          #
919          .record A {}
920          .function void A.ctor(A a0) <ctor> {
921              return.void
922          }
923          .record panda.Object <external>
924          .function void panda.Object.ctor(panda.Object a0) <external,ctor>
925          .function i32 main() {
926              movi v0, 1
927              newarr v1, v0, *s
928              movi v2, 0
929              %s
930              starr.16 v1, v2
931        check-type: exit-positive
932        cases:
933          - values: ['i16[]']
934        template-cases:
935          - values:
936              - lda.null
937          - values:
938              - ldai.64 0
939          - values:
940              - fldai 0
941          - values:
942              - fldai.64 0
943          - values:
944              - |
945                #
946                    initobj A.ctor
947          - values:
948              - |
949                #
950                    initobj panda.Object.ctor
951          - values:
952              - |
953                #
954                    lda.type A
955          - values:
956              - |
957                #
958                    lda.type A[]
959          - values:
960              - |
961                #
962                    lda.type panda.Object
963          - values:
964              - |
965                #
966                    lda.type panda.Object[]
967          - values:
968              - |
969                #
970                    lda.str "string"
971          - values:
972              - |
973                #
974                    movi v0, 1
975                    newarr v0, v0, panda.Object[]
976                    lda.obj v0
977          - values:
978              - |
979                #
980                    movi v0, 1
981                    newarr v0, v0, A[]
982                    lda.obj v0
983
984
985      - file-name: "mult_regs_types_p"
986        isa:
987          verification:
988            - v1_array_type
989            - v2_i32
990            - acc_type
991        description: Check 'starr.16' with multiple incorrect register types in Panda Assembly context.
992        runner-options: ['verifier-failure', 'verifier-config']
993        tags: ['verifier']
994        header-template: []
995        code-template: |
996          #
997          .record A {}
998          .function void A.ctor(A a0) <ctor> {
999              return.void
1000          }
1001          .record panda.String <external>
1002          .record panda.Object <external>
1003          .function void panda.Object.ctor(panda.Object a0) <external,ctor>
1004          .function i32 main() {
1005              %s
1006              starr.16 v1, v2
1007        check-type: exit-positive
1008        cases:
1009          - values:
1010              - |
1011                # all registers invalid
1012                    initobj panda.Object.ctor
1013                    sta.obj v1
1014                    movi.64 v2, 0
1015                    lda.str "test string"
1016          - values:
1017              - |
1018                # v1 and v2 invalid
1019                    lda.str "test string"
1020                    sta.obj v1
1021                    fmovi.64 v2, 1
1022                    ldai 0
1023          - values:
1024              - |
1025                # v1 and acc invalid
1026                    lda.type panda.Object
1027                    sta.obj v1
1028                    movi v2, 0
1029                    lda.str "test string"
1030          - values:
1031              - |
1032                # v2 and acc invalid
1033                    movi v0, 1
1034                    newarr v1, v0, i16[]
1035                    sta.obj v2
1036                    initobj A.ctor
1037
1038
1039      - file-name: "mult_regs_types_j"
1040        isa:
1041          verification:
1042            - v1_array_type
1043            - v2_i32
1044            - acc_type
1045        description: Check 'starr.16' with multiple incorrect register types in PandaAssembly context.
1046        runner-options: [verifier-failure, use-pa, verifier-config]
1047        tags: [verifier, pa-verifier]
1048        bugid: ['3293', '5271']
1049        header-template: [PandaAssembly]
1050        code-template: |
1051          #
1052          .record A {}
1053          .function void A.ctor(A a0) <ctor> {
1054              return.void
1055          }
1056          .record panda.Object <external>
1057          .function void panda.Object.ctor(panda.Object a0) <external,ctor>
1058          .function i32 main() {
1059              %s
1060              starr.16 v1, v2
1061        check-type: exit-positive
1062        cases:
1063          - values:
1064              - |
1065                # all registers invalid
1066                    initobj panda.Object.ctor
1067                    sta.obj v1
1068                    movi.64 v2, 0
1069                    lda.str "test string"
1070          - values:
1071              - |
1072                # v1 and v2 invalid
1073                    lda.str "test string"
1074                    sta.obj v1
1075                    fmovi.64 v2, 1
1076                    ldai 0
1077          - values:
1078              - |
1079                # v1 and acc invalid
1080                    lda.type panda.Object
1081                    sta.obj v1
1082                    movi v2, 0
1083                    lda.str "test string"
1084          - values:
1085              - |
1086                # v2 and acc invalid
1087                    movi v0, 1
1088                    newarr v1, v0, i16[]
1089                    sta.obj v2
1090                    initobj A.ctor
1091
1092
1093      - file-name: "store_arr_p"
1094        isa:
1095          instructions:
1096            - sig: starr.16 v1:in:i16[], v2:in:i32
1097              acc: in:i16
1098              format: [op_v1_4_v2_4]
1099        description: Check starr.16 stores items to array of different size and type in Panda Assembly context.
1100        code-template: |
1101          #
1102              movi v0, *s
1103              newarr v1, v0, %s
1104              movi v2, *s
1105              ldai 1234567  # should be truncated
1106              starr.16 v1, v2
1107        check-type: exit-positive
1108        template-cases:
1109          - values: ['u16[]']
1110          - values: ['i16[]']
1111        cases:
1112          - values: ['1', '0']
1113          - values: ['255', '254']
1114            tags: ['tsan']
1115          - values: ['65536', '65535']
1116
1117
1118      - file-name: "store_arr_j"
1119        isa:
1120          instructions:
1121            - sig: starr.16 v1:in:i16[], v2:in:i32
1122              acc: in:i16
1123              format: [op_v1_4_v2_4]
1124        description: Check starr.16 stores items to array of different size and type in PandaAssembly context.
1125        runner-options: ['use-pa']
1126        header-template: [PandaAssembly, main]
1127        code-template: |
1128          #
1129              movi v0, *s
1130              newarr v1, v0, %s
1131              movi v2, *s
1132              ldai 1234567  # should be truncated
1133              starr.16 v1, v2
1134        check-type: exit-positive
1135        template-cases:
1136          - values: ['u16[]']
1137          - values: ['i16[]']
1138        cases:
1139          - values: ['1', '0']
1140          - values: ['255', '254']
1141          - values: ['65536', '65535']
1142            tags: ['tsan']
1143
1144
1145      - file-name: "store_all_elements"
1146        isa:
1147          description: >
1148            Store accumulator content into array slot pointed by index.
1149        description: Check starr.16 stores correct items into array of primitives.
1150        header-template: []
1151        code-template: |
1152            .function i32 main() {
1153                movi v7, *s         # v7 is array size
1154                newarr v1, v7, %s          # v1 - testable array
1155
1156                movi v2, 0          # array index
1157            fill_array:
1158                lda v2
1159                starr.16 v1, v2      # v1[v2] = acc
1160                inci v2, 1           # v2 = v2 + 1
1161                lda v2
1162                jne v7, fill_array
1163                inci v2, -1
1164            check_array:
1165                lda v2
1166                %s
1167                sta v3              # value to compare with
1168                lda v2
1169                %s
1170                jeqz ok
1171                ldai 2
1172                return
1173            ok:
1174                inci v2, -1
1175                lda v2
1176                jgez check_array
1177        check-type: exit-positive
1178        template-cases:
1179          - values:
1180            - i16[]
1181            - |
1182              #
1183                  shli 16
1184                  ashri 16
1185            - |
1186              #
1187                  ldarr.16 v1
1188                  jne v3, exit_failure
1189                  ldai 0
1190                  return
1191              exit_failure: ldai 1
1192                  return
1193            tags: ['tsan']
1194          - values:
1195            - u16[]
1196            - |
1197              #
1198                  shli 16
1199                  shri 16
1200            - |
1201              #
1202                  ldarru.16 v1
1203                  ucmp v3
1204        cases:
1205          - values: [10000]
1206