• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021 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: java
16    template: |
17      .language Java
18
19tests:
20  - file-name: "jne.obj"
21    isa:
22      title: Conditional object comparison jump
23      description: >
24        Transfer execution to an instruction at offset bytes from the beginning of the current instruction if
25        object references in accumulator and source register compare as specified. Offset is sign extended to the size of
26        instruction address.
27      exceptions:
28        - x_none
29      verification:
30        - branch_target
31        - acc_obj_or_null
32        - v1_obj_or_null
33      instructions:
34        - sig: jne.obj v:in:ref, imm:i32
35          acc: in:ref
36          format: [op_v_8_imm_8, op_v_8_imm_16]
37    commands:
38
39      - file-name: "invalid_v_reg"
40        isa:
41          verification:
42            - v1_obj_or_null
43          instructions:
44            - sig: jne.obj v:in:ref, imm:i32
45              acc: in:ref
46              format: [op_v_8_imm_8, op_v_8_imm_16]
47        runner-options: [compile-failure]
48        description: Check 'jne.obj' instruction with invalid 'v' register.
49        header-template: []
50        code-template: |
51            .function i32 main() {
52                jne.obj %s
53            lbl:
54        check-type: exit-positive
55        cases:
56          - values: ["v256, lbl"]
57          - values: ["v65535, lbl"]
58          - values: ["v65536, lbl"]
59          - values: ["a0, lbl"]
60          - values: ["a256, lbl"]
61          - values: ["a65535, lbl"]
62          - values: ["lbl"]
63          - values: [""]
64          - values: ["}"]
65          - values: ["# v1, lbl"]
66          - values: ["V1, lbl"]
67
68
69      - file-name: "invalid_a_reg"
70        isa:
71          verification:
72            - v1_obj_or_null
73          instructions:
74            - sig: jne.obj v:in:ref, imm:i32
75              acc: in:ref
76              format: [op_v_8_imm_8, op_v_8_imm_16]
77        runner-options: [compile-failure]
78        description: Check 'jne.obj' instruction with invalid 'a' register.
79        header-template: []
80        code-template: |
81            .record R {}
82            .function void foo(R a0, R a1, R a2, R a3, R a4, R a5) <static> {
83                jne.obj %s
84            lbl:
85                return.void
86            }
87            .function i32 main() {
88                call.range foo, v0
89        check-type: exit-positive
90        cases:
91          - values: ["v256, lbl"]
92          - values: ["v65535, lbl"]
93          - values: ["v65536, lbl"]
94          - values: ["a6, lbl"]
95          - values: ["a256, lbl"]
96          - values: ["a65535, lbl"]
97          - values: ["lbl"]
98          - values: [""]
99          - values: ["}"]
100          - values: ["# v1, lbl"]
101          - values: ["V1, lbl"]
102
103
104      - file-name: "valid_v_reg"
105        isa:
106          verification:
107            - v1_obj_or_null
108          instructions:
109            - sig: jne.obj v:in:ref, imm:i32
110              acc: in:ref
111              format: [op_v_8_imm_8, op_v_8_imm_16]
112        description: Check 'jne.obj' instruction with valid 'v' register.
113        header-template: []
114        code-template: |
115            .function i32 main() {
116                mov.null %s
117                lda.null
118                jne.obj %s, lbl
119                ldai 0
120                return
121            lbl:
122                ldai 1
123        check-type: no-check
124        cases:
125          - values: ["v0", "v0"]
126          - values: ["v7", "v7"]
127          - values: ["v8", "v8"]
128          - values: ["v15", "v15"]
129          - values: ["v16", "v16"]
130            tags: [tsan]
131          - values: ["v254", "v254"]
132          - values: ["v255", "v255"]
133
134
135      - file-name: "valid_a_reg"
136        isa:
137          verification:
138            - v1_obj_or_null
139          instructions:
140            - sig: jne.obj v:in:ref, imm:i32
141              acc: in:ref
142              format: [op_v_8_imm_8, op_v_8_imm_16]
143        description: Check 'jne.obj' instruction with valid 'a' register.
144        header-template: []
145        code-template: |
146            .record R {}
147            .function void R.ctor(R a0) <ctor> {
148                return.void
149            }
150            .function i32 foo(%s) <static> {
151                lda.obj a0
152                jne.obj %s, lbl
153                ldai 0
154                return
155            lbl:
156                ldai 1
157                return
158            }
159            .function i32 main() {
160                initobj R.ctor
161            %s
162                call.range foo, v0
163        check-type: no-check
164        cases:
165          - values:
166            - R a0
167            - a0
168            - |
169              #
170                  sta.obj v0
171            tags: [tsan]
172          - values:
173            - R a0, R a1
174            - a1
175            - |
176              #
177                  sta.obj v0
178                  sta.obj v1
179          - values:
180            - "#{[*0..255].map do |i| \" R a#{i}\" end .join(\",\")}"
181            - a254
182            - "#{[*0..255].map do |i| \"    sta.obj v#{i}\\n\" end .join}"
183            bugid: ['3855']
184          - values:
185            - "#{[*0..255].map do |i| \" R a#{i}\" end .join(\",\")}"
186            - a255
187            - "#{[*0..255].map do |i| \"    sta.obj v#{i}\\n\" end .join}"
188            bugid: ['3855']
189
190
191      - file-name: "uninitialized_regs"
192        isa:
193          verification:
194            - acc_obj_or_null
195            - v1_obj_or_null
196        runner-options: ['verifier-failure', 'verifier-debug-config']
197        tags: [verifier]
198        description: Check 'jne.obj' instruction with uninitialized registers.
199        header-template: []
200        code-template: |
201            .function i32 main() {
202                %s
203                jne.obj v1, lbl
204                ldai 1
205                return
206            lbl:
207        check-type: exit-positive
208        cases:
209          - description: Accumulator is not initialized.
210            values:
211              - mov.null v1
212          - description: V register is not initialized.
213            values:
214              - lda.null
215          - description: Accumulator and 'v' register are both not initialized.
216            values:
217              - ""
218
219
220      - file-name: "invalid_branch_target"
221        isa:
222          verification:
223            - branch_target
224        runner-options: [compile-failure]
225        description: Check 'jne.obj' instruction with invalid branch target.
226        header-template: []
227        code-template: |
228            .record R {}
229
230            .function void R.ctor(R a0) <ctor> {
231            lbl_ctor:
232                return.void
233            }
234
235            .function void R.cctor() <cctor> {
236            lbl_cctor:
237                return.void
238            }
239
240            .function i32 foo() <static> {
241                lda.obj a0
242                jne.obj a1, %s
243            }
244
245            .function i32 bar() <static> {
246            lbl_bar:
247                ldai 1
248                return
249            }
250
251            .function i32 main() {
252                call.short foo
253            lbl_main:
254        check-type: exit-positive
255        cases:
256          - values: ["main"]
257          - values: ["foo"]
258          - values: ["bar"]
259          - values: ["baz"]
260          - values: ["R"]
261          - values: ["lbl_main"]
262          - values: ["lbl_bar"]
263          - values: ["lbl_ctor"]
264          - values: ["lbl_cctor"]
265
266
267      - file-name: "prohibited_branch_target_p"
268        isa:
269          verification:
270            - branch_target
271        runner-options: ['verifier-failure', 'verifier-debug-config']
272        tags: [verifier]
273        description: Check 'jne.obj' instruction with prohibited branch target in PandaAssembly context.
274        header-template: []
275        code-template: |
276            .record E1 {}
277            .record E2 {}
278            .record R {}
279
280            .function void R.ctor(R a0) <ctor> {
281                return.void
282            }
283
284            .function i32 main() {
285                initobj R.ctor
286                sta.obj v0
287                initobj R.ctor
288                jne.obj v0, %s
289
290            begin:
291                ldai 0
292                return
293            mid:
294                ldai 1
295                return
296            end:
297                ldai 2
298                return
299
300            catch_E1_begin:
301                ldai 3
302                return
303            catch_E1_mid:
304                ldai 4
305                return
306            catch_E1_end:
307                ldai 5
308                return
309
310            catch_E2_begin:
311                ldai 6
312                return
313            catch_E2_mid:
314                ldai 7
315                return
316            catch_E2_end:
317
318            quit:
319                ldai 8
320                return
321
322            .catch E1, begin, end, catch_E1_begin, catch_E1_end
323            .catch E2, catch_E1_begin, catch_E1_end, catch_E2_begin, catch_E2_end
324            outside:
325        check-type: none
326        cases:
327          - values: ["begin"]
328            runner-options: ['verifier-only', 'verifier-debug-config']
329          - values: ["mid"]
330            runner-options: ['verifier-only', 'verifier-debug-config']
331          - values: ["end"]
332            runner-options: ['verifier-only', 'verifier-debug-config']
333          - values: ["quit"]
334            runner-options: ['verifier-only', 'verifier-debug-config']
335          - values: ["catch_E1_begin"]
336          - values: ["catch_E1_mid"]
337          - values: ["catch_E1_end"]
338            runner-options: ['verifier-only', 'verifier-debug-config']
339          - values: ["catch_E2_begin"]
340          - values: ["catch_E2_mid"]
341          - values: ["catch_E2_end"]
342            runner-options: ['verifier-only', 'verifier-debug-config']
343          - values: ["outside"]
344
345
346      - file-name: "invalid_acc_value"
347        isa:
348          verification:
349            - acc_obj_or_null
350        runner-options: ['verifier-failure', 'verifier-debug-config']
351        tags: [verifier]
352        description: Check 'jne.obj' instruction with invalid accumulator value
353        header-template: []
354        code-template: |
355            .record R {}
356            .function void R.ctor(R a0) <ctor> {
357                return.void
358            }
359            .function i32 main() {
360                %s
361                *s
362                jne.obj v1, ok
363                ldai 1
364                return
365            ok:
366        check-type: exit-positive
367        template-cases:
368          - values:
369            - |
370              #
371                  initobj R.ctor
372                  sta.obj v1
373          - values:
374            - mov.null v1
375        cases:
376          - values:
377            - ldai 0
378          - values:
379            - ldai 1
380          - values:
381            - ldai 0x7fffffff
382          - values:
383            - ldai 0xffffffff
384          - values:
385            - ldai 0x80000000
386          - values:
387            - ldai.64 0
388          - values:
389            - ldai.64 1
390          - values:
391            - ldai.64 0x7fffffffffffffff
392          - values:
393            - ldai.64 0xffffffffffffffff
394          - values:
395            - ldai.64 0x8000000000000000
396          - values:
397            - |
398              #
399                  fldai.64 0x0000000000000000 # Positive zero (+0.0, hexadecimal representation is `0x0000000000000000`)
400          - values:
401            - |
402              #
403                  fldai.64 0x8000000000000000 # Negative zero (-0.0, hexadecimal representation is `0x8000000000000000`)
404          - values:
405            - |
406              #
407                  fldai.64 0x0000000000000001 # Minimal positive value (4.9E-324, hexadecimal representation is `0x0000000000000001`)
408          - values:
409            - |
410              #
411                  fldai.64 0x8000000000000001 # Maximal negative value (-4.9E-324, hexadecimal representation is `0x8000000000000001`)
412          - values:
413            - |
414              #
415                  fldai.64 0x7fefffffffffffff # Maximal positive value (1.7976931348623157e308, hexadecimal representation is `0x7fefffffffffffff`)
416          - values:
417            - |
418              #
419                  fldai.64 0xffefffffffffffff # Minimal negative value (-1.7976931348623157e308, hexadecimal representation is `0xffefffffffffffff`)
420          - values:
421            - |
422              #
423                  fldai.64 0x7ff0000000000000 # Positive infinity (hexadecimal representation is `0x7ff0000000000000`)
424          - values:
425            - |
426              #
427                  fldai.64 0xfff0000000000000 # Negative infinity (hexadecimal representation is `0xfff0000000000000`)
428          - values:
429            - |
430              #
431                  fldai.64 0x7ff8000000000000 # NaN
432
433
434      - file-name: "invalid_v_value"
435        isa:
436          verification:
437            - v1_obj_or_null
438        runner-options: ['verifier-failure', 'verifier-debug-config']
439        tags: [verifier]
440        description: Check 'jne.obj' instruction with invalid v register value
441        header-template: []
442        code-template: |
443            .record R {}
444            .function void R.ctor(R a0) <ctor> {
445                return.void
446            }
447            .function i32 main() {
448                *s
449                %s
450                jne.obj v1, ok
451                ldai 1
452                return
453            ok:
454        check-type: exit-positive
455        template-cases:
456          - values:
457            - initobj R.ctor
458          - values:
459            - lda.null
460        cases:
461          - values:
462            - movi v1, 0
463          - values:
464            - movi v1, 1
465          - values:
466            - movi v1, 0x7fffffff
467          - values:
468            - movi v1, 0xffffffff
469          - values:
470            - movi v1, 0x80000000
471          - values:
472            - movi.64 v1, 0
473          - values:
474            - movi.64 v1, 1
475          - values:
476            - movi.64 v1, 0x7fffffffffffffff
477          - values:
478            - movi.64 v1, 0xffffffffffffffff
479          - values:
480            - movi.64 v1, 0x8000000000000000
481          - values:
482            - |
483              #
484                  fmovi.64 v1, 0x0000000000000000 # Positive zero (+0.0, hexadecimal representation is `0x0000000000000000`)
485          - values:
486            - |
487              #
488                  fmovi.64 v1, 0x8000000000000000 # Negative zero (-0.0, hexadecimal representation is `0x8000000000000000`)
489          - values:
490            - |
491              #
492                  fmovi.64 v1, 0x0000000000000001 # Minimal positive value (4.9E-324, hexadecimal representation is `0x0000000000000001`)
493          - values:
494            - |
495              #
496                  fmovi.64 v1, 0x8000000000000001 # Maximal negative value (-4.9E-324, hexadecimal representation is `0x8000000000000001`)
497          - values:
498            - |
499              #
500                  fmovi.64 v1, 0x7fefffffffffffff # Maximal positive value (1.7976931348623157e308, hexadecimal representation is `0x7fefffffffffffff`)
501          - values:
502            - |
503              #
504                  fmovi.64 v1, 0xffefffffffffffff # Minimal negative value (-1.7976931348623157e308, hexadecimal representation is `0xffefffffffffffff`)
505          - values:
506            - |
507              #
508                  fmovi.64 v1, 0x7ff0000000000000 # Positive infinity (hexadecimal representation is `0x7ff0000000000000`)
509          - values:
510            - |
511              #
512                  fmovi.64 v1, 0xfff0000000000000 # Negative infinity (hexadecimal representation is `0xfff0000000000000`)
513          - values:
514            - |
515              #
516                  fmovi.64 v1, 0x7ff8000000000000 # NaN
517
518
519      - file-name: "invalid_both_acc_and_v_value"
520        isa:
521          verification:
522            - v1_obj_or_null
523            - acc_obj_or_null
524        runner-options: ['verifier-failure', 'verifier-debug-config']
525        tags: [verifier]
526        description: Check 'jne.obj' instruction with invalid accumulator and v register value
527        header-template: []
528        code-template: |
529            .record R {}
530            .function void R.ctor(R a0) <ctor> {
531                return.void
532            }
533            .function i32 main() {
534                *s
535                %s
536                jne.obj v1, ok
537                ldai 1
538                return
539            ok:
540        check-type: exit-positive
541        template-cases:
542          - values:
543            - ldai 0
544          - values:
545            - ldai 1
546          - values:
547            - ldai 0x7fffffff
548          - values:
549            - ldai 0xffffffff
550          - values:
551            - ldai 0x80000000
552          - values:
553            - ldai.64 0
554          - values:
555            - ldai.64 1
556          - values:
557            - ldai.64 0x7fffffffffffffff
558          - values:
559            - ldai.64 0xffffffffffffffff
560          - values:
561            - ldai.64 0x8000000000000000
562          - values:
563            - |
564              #
565                  fldai.64 0x0000000000000000 # Positive zero (+0.0, hexadecimal representation is `0x0000000000000000`)
566          - values:
567            - |
568              #
569                  fldai.64 0x8000000000000000 # Negative zero (-0.0, hexadecimal representation is `0x8000000000000000`)
570          - values:
571            - |
572              #
573                  fldai.64 0x0000000000000001 # Minimal positive value (4.9E-324, hexadecimal representation is `0x0000000000000001`)
574          - values:
575            - |
576              #
577                  fldai.64 0x8000000000000001 # Maximal negative value (-4.9E-324, hexadecimal representation is `0x8000000000000001`)
578          - values:
579            - |
580              #
581                  fldai.64 0x7fefffffffffffff # Maximal positive value (1.7976931348623157e308, hexadecimal representation is `0x7fefffffffffffff`)
582          - values:
583            - |
584              #
585                  fldai.64 0xffefffffffffffff # Minimal negative value (-1.7976931348623157e308, hexadecimal representation is `0xffefffffffffffff`)
586          - values:
587            - |
588              #
589                  fldai.64 0x7ff0000000000000 # Positive infinity (hexadecimal representation is `0x7ff0000000000000`)
590          - values:
591            - |
592              #
593                  fldai.64 0xfff0000000000000 # Negative infinity (hexadecimal representation is `0xfff0000000000000`)
594          - values:
595            - |
596              #
597                  fldai.64 0x7ff8000000000000 # NaN
598        cases:
599          - values:
600            - movi v1, 0
601          - values:
602            - movi v1, 1
603          - values:
604            - movi v1, 0x7fffffff
605          - values:
606            - movi v1, 0xffffffff
607          - values:
608            - movi v1, 0x80000000
609          - values:
610            - movi.64 v1, 0
611          - values:
612            - movi.64 v1, 1
613          - values:
614            - movi.64 v1, 0x7fffffffffffffff
615          - values:
616            - movi.64 v1, 0xffffffffffffffff
617          - values:
618            - movi.64 v1, 0x8000000000000000
619          - values:
620            - |
621              #
622                  fmovi.64 v1, 0x0000000000000000 # Positive zero (+0.0, hexadecimal representation is `0x0000000000000000`)
623          - values:
624            - |
625              #
626                  fmovi.64 v1, 0x8000000000000000 # Negative zero (-0.0, hexadecimal representation is `0x8000000000000000`)
627          - values:
628            - |
629              #
630                  fmovi.64 v1, 0x0000000000000001 # Minimal positive value (4.9E-324, hexadecimal representation is `0x0000000000000001`)
631          - values:
632            - |
633              #
634                  fmovi.64 v1, 0x8000000000000001 # Maximal negative value (-4.9E-324, hexadecimal representation is `0x8000000000000001`)
635          - values:
636            - |
637              #
638                  fmovi.64 v1, 0x7fefffffffffffff # Maximal positive value (1.7976931348623157e308, hexadecimal representation is `0x7fefffffffffffff`)
639          - values:
640            - |
641              #
642                  fmovi.64 v1, 0xffefffffffffffff # Minimal negative value (-1.7976931348623157e308, hexadecimal representation is `0xffefffffffffffff`)
643          - values:
644            - |
645              #
646                  fmovi.64 v1, 0x7ff0000000000000 # Positive infinity (hexadecimal representation is `0x7ff0000000000000`)
647          - values:
648            - |
649              #
650                  fmovi.64 v1, 0xfff0000000000000 # Negative infinity (hexadecimal representation is `0xfff0000000000000`)
651          - values:
652            - |
653              #
654                  fmovi.64 v1, 0x7ff8000000000000 # NaN
655
656
657      - file-name: "valid_equal_values_p"
658        isa:
659          description: >
660            Transfer execution to an instruction at offset bytes from the beginning of the current instruction if
661            object references in accumulator and source register compare as specified. Offset is sign extended to the size of
662            instruction address.
663        description: Check 'jne.obj' instruction with valid equal values in PandaAssembly context.
664        header-template: []
665        code-template: |
666            .record panda.String <external>
667            .record panda.Class <external>
668            .record panda.Object <external>
669            .record R {}
670            .function void R.ctor(R a0) <ctor> {
671                return.void
672            }
673            .function i32 main() {
674                %s
675                jne.obj v1, ng
676                ldai 0
677                return
678            ng:
679                ldai 1
680        check-type: no-check
681        cases:
682          - values:
683            - |
684              #
685                  mov.null v1
686                  lda.null
687          - values:
688            - |
689              #
690                  initobj R.ctor
691                  sta.obj v1
692            tags: [tsan]
693          - values:
694            - |
695              #
696                  lda.str "test"
697                  sta.obj v1
698                  lda.str "test"
699          - values:
700            - |
701              #
702                  lda.type R
703                  sta.obj v1
704                  lda.type R
705          - values:
706            - |
707              #
708                  movi v1, 10
709                  newarr v1, v1, R[]
710                  lda.obj v1
711          - values:
712            - |
713              #
714                  movi v1, 10
715                  newarr v1, v1, panda.String[]
716                  lda.obj v1
717          - values:
718            - |
719              #
720                  movi v1, 10
721                  newarr v1, v1, panda.Class[]
722                  lda.obj v1
723            tags: [tsan]
724          - values:
725            - |
726              #
727                  movi v1, 10
728                  newarr v1, v1, panda.Object[][]
729                  lda.obj v1
730
731
732      - file-name: "valid_not_equal_values_p"
733        isa:
734          description: >
735            Transfer execution to an instruction at offset bytes from the beginning of the current instruction if
736            object references in accumulator and source register compare as specified. Offset is sign extended to the size of
737            instruction address.
738        description: Check 'jne.obj' instruction with valid not equal values in PandaAssembly context.
739        header-template: []
740        code-template: |
741            .record panda.String <external>
742            .record panda.Class <external>
743            .record panda.Object <external>
744            .record R {}
745            .function void R.ctor(R a0) <ctor> {
746                return.void
747            }
748            .function i32 main() {
749                # set v1 register
750                *s
751                # set accumulator
752                %s
753                jne.obj v1, ng
754                ldai 1
755                return
756            ng:
757        check-type: exit-positive
758        template-cases:
759          - values:
760            - lda.null
761            exclude: [nul]
762          - values:
763            - initobj R.ctor
764          - values:
765            - lda.str "test1"
766            exclude: [str1]
767          - values:
768            - lda.str "test2"
769            exclude: [str2]
770          - values:
771            - lda.type R
772            exclude: [tr]
773          - values:
774            - lda.type panda.Object
775            exclude: [to]
776          - values:
777            - |
778              #
779                  movi v2, 10
780                  newarr v2, v2, R[]
781                  lda.obj v2
782          - values:
783            - |
784              #
785                  movi v2, 10
786                  newarr v2, v2, R[][]
787                  lda.obj v2
788          - values:
789            - |
790              #
791                  movi v2, 10
792                  newarr v2, v2, panda.String[][][]
793                  lda.obj v2
794        cases:
795          - values:
796            - mov.null v1
797            id: nul
798          - values:
799            - |
800              #
801                  initobj R.ctor
802                  sta.obj v1
803          - values:
804            - |
805              #
806                  lda.str "test1"
807                  sta.obj v1
808            id: str1
809          - values:
810            - |
811              #
812                  lda.str "test2"
813                  sta.obj v1
814            id: str2
815          - values:
816            - |
817              #
818                  lda.type R
819                  sta.obj v1
820            id: tr
821          - values:
822            - |
823              #
824                  lda.type panda.Object
825                  sta.obj v1
826            id: to
827          - values:
828            - |
829              #
830                  movi v2, 10
831                  newarr v1, v2, R[]
832                  lda.obj v1
833          - values:
834            - |
835              #
836                  movi v2, 10
837                  newarr v1, v2, R[][]
838                  lda.obj v1
839          - values:
840            - |
841              #
842                  movi v2, 10
843                  newarr v1, v2, panda.String[][][]
844                  lda.obj v1
845
846
847      - file-name: "valid_offset_values"
848        isa:
849          description: >
850            Transfer execution to an instruction at offset bytes from the beginning of the current instruction if
851            object references in accumulator and source register compare as specified. Offset is sign extended to the size of
852            instruction address.
853        description: Check 'jne.obj' instruction with valid offset values.
854        header-template: []
855        code-template: |
856            .record R {}
857            .function void R.ctor(R a0) <ctor> {
858                return.void
859            }
860            .function i32 main() {
861                lda.str "test"
862                mov.null v1
863                %s
864                ldai 1      # 2-byte instruction
865                return      # 1-byte instruction
866            quit:
867        check-type: exit-positive
868        cases:
869          - description: Same instruction jump, offset imm8, 0 bytes
870            values:
871              - |
872                #
873                    lda.null
874                lbl:
875                    jne.obj v1, lbl
876                    ldai 0
877                    return
878          - description: Max forward jump for imm8, 3 + 110 + 10 + 1 + 3 = 127 bytes
879            values:
880              - |
881                #
882                    jne.obj v1, quit      # 3-byte instruction
883                    movi.64 v0, 0 ##*11
884                    ldai 1      # 2-byte instruction
885                    ldai 1      # 2-byte instruction
886                    ldai 1      # 2-byte instruction
887                    ldai 1      # 2-byte instruction
888                    ldai 1      # 2-byte instruction
889                    return      # 1-byte instruction
890            tags: [tsan]
891          - description: Max backward jump for imm8, 3 + 120 + 2 + 2 + 1 = 128 bytes
892            values:
893              - |
894                #
895                    jmp lbl2
896                lbl1:
897                    jmp quit      # 3-byte instruction
898                    movi.64 v0, 0 ##*12
899                    ldai 1        # 2-byte instruction
900                    ldai 1        # 2-byte instruction
901                    return        # 1-byte instruction
902                lbl2:
903                    jne.obj v1, lbl1
904          - description: Max forward jump for imm16, 32760 + 4 + 3 = 32767 bytes
905            values:
906              - |
907                #
908                    jne.obj v1, quit      # 4-byte instruction
909                    movi.64 v0, 0 ##*3276
910          - description: Beyond max forward jump for imm16, 40000 + 4 + 3 = 40007 bytes. Converted to jeq.obj + jmp by compiler.
911            values:
912              - |
913                #
914                    jne.obj v1, quit      # 4-byte instruction
915                    movi.64 v0, 0 ##*4000
916          - description: Max backward jump for imm16, 5 + 32760 + 3 = 32768 bytes
917            values:
918              - |
919                #
920                    jmp lbl2
921                lbl1:
922                    jmp quit              # 5-byte instruction
923                    movi.64 v0, 0 ##*3276
924                    lda.null ##*3
925                lbl2:
926                    jne.obj v1, lbl1
927          - description: Beyond max backward jump for imm16, 5 + 40000 = 40005 bytes. Converted to jeq.obj + jmp by compiler.
928            values:
929              - |
930                #
931                    jmp lbl2
932                lbl1:
933                    jmp quit              # 5-byte instruction
934                    movi.64 v0, 0 ##*4000
935                lbl2:
936                    jne.obj v1, lbl1
937          - description: Chain of forward jumps
938            values:
939              - |
940                #
941                    jne.obj v1, lbl1
942                    ldai 2
943                    return
944                lbl1:
945                    jne.obj v1, lbl2
946                    ldai 3
947                    return
948                lbl2:
949                    jne.obj v1, lbl3
950                    ldai 4
951                    return
952                lbl3:
953                    jne.obj v1, lbl4
954                    ldai 5
955                    return
956                lbl4:
957                    jne.obj v1, quit
958            tags: [tsan]
959          - description: Chain of backward jumps
960            values:
961              - |
962                #
963                    jmp lbl1
964                lbl6:
965                    jmp quit
966                lbl5:
967                    jne.obj v1, lbl6
968                    ldai 5
969                    return
970                lbl4:
971                    jne.obj v1, lbl5
972                    ldai 4
973                    return
974                lbl3:
975                    jne.obj v1, lbl4
976                    ldai 3
977                    return
978                lbl2:
979                    jne.obj v1, lbl3
980                    ldai 2
981                    return
982                lbl1:
983                    jne.obj v1, lbl2
984            tags: [tsan]
985