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.8"
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.8 v1:in:i8[], v2:in:i32
41          acc: in:i8
42          format: [op_v1_4_v2_4]
43    commands:
44
45
46      - file-name: "reg_valid"
47        isa:
48          instructions:
49            - sig: starr.8 v1:in:i8[], v2:in:i32
50              acc: in:i8
51              format: [op_v1_4_v2_4]
52        check-type: empty
53        runner-options: [compile-only]
54        description: Check 'starr.8' instruction with valid register numbers.
55        header-template: []
56        code-template: |
57          #
58          .function i32 main() {
59              starr.8 %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(i8[] a0, i32 a1) {
70                  starr.8 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.8 v1:in:i8[], v2:in:i32
85              acc: in:i8
86              format: [op_v1_4_v2_4]
87        runner-options: [compile-failure]
88        description: Check 'starr.8' instruction with invalid register numbers.
89        code-template: |
90          #
91              starr.8 %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.8 v1:in:i8[], v2:in:i32
123              acc: in:i8
124              format: [op_v1_4_v2_4]
125        runner-options: [compile-failure]
126        description: Check 'starr.8' instruction with invalid register numbers.
127        header-template: []
128        code-template: |
129              #
130              .function void f1(i8[] a0, i32 a1) {
131                  starr.8 %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.8' behavior when array is null reference.
150        header-template: [npe_p]
151        tags: ['irtoc_ignore']
152        code-template: |
153          .function i8[] 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.8 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.8' behavior when array is null reference.
198        header-template: [PandaAssembly, npe_j]
199        runner-options: [use-pa]
200        tags: ['irtoc_ignore']
201        bugid: ['3047']
202        code-template: |
203          .function i8[] 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.8 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.8' 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, %s
254              movi v1, *s
255              ldai 0
256          begin:
257              starr.8 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        template-cases:
274            - values: ['u1[]']
275            - values: ['i8[]']
276        cases:
277          - values: [0, 0]
278            tags: ['tsan']
279          - values: [0, 1]
280          - values: [10, -10]
281          - values: [10, 128]
282          - values: [255, 255]
283          - values: [254, 255]
284          - values: [65535, 65535]
285            tags: ['tsan']
286          - values: [65535, 65536]
287          - values: [10, 0xFFFFFFFF]
288          - values: [256, 0xFFFFFFFE]
289          - values: [65536, 0xFFFFFFFD]
290            tags: ['tsan']
291          - values: [0x100000, 0xFFFFFFFC]
292          - values: [10, 0x80000000]
293          - values: [256, 0x80000001]
294          - values: [65536, 0x80000002]
295            tags: ['tsan']
296          - values: [0x100000, 0x80000003]
297
298
299      - file-name: array_out_of_bounds_exception_j
300        isa:
301          exceptions:
302            - x_bounds
303        description: Check 'starr.8' behavior when index is out of array bounds.
304        runner-options: [use-pa]
305        tags: ['irtoc_ignore']
306        header-template: [PandaAssembly, aoobe_j, main]
307        code-template: |
308          #
309              movi v0, *s
310              newarr v0, v0, %s
311              movi v1, *s
312              ldai 0
313          begin:
314              starr.8 v0, v1
315          end:
316              ldai 1 # Should not reach this line
317              return
318
319          catch_AOOBE:
320              ldai 0 # Expected panda.ArrayIndexOutOfBoundsException
321              return
322
323          catch_all:
324              ldai 2 # Unexpected exception, test failed
325              return
326
327          .catch panda.ArrayIndexOutOfBoundsException, begin, end, catch_AOOBE
328          .catchall begin, end, catch_all
329        check-type: none
330        template-cases:
331            - values: ['u1[]']
332            - values: ['i8[]']
333        cases:
334          - values: [0, 0]
335            tags: ['tsan']
336          - values: [0, 1]
337          - values: [10, -10]
338          - values: [10, 128]
339          - values: [255, 255]
340          - values: [254, 255]
341          - values: [65535, 65535]
342            tags: ['tsan']
343          - values: [65535, 65536]
344          - values: [10, 0xFFFFFFFF]
345          - values: [256, 0xFFFFFFFE]
346          - values: [65536, 0xFFFFFFFD]
347            tags: ['tsan']
348          - values: [0x100000, 0xFFFFFFFC]
349          - values: [10, 0x80000000]
350          - values: [256, 0x80000001]
351          - values: [65536, 0x80000002]
352            tags: ['tsan']
353          - values: [0x100000, 0x80000003]
354
355
356      - file-name: uninitialized_regs
357        isa:
358          verification:
359            - v1_array_type
360            - v2_i32
361            - acc_type
362        description: Check 'starr.8' with uninitialized registers
363        tags: ['verifier']
364        runner-options: ['verifier-failure', 'verifier-config']
365        header-template: []
366        code-template: |
367            #
368            .function i32 main() {
369                %s
370                starr.8 v1, v2
371        check-type: exit-positive
372        cases:
373          - values:
374              - |
375                # acc is not initialized
376                    movi v0, 10
377                    newarr v1, v0, i8[]
378                    movi v2, 0
379          - values:
380              - |
381                # v1 is not initialized
382                    movi v2, 0
383                    ldai 0
384          - values:
385              - |
386                # v2 is not initialized
387                    movi v0, 10
388                    newarr v1, v0, i8[]
389                    ldai 0
390          - values:
391              - |
392                # no regs are initialized
393
394
395      - file-name: "acceptable_primitive_types_p"
396        isa:
397          verification:
398            - v1_array_type
399        description: Check acceptable array of primitive types for starr.8 instruction in Panda Assembly context.
400        runner-options: ['verifier-only', 'verifier-config']
401        tags: ['verifier']
402        header-template: [main]
403        code-template: |
404          #
405              movi v0, 1
406              newarr v1, v0, %s
407              movi v2, 0
408              ldai 0
409              starr.8 v1, v2
410        check-type: exit-positive
411        cases:
412          - values: ['u1[]']
413          - values: ['i8[]']
414          - values: ['u8[]']
415
416
417      - file-name: "acceptable_primitive_types_j"
418        isa:
419          verification:
420            - v1_array_type
421        description: Check acceptable array of primitive types for starr.8 instruction in PandaAssembly context.
422        runner-options: [verifier-only, use-pa, verifier-config]
423        tags: [verifier, pa-verifier]
424        bugid: ['3293']
425        header-template: [PandaAssembly, main]
426        code-template: |
427          #
428              movi v0, 1
429              newarr v1, v0, %s
430              movi v2, 0
431              ldai 0
432              starr.8 v1, v2
433        check-type: exit-positive
434        cases:
435          - values: ['u1[]']
436          - values: ['i8[]']
437
438
439      - file-name: "rejectable_primitive_types_p"
440        isa:
441          verification:
442            - v1_array_type
443        description: Check rejectable array of primitive types for starr.8 instruction in Panda Assembly context.
444        runner-options: ['verifier-failure', 'verifier-config']
445        tags: ['verifier']
446        header-template: [main]
447        code-template: |
448          #
449              movi v0, 1
450              newarr v1, v0, %s
451              movi v2, 0
452              ldai 0
453              starr.8 v1, v2
454        check-type: exit-positive
455        cases:
456          - values: ['i16[]']
457          - values: ['u16[]']
458          - values: ['i32[]']
459          - values: ['u32[]']
460          - values: ['i64[]']
461          - values: ['u64[]']
462          - values: ['f32[]']
463          - values: ['f64[]']
464
465
466      - file-name: "rejectable_primitive_types_j"
467        isa:
468          verification:
469            - v1_array_type
470        description: Check rejectable array of primitive types for starr.8 instruction in PandaAssembly context.
471        runner-options: [verifier-failure, use-pa, verifier-config]
472        tags: [verifier, pa-verifier]
473        bugid: ['3293', '5271']
474        header-template: [PandaAssembly, main]
475        code-template: |
476          #
477              movi v0, 1
478              newarr v1, v0, %s
479              movi v2, 0
480              ldai 0
481              starr.8 v1, v2
482        check-type: exit-positive
483        cases:
484          - values: ['u8[]']
485          - values: ['i16[]']
486          - values: ['u16[]']
487          - values: ['i32[]']
488          - values: ['u32[]']
489          - values: ['i64[]']
490          - values: ['u64[]']
491          - values: ['f32[]']
492          - values: ['f64[]']
493
494
495      - file-name: "arr_type_p"
496        isa:
497          verification:
498            - v1_array_type
499        description: Check 'starr.8' with incorrect array type in Panda Assembly context. See also "rejectable_primitive_types" tests.
500        runner-options: ['verifier-failure', 'verifier-config']
501        tags: ['verifier']
502        header-template: []
503        code-template: |
504          #
505          .record A {}
506          .function void A.ctor(A a0) <ctor> {
507              return.void
508          }
509          .record panda.String <external>
510          .record panda.Object <external>
511          .function i32 main() {
512              %s
513              movi v1, 0
514              ldai 0
515              starr.8 v0, v1
516        check-type: exit-positive
517        cases:
518          - values:
519              - movi v0, 0
520          - values:
521              - movi.64 v0, 0
522          - values:
523              - fmovi v0, 0
524          - values:
525              - fmovi.64 v0, 0
526          - values:
527              - |
528                #
529                    initobj A.ctor
530                    sta.obj v0
531          - values:
532              - |
533                #
534                    movi v0, 1
535                    newarr v0, v0, A[]
536          - values:
537              - |
538                #
539                    lda.type A
540                    sta.obj v0
541          - values:
542              - |
543                #
544                    lda.type A[]
545                    sta.obj v0
546          - values:
547              - |
548                #
549                    lda.type panda.String
550                    sta.obj v0
551          - values:
552              - |
553                #
554                    lda.type panda.String[]
555                    sta.obj v0
556          - values:
557              - |
558                #
559                    lda.type panda.Object
560                    sta.obj v0
561          - values:
562              - |
563                #
564                    lda.type panda.Object[]
565                    sta.obj v0
566          - values:
567              - |
568                #
569                    lda.str "string"
570                    sta.obj v0
571          - values:
572              - |
573                #
574                    movi v0, 1
575                    newarr v0, v0, panda.Object[]
576          - values:
577              - |
578                #
579                    movi v0, 1
580                    newarr v0, v0, panda.String[]
581
582
583      - file-name: "arr_type_j"
584        isa:
585          verification:
586            - v1_array_type
587        description: Check 'starr.8' with incorrect array type in PandaAssembly context. See also "rejectable_primitive_types" tests.
588        runner-options: [verifier-failure, use-pa, verifier-config]
589        tags: [verifier, pa-verifier]
590        bugid: ['3293', '5271']
591        header-template: [PandaAssembly]
592        code-template: |
593          #
594          .record A {}
595          .function void A.ctor(A a0) <ctor> {
596              return.void
597          }
598          .record panda.Object <external>
599          .function void panda.Object.ctor(panda.Object a0) <external,ctor>
600          .function i32 main() {
601              %s
602              movi v1, 0
603              ldai 0
604              starr.8 v0, v1
605        check-type: exit-positive
606        cases:
607          - values:
608              - movi v0, 0
609          - values:
610              - movi.64 v0, 0
611          - values:
612              - fmovi v0, 0
613          - values:
614              - fmovi.64 v0, 0
615          - values:
616              - |
617                #
618                    initobj A.ctor
619                    sta.obj v0
620          - values:
621              - |
622                #
623                    movi v0, 1
624                    newarr v0, v0, A[]
625          - values:
626              - |
627                #
628                    initobj panda.Object.ctor
629                    sta.obj v0
630          - values:
631              - |
632                #
633                    movi v0, 1
634                    newarr v0, v0, panda.Object[]
635          - values:
636              - |
637                #
638                    lda.type A
639                    sta.obj v0
640          - values:
641              - |
642                #
643                    lda.type A[]
644                    sta.obj v0
645          - values:
646              - |
647                #
648                    lda.type panda.Object
649                    sta.obj v0
650          - values:
651              - |
652                #
653                    lda.type panda.Object[]
654                    sta.obj v0
655          - values:
656              - |
657                #
658                    lda.str "string"
659                    sta.obj v0
660
661
662      - file-name: "index_type_p"
663        isa:
664          verification:
665            - v2_i32
666        description: Check 'starr.8' with incorrect array index type in Panda Assembly context.
667        runner-options: ['verifier-failure', 'verifier-config']
668        tags: ['verifier']
669        header-template: []
670        code-template: |
671          #
672          .record A {}
673          .function void A.ctor(A a0) <ctor> {
674              return.void
675          }
676          .record panda.String <external>
677          .record panda.Object <external>
678          .function i32 main() {
679              movi v0, 1
680              newarr v1, v0, *s
681              %s
682              ldai 0
683              starr.8 v1, v2
684        check-type: exit-positive
685        cases:
686          - values: ['u1[]']
687          - values: ['u8[]']
688          - values: ['i8[]']
689        template-cases:
690          - values:
691              - mov.null v2
692          - values:
693              - movi.64 v2, 0
694          - values:
695              - fmovi v2, 0
696          - values:
697              - fmovi.64 v2, 0
698          - values:
699              - |
700                #
701                    initobj A.ctor
702                    sta.obj v1
703          - values:
704              - |
705                #
706                    movi v0, 1
707                    newarr v2, v0, A[]
708          - values:
709              - |
710                #
711                    lda.type A
712                    sta.obj v2
713          - values:
714              - |
715                #
716                    lda.type A[]
717                    sta.obj v2
718          - values:
719              - |
720                #
721                    lda.type panda.String
722                    sta.obj v2
723          - values:
724              - |
725                #
726                    lda.type panda.String[]
727                    sta.obj v2
728          - values:
729              - |
730                #
731                    lda.type panda.Object
732                    sta.obj v2
733          - values:
734              - |
735                #
736                    lda.type panda.Object[]
737                    sta.obj v2
738          - values:
739              - |
740                #
741                    lda.str "string"
742                    sta.obj v2
743          - values:
744              - |
745                #
746                    movi v0, 1
747                    newarr v2, v0, panda.Object[]
748          - values:
749              - |
750                #
751                    movi v0, 1
752                    newarr v2, v0, panda.String[]
753
754
755      - file-name: "index_type_j"
756        isa:
757          verification:
758            - v2_i32
759        description: Check 'starr.8' with incorrect array index type in PandaAssembly context.
760        runner-options: [verifier-failure, use-pa, verifier-config]
761        tags: [verifier, pa-verifier]
762        bugid: ['3293', '5271']
763        header-template: [PandaAssembly]
764        code-template: |
765          #
766          .record A {}
767          .function void A.ctor(A a0) <ctor> {
768              return.void
769          }
770          .record panda.Object <external>
771          .function void panda.Object.ctor(panda.Object a0) <external,ctor>
772          .function i32 main() {
773              movi v0, 1
774              newarr v1, v0, *s
775              %s
776              ldai 0
777              starr.8 v1, v2
778        check-type: exit-positive
779        cases:
780          - values: ['u1[]']
781          - values: ['i8[]']
782        template-cases:
783          - values:
784              - mov.null v2
785          - values:
786              - movi.64 v2, 0
787          - values:
788              - fmovi v2, 0
789          - values:
790              - fmovi.64 v2, 0
791          - values:
792              - |
793                #
794                    initobj A.ctor
795                    sta.obj v2
796          - values:
797              - |
798                #
799                    movi v0, 1
800                    newarr v2, v0, A[]
801          - values:
802              - |
803                #
804                    initobj panda.Object.ctor
805                    sta.obj v2
806          - values:
807              - |
808                #
809                    movi v0, 1
810                    newarr v2, v0, panda.Object[]
811          - values:
812              - |
813                #
814                    lda.type A
815                    sta.obj v2
816          - values:
817              - |
818                #
819                    lda.type A[]
820                    sta.obj v2
821          - values:
822              - |
823                #
824                    lda.type panda.Object
825                    sta.obj v2
826          - values:
827              - |
828                #
829                    lda.type panda.Object[]
830                    sta.obj v2
831          - values:
832              - |
833                #
834                    lda.str "string"
835                    sta.obj v2
836
837
838      - file-name: "acc_type_p"
839        isa:
840          verification:
841            - acc_type
842        description: Check 'starr.8' with incorrect accumulator type in Panda Assembly context.
843        runner-options: ['verifier-failure', 'verifier-config']
844        tags: ['verifier']
845        header-template: []
846        code-template: |
847          #
848          .record A {}
849          .function void A.ctor(A a0) <ctor> {
850              return.void
851          }
852          .record panda.String <external>
853          .record panda.Object <external>
854          .function i32 main() {
855              movi v0, 1
856              newarr v1, v0, *s
857              movi v2, 0
858              %s
859              starr.8 v1, v2
860        check-type: exit-positive
861        cases:
862          - values: ['u1[]']
863          - values: ['u8[]']
864          - values: ['i8[]']
865        template-cases:
866          - values:
867              - lda.null
868          - values:
869              - ldai.64 0
870          - values:
871              - fldai 0
872          - values:
873              - fldai.64 0
874          - values:
875              - |
876                #
877                    initobj A.ctor
878          - values:
879              - |
880                #
881                    lda.type A
882          - values:
883              - |
884                #
885                    lda.type panda.String
886          - values:
887              - |
888                #
889                    lda.type panda.String[]
890          - values:
891              - |
892                #
893                    lda.type panda.Object
894          - values:
895              - |
896                #
897                    lda.type panda.Object[]
898          - values:
899              - |
900                #
901                    lda.str "string"
902          - values:
903              - |
904                #
905                    movi v0, 1
906                    newarr v0, v0, panda.Object[]
907                    lda.obj v0
908          - values:
909              - |
910                #
911                    movi v0, 1
912                    newarr v0, v0, panda.String[]
913                    lda.obj v0
914
915
916      - file-name: "acc_type_j"
917        isa:
918          verification:
919            - acc_type
920        description: Check 'starr.8' with incorrect accumulator type in PandaAssembly context.
921        runner-options: [verifier-failure, use-pa, verifier-config]
922        tags: [verifier, pa-verifier]
923        bugid: ['3293', '5271']
924        header-template: [PandaAssembly]
925        code-template: |
926          #
927          .record A {}
928          .function void A.ctor(A a0) <ctor> {
929              return.void
930          }
931          .record panda.Object <external>
932          .function void panda.Object.ctor(panda.Object a0) <external,ctor>
933          .function i32 main() {
934              movi v0, 1
935              newarr v1, v0, *s
936              movi v2, 0
937              %s
938              starr.8 v1, v2
939        check-type: exit-positive
940        cases:
941          - values: ['u1[]']
942          - values: ['i8[]']
943        template-cases:
944          - values:
945              - lda.null
946          - values:
947              - ldai.64 0
948          - values:
949              - fldai 0
950          - values:
951              - fldai.64 0
952          - values:
953              - |
954                #
955                    initobj A.ctor
956          - values:
957              - |
958                #
959                    initobj panda.Object.ctor
960          - values:
961              - |
962                #
963                    lda.type A
964          - values:
965              - |
966                #
967                    lda.type A[]
968          - values:
969              - |
970                #
971                    lda.type panda.Object
972          - values:
973              - |
974                #
975                    lda.type panda.Object[]
976          - values:
977              - |
978                #
979                    lda.str "string"
980          - values:
981              - |
982                #
983                    movi v0, 1
984                    newarr v0, v0, panda.Object[]
985                    lda.obj v0
986          - values:
987              - |
988                #
989                    movi v0, 1
990                    newarr v0, v0, A[]
991                    lda.obj v0
992
993
994      - file-name: "mult_regs_types_p"
995        isa:
996          verification:
997            - v1_array_type
998            - v2_i32
999            - acc_type
1000        description: Check 'starr.8' with multiple incorrect register types in Panda Assembly context.
1001        runner-options: ['verifier-failure', 'verifier-config']
1002        tags: ['verifier']
1003        header-template: []
1004        code-template: |
1005          #
1006          .record A {}
1007          .function void A.ctor(A a0) <ctor> {
1008              return.void
1009          }
1010          .record panda.String <external>
1011          .record panda.Object <external>
1012          .function void panda.Object.ctor(panda.Object a0) <external,ctor>
1013          .function i32 main() {
1014              %s
1015              starr.8 v1, v2
1016        check-type: exit-positive
1017        cases:
1018          - values:
1019              - |
1020                # all registers invalid
1021                    initobj panda.Object.ctor
1022                    sta.obj v1
1023                    movi.64 v2, 0
1024                    lda.str "test string"
1025          - values:
1026              - |
1027                # v1 and v2 invalid
1028                    lda.str "test string"
1029                    sta.obj v1
1030                    fmovi.64 v2, 1
1031                    ldai 0
1032          - values:
1033              - |
1034                # v1 and acc invalid
1035                    lda.type panda.Object
1036                    sta.obj v1
1037                    movi v2, 0
1038                    lda.str "test string"
1039          - values:
1040              - |
1041                # v2 and acc invalid
1042                    movi v0, 1
1043                    newarr v1, v0, i8[]
1044                    sta.obj v2
1045                    initobj A.ctor
1046
1047
1048      - file-name: "mult_regs_types_j"
1049        isa:
1050          verification:
1051            - v1_array_type
1052            - v2_i32
1053            - acc_type
1054        description: Check 'starr.8' with multiple incorrect register types in PandaAssembly context.
1055        runner-options: [verifier-failure, use-pa, verifier-config]
1056        tags: [verifier, pa-verifier]
1057        bugid: ['3293', '5271']
1058        header-template: [PandaAssembly]
1059        code-template: |
1060          #
1061          .record A {}
1062          .function void A.ctor(A a0) <ctor> {
1063              return.void
1064          }
1065          .record panda.Object <external>
1066          .function void panda.Object.ctor(panda.Object a0) <external,ctor>
1067          .function i32 main() {
1068              %s
1069              starr.8 v1, v2
1070        check-type: exit-positive
1071        cases:
1072          - values:
1073              - |
1074                # all registers invalid
1075                    initobj panda.Object.ctor
1076                    sta.obj v1
1077                    movi.64 v2, 0
1078                    lda.str "test string"
1079          - values:
1080              - |
1081                # v1 and v2 invalid
1082                    lda.str "test string"
1083                    sta.obj v1
1084                    fmovi.64 v2, 1
1085                    ldai 0
1086          - values:
1087              - |
1088                # v1 and acc invalid
1089                    lda.type panda.Object
1090                    sta.obj v1
1091                    movi v2, 0
1092                    lda.str "test string"
1093          - values:
1094              - |
1095                # v2 and acc invalid
1096                    movi v0, 1
1097                    newarr v1, v0, i8[]
1098                    sta.obj v2
1099                    initobj A.ctor
1100
1101
1102      - file-name: "store_arr_p"
1103        isa:
1104          instructions:
1105            - sig: starr.8 v1:in:i8[], v2:in:i32
1106              acc: in:i8
1107              format: [op_v1_4_v2_4]
1108        description: Check starr.8 stores items to array of different size and type in Panda Assembly context.
1109        code-template: |
1110          #
1111              movi v0, *s
1112              newarr v1, v0, %s
1113              movi v2, *s
1114              ldai 1234567  # will be truncated
1115              starr.8 v1, v2
1116        check-type: exit-positive
1117        template-cases:
1118          - values: ['u1[]']
1119          - values: ['i8[]']
1120          - values: ['u8[]']
1121        cases:
1122          - values: ['1', '0']
1123          - values: ['255', '254']
1124            tags: ['tsan']
1125          - values: ['65536', '65535']
1126
1127
1128      - file-name: "store_arr_j"
1129        isa:
1130          instructions:
1131            - sig: starr.8 v1:in:i8[], v2:in:i32
1132              acc: in:i8
1133              format: [op_v1_4_v2_4]
1134        description: Check starr.8 stores items to array of different size and type in PandaAssembly context.
1135        runner-options: ['use-pa']
1136        header-template: [PandaAssembly, main]
1137        code-template: |
1138          #
1139              movi v0, *s
1140              newarr v1, v0, %s
1141              movi v2, *s
1142              ldai 1234567  # will be truncated
1143              starr.8 v1, v2
1144        check-type: exit-positive
1145        template-cases:
1146          - values: ['u1[]']
1147          - values: ['i8[]']
1148        cases:
1149          - values: ['1', '0']
1150          - values: ['255', '254']
1151          - values: ['65536', '65535']
1152            tags: ['tsan']
1153
1154
1155      - file-name: "store_all_elements"
1156        isa:
1157          description: >
1158            Store accumulator content into array slot pointed by index.
1159        description: Check starr.8 stores correct items into array of primitives.
1160        header-template: []
1161        code-template: |
1162            .function i32 main() {
1163                movi v7, *s         # v7 is array size
1164                newarr v1, v7, %s          # v1 - testable array
1165
1166                movi v2, 0          # array index
1167            fill_array:
1168                lda v2
1169                starr.8 v1, v2      # v1[v2] = acc
1170                inci v2, 1          # v2 = v2 + 1
1171                lda v2
1172                jne v7, fill_array
1173                inci v2, -1
1174            check_array:
1175                lda v2
1176                %s
1177                sta v3              # value to compare with
1178                lda v2
1179                %s
1180                jeqz ok
1181                ldai 2
1182                return
1183            ok:
1184                inci v2, -1
1185                lda v2
1186                jgez check_array
1187        check-type: exit-positive
1188        template-cases:
1189          - values:
1190            - u1[]
1191            - |
1192              #
1193                  andi 0x00000001
1194            - |
1195              #
1196                  ldarru.8 v1
1197                  jne v3, exit_failure
1198                  ldai 0
1199                  return
1200              exit_failure: ldai 1
1201                  return
1202            bugid: ['4019']
1203            ignore: true
1204          - values:
1205            - i8[]
1206            - |
1207              #
1208                  shli 24
1209                  ashri 24
1210            - |
1211              #
1212                  ldarr.8 v1
1213                  jne v3, exit_failure
1214                  ldai 0
1215                  return
1216              exit_failure: ldai 1
1217                  return
1218            tags: ['tsan']
1219          - values:
1220            - u8[]
1221            - |
1222              #
1223                  shli 24
1224                  shri 24
1225            - |
1226              #
1227                  ldarru.8 v1
1228                  ucmp v3
1229        cases:
1230          - values: [10000]
1231
1232